# Whautomate Rest API

## **General Use Cases:**

* Add Clients from External Systems through API
* Sync Clients from External Systems through API
* Add Client to tags to segment clients and trigger automations to send messages
* Remove Client from tags to segment clients and trigger automations to send messages
* Add Contacts from External Systems through API&#x20;
* Add Contacts to Segments by adding Tags and triggering automations to send messages, etc.
* Update Contact Stage based on events to manage Sales funnel
* Remove Contacts from Tags to segment and trigger automations&#x20;
* Manage Custom Fields of Clients/Contacts
* Manage Customer Segmentation via API and run targeted campaigns
* Trigger Broadcasts via API
* View Staffs and block staff's time from external applications through API
* Create and update Services through API
* Book, Reschedule and Cancel Appointments through API
* Create, Update and Delete Classes through API
* Add and Remove Participants from a Class through API

## API Host:

For seamless integration with Whautomate's services, use the appropriate API host based on your geographical location:

Global: <mark style="color:purple;"><https://api.whautomate.com></mark>

India: <mark style="color:purple;"><https://api.in.whautomate.com></mark>

{% hint style="info" %}
To determine the correct API host, visit the 'Rest API' section under 'Integrations' in your Whautomate account and copy your host name. Use the relevant hostname for your region when making API calls for optimal performance.
{% endhint %}

## **API Key Authentication with x-api-key Header**

Authentication is vital when accessing Whautomate's APIs to ensure secure and authorized interactions. To authenticate your API requests, Whautomate utilizes API keys. These keys act as unique identifiers, granting access to the platform's functionalities.

Follow these steps to authenticate using your generated API key:

**Generating the API Key:**\
Access your Whautomate account and navigate to the Integrations-> REST API settings to generate an API key. This key serves as your credential for API authentication.

**Adding API Key to the Header:**\
When making API requests, include the API key in the header of your HTTP requests. Specifically, append the API key to the `x-api-key` header parameter.

```
Example:

curl -X GET 'https://api.whautomate.com/some_endpoint' -H 'x-api-key: YOUR_API_KEY'

```

## Rate Limits

At Whautomate, we prioritize fairness, stability, and security in our platform. That's why we implement rate limits on our API for every account. These limits ensure fair usage for all users and protect against system abuse.

Why do we have Rate Limits?

**To ensure fairness:** Rate limits make sure that everyone using our platform has an equal chance to access its resources, preventing any one user from taking over.

**For system stability:** By managing the flow of traffic, rate limits keep our system running smoothly, reducing the chances of it crashing or slowing down.

**To enhance security:** Rate limits act as a shield against malicious attacks, like DDoS, by putting a cap on how many requests can be made, preventing any one user from overwhelming the system.

{% hint style="success" %}
For enterprise customers needing higher limits, contact us for assistance. Additional pricing may apply.
{% endhint %}

| Type of Account    | Requests per minute (RPM) | Requests per day (RPD) |
| ------------------ | ------------------------- | ---------------------- |
| Trial Account      | 60                        | 100                    |
| Subscribed Account | 300                       | 432,000                |

## Get Started

**Step 1:** Go to the Integrations page in the Whautomate platform then scroll down and select the **REST API** connect button to continue.

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2F9l66exjxoycuVMqEAHPF%2Fimage.png?alt=media&#x26;token=c3232321-c5a3-4d9f-8a06-9f0f5a4379e9" alt=""><figcaption></figcaption></figure>

**Step 2:** To copy Your API Host URL, simply click on the "**Copy**" button.

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2FfRopj2Uq5VaQSGmKWPOc%2FRest%20API%201.png?alt=media&#x26;token=1187cd0f-a982-47dd-8e53-7df3cff07bcb" alt=""><figcaption></figcaption></figure>

**Step 3:** Select the **New API Key** button, Enter a key name (e.g. Whautomate API) and Select the **Generate** button to get the API Key.

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2FWxN9ogCDsz9LMyv7ZjZe%2FRest%20API%202.png?alt=media&#x26;token=7cecf24d-50ef-4af5-974a-df191a93489c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2FF6L9MOSIVbUKTk4Bi4iz%2FRest%20API%203.png?alt=media&#x26;token=5f639967-0fa9-40ef-8c7f-b570682e8b2b" alt=""><figcaption></figcaption></figure>

**Step 4:** Your Whautomate API key has been generated successfully just copy and use it.

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2FrJnoOhoJbp26MaDOslpu%2FRest%20API%204.png?alt=media&#x26;token=e862a20a-f3ca-4481-be34-db2cb0b64ff6" alt=""><figcaption></figcaption></figure>

## How to test Whautomate Rest API in Postman

**Step 1:** Please download the setup files for the Whautomate REST API Postman Collection. 👇

{% file src="<https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2Ffk2zYE2ENMWM3Oa9Uadz%2FWhautomate%20Rest%20API.postman_collection.zip?alt=media&token=be90132f-668c-485a-a8fd-5acba65dd84d>" %}

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2FAQl11o2Y9YkrnY41iP18%2FCapture.PNG?alt=media&#x26;token=861ce5fa-074c-4ed4-ae2f-ad7b43e21893" alt=""><figcaption></figcaption></figure>

**Step 2:** (i) Open the Postman app, select the **Import** button, and drag and drop the Whautomate REST API Postman Collection files. ☝

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2FbF4bKUSuuUJwp0ERMl0o%2FPostman%20Import%20Files.png?alt=media&#x26;token=6277fc1a-db3a-4055-972e-ab5ffb862053" alt=""><figcaption></figcaption></figure>

(ii) Select the **Import** button to continue.

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2FOEWRNTYESFLF6zhQEKA8%2F2.png?alt=media&#x26;token=cfa389bb-9dae-41b3-bd71-ffac61d047c0" alt=""><figcaption></figcaption></figure>

**Step 3:** Select the **Environments** menu, Choose the **Whautomate Rest API** option to continue.

(i) Paste the API host URL in the **host - CURRENT VALUE** field.

Use the appropriate API host based on your geographical location:

**Global:** <https://api.whautomate.com>

**India:** <https://api.in.whautomate.com>

(ii) Paste the Whautomate-generated API Key in the **x-api-key - CURRENT VALUE** field.

(iii) Once done select the **Save** option to connect the Whautomate Rest API successfully.

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2FHIj5Kqab9Hxul0BwaTQ6%2F3.png?alt=media&#x26;token=5ce1bb70-0d3d-465c-84c5-43571a4fae2b" alt=""><figcaption></figcaption></figure>

Step 4: Select the **Collections** menu and Choose the **Whautomate Rest API** option to access the following API endpoints

* Clients
* Client Tags
* Contacts
* Contact Tags
* Staffs
* Locations
* Segments
* Broadcasts
* Messages
* Service Categories
* Services
* Appointments
* Classes

<figure><img src="https://810714386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8vuadG7OJ1fFdSBZATv%2Fuploads%2F1IxA64AnP4cSuN4p6iVJ%2F4.PNG?alt=media&#x26;token=bdfe9022-2171-4dcb-9d26-59d75b923fe4" alt=""><figcaption></figcaption></figure>

Here are the articles in this section:

{% content-ref url="whautomate-rest-api/client-tags" %}
[client-tags](https://help.whautomate.com/product-guides/whautomate-rest-api/client-tags)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/clients" %}
[clients](https://help.whautomate.com/product-guides/whautomate-rest-api/clients)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/contact-tags" %}
[contact-tags](https://help.whautomate.com/product-guides/whautomate-rest-api/contact-tags)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/contacts" %}
[contacts](https://help.whautomate.com/product-guides/whautomate-rest-api/contacts)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/locations" %}
[locations](https://help.whautomate.com/product-guides/whautomate-rest-api/locations)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/staffs" %}
[staffs](https://help.whautomate.com/product-guides/whautomate-rest-api/staffs)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/segments" %}
[segments](https://help.whautomate.com/product-guides/whautomate-rest-api/segments)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/broadcasts" %}
[broadcasts](https://help.whautomate.com/product-guides/whautomate-rest-api/broadcasts)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/messages" %}
[messages](https://help.whautomate.com/product-guides/whautomate-rest-api/messages)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/service-categories" %}
[service-categories](https://help.whautomate.com/product-guides/whautomate-rest-api/service-categories)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/services" %}
[services](https://help.whautomate.com/product-guides/whautomate-rest-api/services)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/appointments" %}
[appointments](https://help.whautomate.com/product-guides/whautomate-rest-api/appointments)
{% endcontent-ref %}

{% content-ref url="whautomate-rest-api/classes" %}
[classes](https://help.whautomate.com/product-guides/whautomate-rest-api/classes)
{% endcontent-ref %}
