API Documentation

💬 Introduction

​Desk360 API is a Representational State Transfer (REST) ​​structure that provides operations such as: Reading Modifying Adding data Deleting data from your help desk.

Desk360 APIs also support Cross-Origin Resource Sharing (CORS).

HTTP Methods

The list of API commands used by Desk360

Command

Description

GET

Fetches object(s)

POST

Creates an object

PUT

Updates/Modifies an object

DELETE

Deletes an object

All API requests must reach the secure endpoint i.e. HTTPS only

💨 Rate Limit

This rate limit applies are based on IP address.

Plan

Rate Limit/Minute

Business

60

  • Make sure to apply the rate limit-best practices and it stays within the rate limit.

  • Make sure to make API calls in a safe layer such as your backend, not front-end or your mobile application.

  • Remind that even invalid requests are included in the rate limit.

Check your current rate limit status by looking at the following HTTP headers returned in response to each API request:

HTTP/1.1 200 OK
Content-Type: application/json
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58

Title

Description

X-RateLimit-Limit

Total number of API calls allowed per minute.

X-RateLimit-Remaining

The number of requests remaining in the current rate limit window.

X-RateLimit-Reset

The reset time in Unix epoch time format.

Retry-After

The number of seconds you should wait in order to trigger your next API request.

This header is returned only when the rate limit is reached.

If your API request is received after the rate limit is reached, Desk360 will return an error in the response. The Retry-After value in the response header will tell you how long to wait before sending another API request.

HTTP/1.1 200 OK
Content-Type: application/json
Retry-After: 26

🚀 Getting Started

🔒 Authentication

Who can access my helpdesk? Can anyone see my data?

Before prioritizing a ticket or responding to a customer or using any of the APIs listed above, you must authenticate or log in as you sign in to your helpdesk web portal.

To authenticate the request, you can use your personal. You can obtain your API token with a request with your username and password.

All Desk360 API endpoints (except login) need this token in order to respond to your request.

Obtain your token with a request.

You can directly use v1/login endpoint in order to create/obtain an API token. This API will return an auto-generate a token and returns it.

To make it secure, the maximum wrong login attempt is fixed to 5 per minute.

Correct attempts do not affect the limits.

Login

POST https://public-api.desk360.com/v1/login

Use a valid email and password pair to obtain a token.

Request Body

NameTypeDescription

email

string

An email that is already registered

password

string

The user's password

{
    "access_token": "1|iybflVqHloQdz9QH4PIkX0q1Od68T9sDrKCtnuxW6f78ad5b",
    "token_type": "Bearer"
}
curl --location --request POST 'https://public-api.desk360.com/v1/login' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "abc@example.com",
    "password": "YOUR_PASSWORD"
}'

📎 Attachments

The following endpoints are supported with attachments:

Sending a media message Sending a interactive message

Please follow the guidelines listed below:

  • Only files on a local machine can be added using the API. You can not use links!

  • Content-Type should always be multi-part/form-data for attached requests.

Errors

I received an error. How can I solve it?

API requests that cause errors will return an appropriate HTTP status code to help determine the type of error. You can use the following table to understand what each code means:

HTTP Status Code

Status Code Definition

Description

400

Client or Validation Error

The request body/query string is not in the correct format.

For example, the Send a message API requires the to field to be submitted as part of the request, and if it is missing, this status code is returned.

401

Authentication Failure

This indicates that the Authorization field is either missing or incorrect.

Check Authentication for more information.

404

Requested Resource not Found

The request contains an invalid ID or invalid parameters in the URL. For example, an API call to retrieve a integration with an invalid ID will return an HTTP 404 status code to inform you that no such integration exists.

405

Method not allowed

This API request has used the wrong HTTP method.

For example, a DELETE requested on /integrations endpoint will return an HTTP 405 as /integrations allows only GET requests.

406

Unsupported Accept Header

Only application/json and */* are supported. When uploading files multipart/form-data are supported.

415

Unsupported Content-type

Only application/json is supported.

429

Rate Limit Exceeded

The API rate limit allowed for your Desk360 domain has been exhausted. Check Rate Limit.

500

Unexpected Server Error

You can't do much more here. This indicates an error on the Desk360 side. Please email us your API script with response headers. We will contact you and fix this issue as soon as possible.

Sample error response

In addition to the HTTP status code, most errors also return a response with more information to help you troubleshoot the error. An example error response is shown below. The format of the error response is explained after the example.

    "error": {
        "code": "failed_validation",
        "message": "The to field is required."
        "doc_url": "https://docs.desk360.com/api"
    }
}

Error Response Fields

Field

Description

code

Custom error code that is machine-parseable.

message

Descriptive error message.

doc_url

A link to guide you if there is a solution on the documentation.

Error Codes

Code

Description

authentication_exception

Authentication failed. The token is missing or invalid. Do not forget to put "Bearer" in the beginning of your token. eg: "Bearer YOUR-API-TOKEN"

method_not_allowed_exception

If the method and endpoint is mismatched, you will get this error. Please check the endpoint method. eg: Products only allows GET method.

not_found_exception

You may have made a typo in your request URL.

model_not_found_exception

Requested resource not found, the resource maybe deleted or maybe the resource is not yours.

internal_server_error

The error is coming from our servers. If you have been receiving this error message for a while, contact us.

insecure_request_exception

HTTP is not allowed. Use HTTPS instead.

too_many_requests_exception

Check Rate Limit.

invalid_credentials

You typed your email/password wrong.

too_many_attempts

If you entered your email/password wrong more than 5 times, you should wait for a minute.

not_authorized

You do not have permission to modify the resource.

not_found

Requested resource not found, the resource maybe deleted or maybe the resource is not yours.

failed_validation

This is a validation error, please read the message and apply what it says.

📄 Pagination

API responses that return a list of objects are paginated, for example, View Integration List. Add the parameter page to the query string to navigate through the pages. The page number starts from 1 and each page is fixed to show 20 objects.

https://public-api.desk360.com/api/v1/integrations?page=1

The "Link" header in the response will be showing the next page if it exists:

Headers
"Link" : <https://public-api.desk360.com/v1/integrations?page=2>; rel=next

If you are on the last page the link header will not be filled.

Best Practices

  • Whenever it is possible, please queue API calls on your side. This allows you to buffer recent calls to avoid reaching the rate limit. Once you reach the rate limit, retry API calls after the retry period.

  • Whenever it is feasible, cache the data that does not change much on your side. For example, the mapping between agent name and ID is extremely unlikely to change, so it is a useful approach to cache this data to avoid the rate limit.

  • Avoid making API calls directly from a mobile app, instead, send the request to your servers and make API calls from there. This ensures that if an API endpoint is changed, you can make and deploy the change on your server instead of updating your application and forcing your customers to the latest version.

Integrations

Apart from its competitors, Desk360 enables its customers to manage multiple integrations under one account.

In order to find your Integration ID, visit Integrations.

Integrations

GET https://public-api.desk360.com/v1/integrations

List of your integrations.

Headers

NameTypeDescription

Authorization *

string

Your API token

[
    {
        "id": 11,
        "display_name": "YourIntegration1",
        "phone_number": "+905554443322"
    },
    {
        "id": 22,
        "name": "YourIntegration2",
        "logo": "+905555555555"
    }
]

Code Samples

curl --location --request GET 'https://public-api.desk360.com/v1/integrations' \
--header 'Authorization: Bearer YOUR_API_TOKEN'

WhatsApp Message Templates

WhatsApp message templates are message formats that let you deliver multiple notifications to customers who have agreed to receive them via WhatsApp.

WhatsApp Message Templates

GET https://public-api.desk360.comv1/integrations/:integrationId/conversations/templates

Get WhatsApp message template and languages list from a product.

Path Parameters

NameTypeDescription

IntegrationId *

Integer

The ID of your integration

Headers

NameTypeDescription

Authorization *

String

Your API Token

[
  {
    "id": 75,
    "name": "template_02",
    "category_editable": false,
    "sendable": true,
    "category": {
      "value": 2,
      "label": "template-messages.new.custom",
      "subLabel": "template-messages.new.custom-subtitle",
      "status": 1,
      "children": []
    },
    "category_label": "template-messages.new.custom",
    "supported_languages": [
      {
        "label": "English",
        "value": 1,
        "filled": true
      },
      {
        "label": "Türkçe",
        "value": 2,
        "filled": true
      }
    ],
    "translations": [
      {
        "language_id": 1,
        "language": "English",
        "header_type": null,
        "header_variables": null,
        "header": null,
        "header_file": null,
        "body": "English content test",
        "body_variables": null,
        "footer": null,
        "variables": [],
        "buttons": [],
        "editable": true,
        "status": "template-messages.in-review",
        "status_value": 1,
        "quality": "template-messages.quality-unavailable",
        "updated_at": "2024-05-31T06:33:30.000000Z"
      },
      {
        "language_id": 2,
        "language": "Türkçe",
        "header_type": {
          "value": 4,
          "label": "TEXT"
        },
        "header_variables": [
          {
            "id": "",
            "key": "1",
            "value": "Header 1"
          }
        ],
        "header": "Merhaba {{1}} ,",
        "header_file": null,
        "body": "Merhaba {{1}}, Sipariş takip numaranız: {{2}} Bu takip numarası ile siparişinizin durumunu sorgulayabilirsiniz.",
        "body_variables": [
          {
            "id": "",
            "key": "1",
            "value": "Ahmet Kara"
          },
          {
            "id": "",
            "key": "2",
            "value": "SP123456789"
          }
        ],
        "footer": null,
        "variables": [
          "header-1",
          "body-1",
          "body-2"
        ],
        "buttons": [],
        "editable": true,
        "status": "template-messages.active",
        "status_value": 2,
        "quality": "template-messages.quality-unavailable",
        "updated_at": "2024-05-30T12:16:37.000000Z"
      }
    ],
    "created_at": "2024-05-30T12:14:28.000000Z",
    "updated_at": "2024-05-31T06:33:30.000000Z"
  }
]

Code Samples

curl --location --request GET 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/?page=1' \--header 'Authorization: Bearer YOUR_API_TOKEN'

Send WhatsApp Message Template

POST https://public-api.desk360.com/v1/integrations/:integrationsId/conversations/templates/send

Send active WhatsApp message template to a WhatsApp number. If you send with attachments, use form-data. You can also send other body parameters with form-data as well.

Path Parameters

NameTypeDescription

IntegrationId *

Integer

The ID of your integration

Headers

NameTypeDescription

Authorization *

string

Your API Token

Request Body

NameTypeDescription

template_id *

Integer

The template id of the template to be sent.

language_id *

Integer

The language id of the template to be sent.

destinations[] *

array

Required parameters for the template. The key list received in the template list should be used as a key during submission.

destinations.*.phone *

string

WhatsApp number to be sent. It should start with (+) and a country code.

destinations.*.parameters

object

Required parameters for the template. The key list received in the template list should be used as a key during submission.

attachment

file

Attachment for the message template (only allowed in form-data).

{
    "message_id": "gBEGkFBXUQRnAglW0luHY8xsrFk"
}

Code Samples

curl --location --request POST 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send' \
--header 'Authorization: YOUR_API_TOKEN' \
--form 'template_id="1"' \
--form 'language_id="1"' \
--form 'destinations[0][phone]="+905555555555"' \
--form 'destinations[0][parameters][header-1]="Header 1"' \
--form 'destinations[0][parameters][body-1]="Body 1"' \
--form 'destinations[0][parameters][body-2]="Body 2"' \
--form 'attachment=@"/test_image.jpg"'

Bulk Send WhatsApp Message Template

POST https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send/bulk

Send active WhatsApp message template to multiple WhatsApp number. If you send with attachments, use form-data. You can also send other body parameters with form-data as well.

Path Parameters

NameTypeDescription

IntegrationId *

Integer

The ID of your integration

Headers

NameTypeDescription

Authorization *

string

Your API Token

Request Body

NameTypeDescription

template_id *

Integer

The template id of the template to be sent.

language_id *

Integer

The language id of the template to be sent.

destinations[]

array

Destinations for the template.

destinations.*.phone

string

WhatsApp number to be sent. It should start with (+) and a country code.

parameters

object

Required parameters for the template. The key list received in the template list should be used as a key during submission.

attachment

file

Attachment for the message template (only allowed in form-data).

destinations_file

file

WhatsApp numbers csv file to be sent. It should start with (+) and a country code.

{
    "phones": [
        "+905555555555"
    ]
}

Code Samples

curl --location --request POST 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send/bulk' \
--header 'Authorization: YOUR_API_TOKEN' \
--form 'template_id="1"' \
--form 'language_id="1"' \
--form 'destinations[0][phone]="+905555555555"' \
--form 'parameters[header-1]="Header 1"' \
--form 'parameters[body-1]="Body 1"' \
--form 'parameters[body-2]="Body 2"' \
--form 'attachment=@"/test_image.jpg"'

WhatsApp Messages

Use the messages node to send text, location, contact, media, interactive, location request and read receipt message to your customers.

Send WhatsApp Message

POST https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages

Send message to an active WhatsApp number.

Path Parameters

NameTypeDescription

IntegrationId*

Integer

The ID of your integration

Headers

NameTypeDescription

Authorization *

string

Your API Token

Request Body

NameTypeDescription

to*

string

WhatsApp number to be sent. It should start with (+) and a country code.

text *

string

Message body. It should max 4096 chars.

{
    "message_id": "gBEGkFBXUQRnAgnoOJ1ESPKBwME"
}

Code Samples

curl --location --request POST 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--form 'to="+90xxxxxxxxxx"' \
--form 'text="Hello!"'

Send WhatsApp Location Message

POST https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages

Send location message to an active WhatsApp number.

Path Parameters

NameTypeDescription

IntegrationId*

Integer

The ID of your integration

Headers

NameTypeDescription

Authorization *

String

Your API Token

Request Body

NameTypeDescription

to*

String

WhatsApp number to be sent. It should start with (+) and a country code.

location*

Object

An object of the message.

location.longitude*

Numeric

Longitude of location.

location.latitude*

Numeric

Latitude of location.

location.name*

String

Name of location.

location.address*

String

Address of location.

{
    "message_id": "gBEGkFBXUQRnAgn3kXajlucbaso"
}

Code Samples

curl --location --request POST 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages/locations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--data '{
    "to": "+90xxxxxxxxxx",
    "location": {
        "longitude": -122.425332,
        "latitude": 37.758056,
        "name": "Facebook HQ",
        "address": "1 Hacker Way, Menlo Park, CA 94025"
    }
}'