# Conversation API | Sinch # Overview Send and receive messages globally over SMS, RCS, WhatsApp, Viber Business, Facebook messenger and other [popular channels](/docs/conversation/channel-support/) using the Sinch Conversation API. {% admonition type="info" name="Note:" %} If you would like help setting up your Conversation API solution, and want to quickly get started sending and receiving messages, review our [Getting Started guide](/docs/conversation/getting-started/). {% /admonition %} The Conversation API endpoint uses built-in transcoding to give you the power of conversation across all supported channels and, if required, full control over channel specific features. Download the OpenAPI specification [here](/docs/conversation/api-reference/conversation.yaml). ## Authentication ## OAuth2.0 authentication {% partial file="/partials/authentication/oauth/_intro.md"/ %} {% partial file="/partials/authentication/oauth/_instructions.md"/ %} ## Basic authentication {% partial file="/partials/authentication/basic/_intro.md"/ %} {% partial file="/partials/authentication/basic/_instructions.md"/ %} ## Base URL The following URLs can be used when making calls to the Conversation API (or Template Management API, which is used in coordination with the Conversation API). The [Conversation Batch API](/docs/conversation/api-reference/batch-api) endpoints, which are available for beta testing, are also listed. |Server|URL| |------|---| |Conversation API (US Production)|`https://us.conversation.api.sinch.com`| |Conversation API (EU Production)|`https://eu.conversation.api.sinch.com`| |Conversation API (BR Production)|`https://br.conversation.api.sinch.com`| |Template Management API (US Production)|`https://us.template.api.sinch.com`| |Template Management API (EU Production)|`https://eu.template.api.sinch.com`| |Template Management API (BR Production)|`https://br.template.api.sinch.com`| |Conversation Batch API (Beta) (US)|`https://us.conversationbatch.api.sinch.com`| |Conversation Batch API (Beta) (EU)|`https://eu.conversationbatch.api.sinch.com`| |Conversation Batch API (Beta) (BR)|`https://br.conversationbatch.api.sinch.com`| Note that, when making a call to the Conversation API or Template Management API, you must target the regional server that corresponds to the region in which you created your Conversation API app. ## Postman collection Sinch offers a Postman collection for easy setup and testing during development. For ease of use, follow the next link [Postman Collection](https://www.postman.com/collections/23476432-04d72265-d912-405c-b46e-b8afe2d5fddf), into a Firefox browser or, use the Import option in Postman. After importing the collection, fill in the following variables: | Variable | Value | | -------- | ----- | | PROJECT | Your PROJECT ID | | APP | Your app ID | | CLIENT_ID | Your CLIENT_ID | | CLIENT_SECRET | Your client secret | For testing purposes, fill the WEBHOOK_URL by visiting and use the generated link - the one under the **Your unique URL** label. {% admonition type="warning" name="Caution:" %} The URL given above should only be used for testing purposes. Using the Conversation API can generate high volumes of callbacks, which can easily exceed the TPS limits of certain webhook services. Additionally, sensitive information may be included in the callback, including message content and contact information. Ensure that you use a scalable and secure callback/webhook processor after your initial testing is complete. {% /admonition %} Values for other variables can be obtained by calling corresponding requests: - CONTACT - ID of contact created by calling **Create contact** request. - WEBHOOK_ID - ID of webhook created by calling **Create webhook** request. - CONVERSATION - a Conversation is created automatically when sending a new message. For example, with a Text Message request, send a message, then call [List conversations](https://developers.sinch.com/reference#conversation_listconversations) to get the ID of the conversation for this variable. ## Errors When requests are erroneous, the Sinch Conversation API will respond with standard HTTP status codes, such as 4xx for client errors. All responses include a JSON body of the form: ```json { "error": { "code": 401, "message": "Request had invalid credentials.", "status": "UNAUTHENTICATED", "details": [{ "@type": "type.googleapis.com/google.rpc.RetryInfo", ... }] } } ``` The table below describes the fields of the error object: | Name | Description | JSON Type | | ------- | ----------------------------------- | ---------------- | | Code | HTTP status code | Number | | Message | A developer-facing error message | String | | Status | Response status name | String | | Details | List of detailed error descriptions | Array of objects | ### Common error responses | Status | Description | | ------ | ----------------------------------------------------------------------- | | 400 | Malformed request. For example, the message body of a request made to the `message/send` endpoint does not contain the `app_id` field, which is required. Alternatively, this error may be triggered if required fields **are** included, but populated incorrectly. For example, the `app_id` field is included in a `message/send` request, but the value is not a ULID (and, therefore, fails a basic form check).| | 401 | Incorrect credentials. For example, you may get this error if you provide incorrect `client_id` and `client_secret` values when using basic authentication. You may also get this error if you provide a bearer token generated using incorrect basic authentication credentials or if you provide an expired token (generated using the OAuth2.0 client credentials flow).| | 403 | Correct credentials but you don't have access to the requested resource. This typically occurs paired with an `UNAUTHORIZED` message when the provided `client_id` and `client_secret` are not associated with the `project_id` required for most Conversation API calls. Starting February 19, 2025, this error may also be paired with a `BILLING_CREDIT_LIMIT_BREACHED` message. If paired with `BILLING_CREDIT_LIMIT_BREACHED` message, the project is blocked due to credit reasons. In this case, check your project's billing configuration and balance. | | 404 | The resources provided for the call are insufficient to complete the call, or the server cannot locate the required resources. For example, if the `app_id` provided in the call doesn't match a Conversation API app contained within the corresponding project, or the region in which the app was created does not match the regional server targeted by the call. Additionally, this error occurs if you provide designate Conversation API endpoint that doesn't actually exist.| | 429 | See [Rate Limits](/docs/conversation/api-reference/#rate-limits). | | 500 | Something went wrong on our end, try again with exponential back-off | | 501 | Something went wrong on our end, try again with exponential back-off | | 503 | Something went wrong on our end, try again with exponential back-off | ## Rate Limits The Conversation API has two kinds of rate limits that may result in status `429 Too Many Requests`: - Conversation API apps have a maximum MT ingress queue size of 500000 messages, which are drained towards the channel at a rate of 20 messages per second by default (this rate may be higher if the channel has been purchased with a higher capacity). - Projects are limited to 800 requests per second across all apps and most endpoints. Making over 800 requests per second over an extended period of time may saturate the app-specific ingress queue, resulting in rate limiting. In addition to project and app level limitations, each channel also has rate limitations that can affect performance, and may return a `429 Too Many Requests` error. In some cases (for example, the SMS channel), these rate limits can be adjusted. In others (for example, the Instagram channel), they can't be adjusted. For more information about raising project, app, or channel rate limits, contact your Sinch account manager. Version: 1.0 License: MIT ## Servers The {region} variable must be set to us, eu, or br, and it must match the region in which you created your Conversation API app. ``` https://{region}.conversation.api.sinch.com ``` Variables: - `region` Default: "us" Enum: "us", "eu", "br" ## Security ### Basic For more information about basic authentication, see [Basic Authentication](https://developers.sinch.com/docs/conversation/api-reference/#authentication). Type: http Scheme: basic ### oAuth2 The user name and password are your client_id and key_secret from the [Access keys sections](https://dashboard.sinch.com/settings/access-keys) Type: oauth2 ## Download OpenAPI description [Conversation API | Sinch](https://developers.sinch.com/_bundle/docs/conversation/api-reference/conversation.yaml) ## Messages To start sending messages you must have a Conversation API [**app**](https://dashboard.sinch.com/convapi/apps). The app holds information about the channel credentials and registered webhooks to which the API delivers callbacks such as message delivery receipts and contact messages. If you don't already have an app please follow the instructions in the getting started guide available in the [Sinch Dashboard](https://dashboard.sinch.com/convapi/getting-started) to create one. ### Send a message - [POST /v1/projects/{project_id}/messages:send](https://developers.sinch.com/docs/conversation/api-reference/conversation/messages/messages_sendmessage.md): You can send a message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically. You can find all of your IDs and authentication credentials on the Sinch Customer Dashboard. ### Update message metadata - [PATCH /v1/projects/{project_id}/messages/{message_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/messages/messages_updatemessagemetadata.md): Update a specific message metadata by its ID. ### Get a message - [GET /v1/projects/{project_id}/messages/{message_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/messages/messages_getmessage.md): Retrieves a specific message by its ID. ### Delete a message - [DELETE /v1/projects/{project_id}/messages/{message_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/messages/messages_deletemessage.md): Delete a specific message by its ID. Note that this operation deletes the message from Conversation API storage; this operation does not affect messages already delivered to recipients' handsets. Also note that removing all messages of a conversation will not automatically delete the conversation. ### List messages - [GET /v1/projects/{project_id}/messages](https://developers.sinch.com/docs/conversation/api-reference/conversation/messages/messages_listmessages.md): This operation lists all messages sent or received via particular Processing Modes. Setting the messages_source parameter to CONVERSATION_SOURCE allows for querying messages in CONVERSATION mode, and setting it to DISPATCH_SOURCE will allow for queries of messages in DISPATCH mode. Combining multiple parameters is supported for more detailed filtering of messages, but some of them are not supported depending on the value specified for messages_source. The description for each field will inform if that field may not be supported. The messages are ordered by their accept_time property in descending order, where accept_time is a timestamp of when the message was enqueued by the Conversation API. This means messages received most recently will be listed first. ## App Apps are created and configured through the [Sinch Dashboard](https://dashboard.sinch.com/convapi/apps), are tied to the API user and come with a set of **channel credentials** for each underlying connected channel. The app has a list of **conversations** between itself and different **contacts** which share the same **project**. Webhooks, which the app is attached to, defines the destination for various events coming from the Conversation API. An **app** has the following configurable properties: | Field | Description | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------- | | Display name | The name visible in the [Sinch Dashboard](https://dashboard.sinch.com/convapi/apps). | | Conversation metadata report | Specifies the amount of **conversation**metadata that's returned as part of each callback. | | Retention Policy | The retention policy specifies how long messages, sent to or from an **app**, are stored by the Conversation API. | ### List all apps for a given project - [GET /v1/projects/{project_id}/apps](https://developers.sinch.com/docs/conversation/api-reference/conversation/app/app_listapps.md): Get a list of all apps in the specified project. ### Create an app - [POST /v1/projects/{project_id}/apps](https://developers.sinch.com/docs/conversation/api-reference/conversation/app/app_createapp.md): You can create a new Conversation API app using the API. You can create an app for one or more channels at once. The ID of the app is generated at creation and will be returned in the response. ### Get an app - [GET /v1/projects/{project_id}/apps/{app_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/app/app_getapp.md): Returns a particular app as specified by the App ID. ### Delete an app - [DELETE /v1/projects/{project_id}/apps/{app_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/app/app_deleteapp.md): Deletes the app specified by the App ID. Note that this operation will not delete contacts (which are stored at the project level) nor any channel-specific resources (for example, WhatsApp Sender Identities will not be deleted). ### Update an app - [PATCH /v1/projects/{project_id}/apps/{app_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/app/app_updateapp.md): Updates a particular app as specified by the App ID. Note that this is a PATCH operation, so any specified field values will replace existing values. Therefore, if you'd like to add additional configurations to an existing Conversation API app, ensure that you include existing values AND new values in the call. For example, if you'd like to add new channel_credentials, you can get your existing Conversation API app, extract the existing channel_credentials list, append your new configuration to that list, and include the updated channel_credentials list in this update call. ## Contact A contact is a collection that groups together underlying connected **channel recipient identities**. It's tied to a specific **project** and is therefore considered public to all **apps** sharing the same **project**. Most contact creation and maintenance is handled by the Conversation API's automatic [contact management](https://developers.sinch.com/docs/conversation/contact-management/) processes. However, you can also use API calls to manually manage your contacts. A **contact** has the following configurable properties: | Field | Description | | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- | | Channel identities | List of channel identities specifying how the contact is identified on underlying channels | | Channel priority | Specifies the channel priority order used when sending messages to this contact. This can be overridden by message specific channel priority order. | | Display name | Optional display name used in chat windows and other UIs | | Email | Optional Email of the contact | | External id | Optional identifier of the contact in external systems | | Metadata | Optional metadata associated with the contact. | ### List Contacts - [GET /v1/projects/{project_id}/contacts](https://developers.sinch.com/docs/conversation/api-reference/conversation/contact/contact_listcontacts.md): List all contacts in the project. Note that, if a WhatsApp contact is returned, the display_name field of that contact may be populated with the WhatsApp display name (if the name is already stored on the server and the display_name field has not been overwritten by the user). ### Create a Contact - [POST /v1/projects/{project_id}/contacts](https://developers.sinch.com/docs/conversation/api-reference/conversation/contact/contact_createcontact.md): Most Conversation API contacts are created automatically when a message is sent to a new recipient. You can also create a new contact manually using this API call. ### Get a Contact - [GET /v1/projects/{project_id}/contacts/{contact_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/contact/contact_getcontact.md): Returns a specific contact as specified by the contact ID. Note the following: - If a WhatsApp contact is returned, the display_name field of that contact may be populated with the WhatsApp display name (if the name is already stored on the server and the display_name field has not been overwritten by the user). - If you receive an Inbound Message callback for an MO message on the Instagram channel, the corresponding payload will not include the Instagram username. You may use the contact_id and channel_identity values included in the callback to retreive the username (detailed in the display_name field) with this Conversation API operation. ### Delete a Contact - [DELETE /v1/projects/{project_id}/contacts/{contact_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/contact/contact_deletecontact.md): Delete a contact as specified by the contact ID. ### Update a Contact - [PATCH /v1/projects/{project_id}/contacts/{contact_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/contact/contact_updatecontact.md): Updates a contact as specified by the contact ID. ### Merge two Contacts - [POST /v1/projects/{project_id}/contacts/{destination_id}:merge](https://developers.sinch.com/docs/conversation/api-reference/conversation/contact/contact_mergecontact.md): The remaining contact will contain all conversations that the removed contact did. If both contacts had conversations within the same App, messages from the removed contact will be merged into corresponding active conversations in the destination contact. Channel identities will be moved from the source contact to the destination contact only for channels that weren't present there before. Moved channel identities will be placed at the bottom of the channel priority list. Optional fields from the source contact will be copied only if corresponding fields in the destination contact are empty The contact being removed cannot be referenced after this call. ### Get Channel Profile - [POST /v1/projects/{project_id}/contacts:getChannelProfile](https://developers.sinch.com/docs/conversation/api-reference/conversation/contact/contact_getchannelprofile.md): Get user profile from a specific channel. Only supported on MESSENGER, INSTAGRAM, VIBER and LINE channels. Note that, in order to retrieve a WhatsApp display name, you can use the Get a Contact or List Contacts operations, which will populate the display_name field of each returned contact with the WhatsApp display name (if the name is already stored on the server and the display_name field has not been overwritten by the user). ### Lists Contact Identity Conflicts - [GET /v1/projects/{project_id}/contacts:identityConflicts](https://developers.sinch.com/docs/conversation/api-reference/conversation/contact/contact_listidentityconflicts.md): Lists contact identity conflicts across supported SIM-based channels (SMS, MMS, RCS). Use this to identify contact records sharing the same identity (e.g., phone number), which must be resolved before enabling the Unified Contact ID feature. ## Conversation Endpoints for working with the conversation log. ### List conversations - [GET /v1/projects/{project_id}/conversations](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/conversation_listconversations.md): This operation lists all conversations that are associated with an app and/or a contact. ### Create a conversation - [POST /v1/projects/{project_id}/conversations](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/conversation_createconversation.md): Creates a new empty conversation. It is generally not needed to create a conversation explicitly since sending or receiving a message automatically creates a new conversation if it does not already exist between the given app and contact. Creating empty conversation is useful if the metadata of the conversation should be populated when the first message in the conversation is a contact message or the first message in the conversation comes out-of-band and needs to be injected with InjectMessage endpoint. ### Get a conversation - [GET /v1/projects/{project_id}/conversations/{conversation_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/conversation_getconversation.md): Retrieves a conversation by id. A conversation has two participating entities, an app and a contact. ### Delete a conversation - [DELETE /v1/projects/{project_id}/conversations/{conversation_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/conversation_deleteconversation.md): Deletes a conversation together with all the messages sent as part of the conversation. ### Update a conversation - [PATCH /v1/projects/{project_id}/conversations/{conversation_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/conversation_updateconversation.md): This operation updates a conversation which can, for instance, be used to update the metadata associated with a conversation. ### List recent conversations - [GET /v1/projects/{project_id}/conversations:recent](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/conversation_listrecentconversations.md): This operation lists conversations and their most recent message, ordered by when the most recent message was sent for that conversation. ### Inject an event - [POST /v1/projects/{project_id}/conversations/{conversation_id}:inject-event](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/events_injectevent.md): This operation injects a conversation event in to a specific conversation. It only supports injecting App events in CONVERSATION mode. ### Stop conversation - [POST /v1/projects/{project_id}/conversations/{conversation_id}:stop](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/conversation_stopactiveconversation.md): This operation stops the referenced conversation, if the conversation is still active. A new conversation will be created if a new message is exchanged between the app or contact that was part of the stopped conversation. ### Inject a message - [POST /v1/projects/{project_id}/conversations/{conversation_id}:inject-message](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/conversation_injectmessage.md): This operation injects a conversation message in to a specific conversation. ## Events Endpoint for sending events. ### Send an event - [POST /v1/projects/{project_id}/events:send](https://developers.sinch.com/docs/conversation/api-reference/conversation/events/events_sendevent.md): Sends an event to the referenced contact from the referenced app. Note that this operation enqueues the event in a queue so a successful response only indicates that the event has been queued. ### Get an event - [GET /v1/projects/{project_id}/events/{event_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/events/events_getevent.md): Get event from ID ### Delete an event - [DELETE /v1/projects/{project_id}/events/{event_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/events/events_deleteevents.md): Delete a specific event by its ID. ### List events - [GET /v1/projects/{project_id}/events](https://developers.sinch.com/docs/conversation/api-reference/conversation/events/events_listevents.md): List all events in a project ## Transcoding Endpoint for transcoding generic message format to channel-specific one. ### Transcode a message - [POST /v1/projects/{project_id}/messages:transcode](https://developers.sinch.com/docs/conversation/api-reference/conversation/transcoding/transcoding_transcodemessage.md): Transcodes the message from the Conversation API format to the channel-specific formats for the requested channels. No message is sent to the contact. ## Capability A capability query checks the options available for reaching the [contact](https://developers.sinch.com/docs/conversation/keyconcepts/#contact) on the channels on which it has a channel identity. Capability queries can only be executed for contacts that already exist in a project and app. For executing the request, either the contact ID or the channel recipient identities of the contact are required. The request is executed asynchronously, therefore the service responds immediately. The result of the capability query is sent to the registered [webhook](https://developers.sinch.com/docs/conversation/keyconcepts/#webhook) for the **CAPABILITY** trigger. ### Capability lookup - [POST /v1/projects/{project_id}/capability:query](https://developers.sinch.com/docs/conversation/api-reference/conversation/capability/capability_querycapability.md): This method is asynchronous - it immediately returns the requested Capability registration. Capability check is then delivered as a callback to registered webhooks with trigger CAPABILITY for every reachable channel. ## Consent Consent queries provide a way to retreive any identities stored within a given consent list. You can also retrieve audit records that provide details for a given identity's journey through [consent management](https://developers.sinch.com/docs/conversation/consent-management/). ### Get identities from consent list - [GET /v1/projects/{project_id}/apps/{app_id}/consents/{list_type}](https://developers.sinch.com/docs/conversation/api-reference/conversation/consent/consents_getconsents.md): Get all identities contained within a consent list for a given project id, app id, and list type. ### Get audit records from consent lists - [GET /v1/projects/{project_id}/apps/{app_id}/consents/identities/{identity}](https://developers.sinch.com/docs/conversation/api-reference/conversation/consent/consents_getconsentsauditrecords.md): Get all audit records associated with the given identity from the consent lists within the specified project and app. ## Webhooks ### List webhooks - [GET /v1/projects/{project_id}/apps/{app_id}/webhooks](https://developers.sinch.com/docs/conversation/api-reference/conversation/webhooks/webhooks_listwebhooks.md): List all webhooks for a given app as specified by the App ID. ### Create a new webhook - [POST /v1/projects/{project_id}/webhooks](https://developers.sinch.com/docs/conversation/api-reference/conversation/webhooks/webhooks_createwebhook.md): Creates a webhook for receiving callbacks on specific triggers. You can create up to 5 webhooks per app. ### Get a webhook - [GET /v1/projects/{project_id}/webhooks/{webhook_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/webhooks/webhooks_getwebhook.md): Get a webhook as specified by the webhook ID. ### Update an existing webhook - [PATCH /v1/projects/{project_id}/webhooks/{webhook_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/webhooks/webhooks_updatewebhook.md): Updates an existing webhook as specified by the webhook ID. ### Delete an existing webhook - [DELETE /v1/projects/{project_id}/webhooks/{webhook_id}](https://developers.sinch.com/docs/conversation/api-reference/conversation/webhooks/webhooks_deletewebhook.md): Deletes a webhook as specified by the webhook ID. ## Project Settings ### Get Project Settings - [GET /v1/projects/{project_id}/settings](https://developers.sinch.com/docs/conversation/api-reference/conversation/project-settings/projectsettings_getsettings.md): Retrieves the current settings for the specified project, including contact management options such as Unified Contact ID. ### Create Project Settings - [POST /v1/projects/{project_id}/settings](https://developers.sinch.com/docs/conversation/api-reference/conversation/project-settings/projectsettings_createsettings.md): Creates initial settings for the project. Useful for enabling features like Unified Contact ID. For new projects with no existing contacts, you can enable Unified Contact ID immediately. ### Update Project Settings - [PATCH /v1/projects/{project_id}/settings](https://developers.sinch.com/docs/conversation/api-reference/conversation/project-settings/projectsettings_updatesettings.md): Updates project settings (e.g. enabling/disabling Unified Contact ID). For existing projects, you must resolve all identity conflicts before enabling Unified Contact ID. ### Delete Project Settings - [DELETE /v1/projects/{project_id}/settings](https://developers.sinch.com/docs/conversation/api-reference/conversation/project-settings/projectsettings_deletesettings.md): Deletes all project-level settings for the specified project.