Desk Platform API v1
Desk Platform API
Desk Platform API
Version 1

Prepare to use API

Copy link

Using Desk Platform API, you can directly interact with the different types of resources which represent data associated with customer support activities in your Sendbird Desk. The Desk API is designed to use standard HTTP protocols and return JSON payloads in response to HTTP requests and is internally implemented based on the RESTful principles. While the native SDKs handle many of the requests and responses at the client-side, the Desk API adds flexibility and abilities to your service from the server-side.

Note: The Desk API is not designed for client side use. Use the corresponding Desk SDKs instead.


Base URL

Copy link

The base URL used for the Desk API is formatted as shown below:

https://desk-api-{application_id}.sendbird.com/platform/v1

To get your Sendbird application ID, sign in to your dashboard, select the application, go to the Settings > Application > General, and then check the Application ID.


Headers

Copy link

A typical HTTP request to the Desk API includes the following headers:

Content-Type: application/json; charset=utf8
SENDBIRDDESKAPITOKEN: {desk_api_key}
  • Content-Type: every request must include a Content-Type header.
  • SENDBIRDDESKAPITOKEN: an API key of your Sendbird Desk is required for Sendbird server to authenticate your API requests. You can use any of API keys in your dashboard under Settings > Desk > Credentials.

DO NOT send any Desk API requests from your client app. If your API token information is leaked in the process of exchanging data, you could lose all your data by malicious API calls.

Multipart requests

Copy link

If your request contains a file, you should send a Multipart request. To make that request, specify multipart/form-data in the Content-Type header, as well as a boundary, which is a delimiter string that separates each data field.

HTTPPythoncURL
Content-Type: multipart/form-data; boundary={your_unique_boundary_string}

--{your_unique_boundary_string}
Content-Disposition: form-data; name="property1"

[value1]
--{your_unique_boundary_string}
Content-Disposition: form-data; name="property2"

[value2]
--{your_unique_boundary_string}
Content-Disposition: form-data; name="property3"; filename="{file_name}"
Content-Type: {Content-Type}

[binary contents of the file]
--{your_unique_boundary_string}--
# python: Create User API
import os
import requests
api_headers = {'Api-Token': '{master_api_token or secondary_api_token}'}
data = {
    'user_id': '{user_id}',
    'nickname': '{nickname}',
    'issue_access_token': true
}
filepath = os.path.join(os.path.dirname(__file__), FILE_PATH, '{file_name}')
upload_files = {'profile_file': ('{file_name}', open(filepath, 'rb'))}
res = requests.post('https://api-{application_id}.sendbird.com/v3/users',
        headers=api_headers, data=data, files=upload_files)

URL encoding

Copy link

When sending requests over HTTP, you should encode URLs into a browser-readable format. URL encoding replaces unsafe non-ASCII characters with a % followed by hex digits to ensure readability.

In the following URL, the value of the agent_id parameter should be urlencoded. For example, cindy@email.com should be urlencoded to cindy%40email.com.

GET https://desk-api-{application_id}.sendbird.com/platform/v1/agents/{agent_id}/connection

Therefore, your full request should be as below:

GET https://desk-api-{application_id}.sendbird.com/platform/v1/agents/cindy%40email.com/connection