Update PSTN Number Mappings
Link PSTN numbers to WhatsApp numbers and set who answers their incoming calls, for up to 500 numbers per request.
Sets, for many PSTN numbers in one request, which WhatsApp number each one is linked to and who answers its incoming calls: a team member or an AI agent. It does the same as editing a PSTN channel in the app (Channels → PSTN number → Edit channel details), for up to 500 numbers at a time.
Endpoint
POST https://public.doubletick.io/v1/call/pstn-mappings
Authentication
Pass your API key in the Authorization header.
| Header | Value |
|---|---|
| Authorization | <your-api-key> |
| Content-Type | application/json |
The API key's user needs permission to add channels, the same permission needed to edit a PSTN channel in the app.
NOTE
If you do not have your DoubleTick API Key, you can obtain it by following this guide link.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
mappings | array of objects | Yes | One object per PSTN number, 1 to 500 objects. Each object is described below. |
Mapping Object
| Field | Type | Required | Description |
|---|---|---|---|
pstnNumber | string | Yes | Your PSTN number, connected in your organization (e.g. +911234567890). |
whatsappNumber | string | Yes | Your WhatsApp number, connected in your organization, to link this PSTN number to. Calls on the PSTN number are logged in the customer's chat on this WhatsApp number (e.g. +919000000001). |
agentNumber | string | No | Phone number of the team member who should answer this number's incoming calls. Must match exactly one active member of your organization, and that member must have access to this PSTN number. |
aiAgentName | string | No | Exact name of the AI agent that should answer this number's incoming calls. The AI agent must be set up for voice calls. |
Routing
Send at most one of
agentNumberandaiAgentNamein a mapping. If you send neither, only the linked WhatsApp number changes and the number keeps the incoming call routing it already has.
All phone numbers take the country code, with or without the leading +, 7 to 15 digits (e.g. +919876543210 or 919876543210).
Example Request
curl --request POST \
--url https://public.doubletick.io/v1/call/pstn-mappings \
--header 'Authorization: <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"mappings": [
{
"pstnNumber": "+911234567890",
"whatsappNumber": "+919000000001",
"agentNumber": "+919812345678"
},
{
"pstnNumber": "+911234567891",
"whatsappNumber": "+919000000001",
"aiAgentName": "Sales Agent"
},
{
"pstnNumber": "+911234567892",
"whatsappNumber": "+919000000002"
}
]
}'
Example Response
{
"total": 3,
"updated": 1,
"unchanged": 1,
"failed": 1,
"results": [
{
"index": 0,
"pstnNumber": "+911234567890",
"status": "UPDATED"
},
{
"index": 1,
"pstnNumber": "+911234567891",
"status": "UNCHANGED"
},
{
"index": 2,
"pstnNumber": "+911234567892",
"status": "FAILED",
"code": "WHATSAPP_NUMBER_NOT_FOUND",
"message": "This WhatsApp number is not connected in your organization"
}
]
}
NOTE
A 200 means the request was read, even when some or all mappings failed. Check the counts and
resultsto see what happened to each mapping.
Response Fields
| Field | Type | Description |
|---|---|---|
total | number | Number of mappings in the request. |
updated | number | Mappings saved. |
unchanged | number | Mappings that were already in place, so nothing was written. |
failed | number | Mappings not saved. |
results | array | One entry per mapping, in the order sent. |
results[].index | number | Position of the mapping in the request, starting at 0. |
results[].pstnNumber | string | The pstnNumber as you sent it. |
results[].status | string | UPDATED, UNCHANGED or FAILED. |
results[].code | string | Only when FAILED: why (see Mapping Error Codes). |
results[].message | string | Only when FAILED: a readable reason. |
Mapping Error Codes
These come back inside results for a mapping that failed. The other mappings in the request are still saved.
| Code | Description |
|---|---|
INVALID_FIELDS | A number is missing or not 7 to 15 digits, or both agentNumber and aiAgentName were sent. The message names the field. |
DUPLICATE_PSTN_NUMBER | The same pstnNumber appears earlier in the request. Only the first mapping for a number is applied. |
PSTN_NUMBER_NOT_FOUND | The PSTN number is not connected in your organization. |
PSTN_NUMBER_AMBIGUOUS | The PSTN number is connected more than once in your organization. Contact support. |
WHATSAPP_NUMBER_NOT_FOUND | The WhatsApp number is not connected in your organization. |
WHATSAPP_NUMBER_AMBIGUOUS | The WhatsApp number is connected more than once in your organization. Contact support. |
AGENT_NOT_FOUND | No active team member of your organization has this agentNumber. |
AGENT_AMBIGUOUS | More than one team member has this agentNumber. Contact support. |
AGENT_NO_ACCESS | The team member does not have access to this PSTN number. Give them access to the PSTN channel, then send the mapping again. |
AI_AGENT_NOT_FOUND | No AI agent with this name is set up for voice calls in your organization. |
AI_AGENT_AMBIGUOUS | More than one AI agent has this name. Rename one and try again. |
AI_AGENT_CANNOT_TAKE_CALLS | This AI agent cannot answer incoming calls yet. Choose another AI agent or a team member, or contact support. |
AI_AGENT_NOT_SUPPORTED_ON_NUMBER | This PSTN number does not support AI agents. Route it to a team member instead. |
CHANGED_DURING_SAVE | The PSTN number was disconnected or removed while the request was running. Send the mapping again. |
Error Responses
| Status Code | Description |
|---|---|
| 400 | mappings is missing or empty, has more than 500 objects, an entry is not an object, an entry has a field the API does not know, or a field value is not a string. Nothing is saved. |
| 401 | Invalid or missing API key. |
| 403 | The API key's user does not have permission to add channels. |
| 429 | Rate limit exceeded — 10 requests/minute per org, check the Retry-After header. |
| 500 | The save failed and nothing was written. The same request can be sent again. |
Things to Know
- Up to 500 mappings per request. Split a longer list into several requests.
- Each mapping is checked on its own. A failed mapping does not stop the others, and nothing is written for a failed mapping.
- Sending the same request again is safe: mappings already in place come back
UNCHANGED, so you only need to fix and resend the failed ones. - If you send neither
agentNumbernoraiAgentName, the number's incoming call routing is kept as it is. This API never clears it. agentNumbermust match exactly one active member of your organization by phone number, and the member must have access to the PSTN number.aiAgentNamemust match the AI agent's name exactly.- Changes apply from the next incoming call. Nothing needs to be restarted.
- This endpoint only changes mappings. To place calls, use Initiate Agent Call or Initiate AI Bot Call.
Updated about 3 hours ago

