# Conversation API | Sinch

# Overview
Send and receive messages globally over SMS, RCS, WhatsApp, Viber Business, Facebook messenger and other [popular channels](https://developers.sinch.com/docs/conversation/channel-support/) using the Sinch Conversation API.
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](https://developers.sinch.com/docs/conversation/getting-started/).
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.
## Authentication
## OAuth2.0 authentication
## Basic authentication
## Base URL
The following URLs can be used when making calls to the Conversation API:
| 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` |

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. Our [Postman collection page](https://developers.sinch.com/docs/conversation/postman-collection) has a link to the JSON format of the collection.
After importing the collection into Postman, 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 [https://webhook.site/](https://webhook.site/) and use the generated link - the one under the **Your unique URL** label.
The [https://webhook.site/](https://webhook.site/) 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.
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
 - In Conversation mode, 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/docs/conversation/api-reference/conversation/conversation/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 a designated Conversation API endpoint that doesn't actually exist. |
| 429 | See [Rate Limits](https://developers.sinch.com/docs/conversation/api-reference/conversation/section/overview/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
Token URL: https://auth.sinch.com/oauth2/token
Scopes:

## Download OpenAPI description

 - [Conversation API | Sinch](https://developers.sinch.com/_bundle/docs/conversation/api-reference/conversation.yaml)

## Messages

 - [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 t
 - [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. This operation is supported only in Conversation Mode.
 - [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 /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
 - [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](https://developers.sinch.com/docs/conversation/processing-modes/). Setting the `messages_source` parameter to `CONV
 - [POST /v1/projects/{project_id}/messages:fetch-last-message](https://developers.sinch.com/docs/conversation/api-reference/conversation/messages/messages_listmessagesbychannelidentity.md): Retrieves the last message sent to specified channel identities. In CONVERSATION_SOURCE mode, you can query either by channel_identities or by contact_ids. Note: Use either contact_ids OR channel_iden
## Apps

 - [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.
 - [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 /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 /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 Iden
 - [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 con
## 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
 - [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](https://developers.sinch.com/docs/conversation/contact-management/) when a message is sent to a new recipient. You can also create a new cont
 - [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
 - [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.
 - [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.
 - [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 corresp
 - [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 Contac
 - [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
## 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. Note that either `app_id` or `contact_id` is required in order for the operation to function correctly.
 - [POST /v1/projects/{project_id}/conversations](https://developers.sinch.com/docs/conversation/api-reference/conversation/conversation/conversation_createconversation.md): Creates a new empty conversation. In Conversation mode, it is generally not needed to create a conversation explicitly since sending or receiving a message automatically creates a new conversation if
 - [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 /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.
 - [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.
 - [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.
 - [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.
 - [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. In Conversation mode, a new conversation will be created if a new message is exchanged between the app or contact
 - [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

 - [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.
## Transcode

 - [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

 - [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 re
## Consents

 - [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 /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.
## Projects

 - [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.
 - [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.
 - [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 /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.
## 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.
 - [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 /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.
 - [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 /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.
