# How to create clients

The OctoTable API allows users to create a client to begin integrating with our reservation system.\
⚠️  To use the Octotable APIs correctly, you need to [download Postman](https://www.postman.com/downloads/) and avoid using the desktop version.\
&#x20;To initiate this process, a minimum set of attributes is required:

* **Name**: The name of the property.
* **Email**: The email associated with the property.
* **Username:** The username associated with user of the the property.
* **Password:** The password of the user.
* **Redirect Uri:** The redirect uri of the company's web page

Once the `Create Client` call is made, the system generates a **Client ID** and **Client Secret**, which are crucial for the next step in the integration.

**Generating an Access Token**

Using the provided **Client ID** and **Client Secret**, you can perform the `Generate Access Token` call. This token serves as the key to accessing the full functionality of the API.

**Testing Environment**

When a client is created, Octotable automatically sets up a **fake property** for testing purposes. \
This allows you to experiment with and test the API's features before using it in a live environment.

With the access token, you can proceed to execute all other operations available in the Octotable API \
\
**NOTE**\
The testing environment is available for a limited period, ensuring you have ample time to explore and familiarize yourself with the API's functionalities before transitioning to production.

⚙️ **Use the base resource URL** for the following examples, or [see complete collection](https://documenter.getpostman.com/view/50380496/2sB3dK1YWg#2fa66ba7-b915-4459-9e7c-67232d707994)

```
https://api.octotable.com/octotable-pms/api/v2
```

## 🆕 Create a new client

<mark style="color:yellow;">**`POST`**</mark> `/api-account/oauth2/client`

Creates a new oauth2 client

**Headers**

| Name           | Value              |
| -------------- | ------------------ |
| `Content-Type` | `application/json` |

**Body**

| Name           | Type   | Description                     |
| -------------- | ------ | ------------------------------- |
| `name`         | string | Name of the sandbox property    |
| `email`        | string | Email of the property           |
| `username`     | string | Username                        |
| `password`     | string | Password                        |
| `redirect_uri` | string | The redirect uri of the company |

**Request**

{% tabs %}
{% tab title="First Tab" %}

```json
curl --location 'https://api.octotable.com/octotable-auth/api/v2/api-account/oauth2/client'
--data-raw '{
    "redirect_uri": "http://localhost:8183/main-page",
    "sandbox_property": {
       "name": "Your Company SPA",
       "username": "yourcompany100@demo.com",
       "password": "yourCompany123!",
       "description": "A financial institution specializing in global banking",
       "email": "yourcompany1@demo.com",
       "website": "www.yourcmpany.com",
       "phone": "+1234567890",
       "position": {
           "latitude": 45.4442,
            "longitude": 9.9900,
            "country": "IT",
            "address": "Piazza, 33",
            "city": "Milan",
            "zip": "20154"
      }
   }
}'
```

{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}

**Response**

{% tabs %}
{% tab title="200 OK" %}

```json
{
    "data": [
        {
            "client_id": "public_8956990355e6df036-b5ff-48cd-b8be-b3d93fb752",
            "client_secret": "12404a0a-9cbf-4b40-82cc-32296e92c515",
            "id": 124,
            "username": "yourcompany100@demo.com",
            "password": "yourCompany123!",
            "properties": [
                {
                    "enabled": true,
                    "id": 999641,
                    "name": "Your Company SPA",
                    "position": {},
                    "sandbox": true
                }
            ],
            "redirect_uri": "http://your-webdite:80/main-page"
        }
    ]
}
```

{% endtab %}
{% endtabs %}
