---
title: Create credentials (digest auth) API for a Trunk
slug: dynamic-sip-trunking/create-credentials-digest-auth-api-for-a-trunk
createdAt: 2026-08-10T10:42:40.036Z
---



### 1. Create credentials (SIP digest)

Creates a **username/password** pair for **SIP Digest authentication** on the trunk. Configure the same values on your Voice AI platform’s SIP trunk settings.

**HTTP Request**

:::BlockQuote
`POST https://<API_KEY>:<API_TOKEN>@<SUBDOMAIN>/v2/accounts/<ACCOUNT_SID>/trunks/<TRUNK_SID>/credentials`
:::

**Request Headers**

| Header       | Value            |
| ------------ | ---------------- |
| Content-Type | application/json |

**Request Parameters**

The following parameters are sent as JSON in the body of the request:

| Parameter Name | Mandatory/Optional | Value                                                                                                        |
| -------------- | ------------------ | ------------------------------------------------------------------------------------------------------------ |
| user\_name     | Mandatory          | String; SIP digest username. Example: voice\_ai\_user                                                        |
| password       | Mandatory          | String; SIP digest password. Use a strong secret.                                                            |
| friendly\_name | Optional           | String; Label to identify where the creds are used (max 32 chars). Example: elevenlabs-prod, livekit-staging |

**Example Request**

:::BlockQuote
curl -s -X POST "https\://\<API\_KEY>:\<API\_TOKEN>@\<SUBDOMAIN>/v2/accounts/\<ACCOUNT\_SID>/trunks/\<TRUNK\_SID>/credentials" \\
&#x20; -H "Content-Type: application/json" \\
&#x20; -d '\{
&#x20;   "user\_name": "voice\_ai\_user",
&#x20;   "password": "REPLACE\_WITH\_STRONG\_PASSWORD",
&#x20;   "friendly\_name": "voice\_ai\_platform"
&#x20; }'
:::

**HTTP Response**

On success, the HTTP response status code will be **200 OK**.

**Example Response**

:::BlockQuote
\{
&#x20; "request\_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
&#x20; "method": "POST",
&#x20; "http\_code": 200,
&#x20; "response": \{
&#x20;   "code": 200,
&#x20;   "error\_data": null,
&#x20;   "status": "success",
&#x20;   "data": \{
&#x20;     "id": "1234",
&#x20;     "trunk\_sid": "trmum17d8e9a37a3732ecbf91a3u",
&#x20;     "user\_name": "voice\_ai\_user",
&#x20;     "friendly\_name": "voice\_ai\_platform",
&#x20;     "date\_created": "2026-01-23T11:37:36Z",
&#x20;     "date\_updated": "2026-01-23T11:37:36Z"
&#x20;   }
&#x20; }
}
:::

**Response Parameters**

| Parameter Name | Type & Value                                                       |
| -------------- | ------------------------------------------------------------------ |
| request\_id    | String; Unique identifier for this API request                     |
| method         | String; HTTP method used (POST)                                    |
| http\_code     | Integer; HTTP status code (200 for success)                        |
| id             | String; Unique identifier for this credential entry. Example: 1234 |
| trunk\_sid     | String; The trunk these credentials are associated with            |
| user\_name     | String; The SIP digest username you set                            |
| friendly\_name | String or null; Optional label                                     |
| date\_created  | String; ISO 8601 timestamp when credentials were created           |
| date\_updated  | String; ISO 8601 timestamp when credentials were last updated      |

### 2. List credentials (verify)

Lists credentials configured for the trunk.

**HTTP Request**

:::BlockQuote
`GET https://<API_KEY>:<API_TOKEN>@<SUBDOMAIN>/v2/accounts/<ACCOUNT_SID>/trunks/<TRUNK_SID>/credentials`
:::

**Example Request**

:::BlockQuote
curl -s "https\://\<API\_KEY>:\<API\_TOKEN>@\<SUBDOMAIN>/v2/accounts/\<ACCOUNT\_SID>/trunks/\<TRUNK\_SID>/credentials"
:::

**HTTP Response**

On success, the HTTP response status code will be **200 OK**.

**Example Response**

:::BlockQuote
\{
&#x20; "request\_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
&#x20; "method": "GET",
&#x20; "http\_code": 200,
&#x20; "metadata": \{
&#x20;   "total": 1,
&#x20;   "page\_size": 50,
&#x20;   "page": 1,
&#x20;   "first\_page\_uri": "/v2/accounts/exotelveenotesting1m/trunks/trmum17d8e9a37a3732ecbf91a3u/credentials?page\_size=50\&offset=0",
&#x20;   "prev\_page\_uri": null,
&#x20;   "next\_page\_uri": null
&#x20; },
&#x20; "response": \[
&#x20;   \{
&#x20;     "code": 200,
&#x20;     "error\_data": null,
&#x20;     "status": "success",
&#x20;     "data": \{
&#x20;       "id": "1234",
&#x20;       "trunk\_sid": "trmum17d8e9a37a3732ecbf91a3u",
&#x20;       "user\_name": "voice\_ai\_user",
&#x20;       "friendly\_name": "voice\_ai\_platform",
&#x20;       "date\_created": "2026-01-23T11:37:36Z",
&#x20;       "date\_updated": "2026-01-23T11:37:36Z"
&#x20;     }
&#x20;   }
&#x20; ]
}
:::

**Response Parameters**

| Parameter Name                  | Type & Value                                            |
| ------------------------------- | ------------------------------------------------------- |
| request\_id                     | String; Unique identifier for this API request          |
| method                          | String; HTTP method used (GET)                          |
| http\_code                      | Integer; HTTP status code (200 for success)             |
| metadata.total                  | Integer; Total credential records available             |
| metadata.page\_size             | Integer; Page size applied                              |
| metadata.page                   | Integer; Page number (if present)                       |
| metadata.first\_page\_uri       | String; URI for first page                              |
| metadata.prev\_page\_uri        | String or null; URI for previous page                   |
| metadata.next\_page\_uri        | String or null; URI for next page                       |
| response                        | Array; List of credential objects                       |
| response\[].data.id             | String; Unique identifier for the credential entry      |
| response\[].data.trunk\_sid     | String; The trunk these credentials are associated with |
| response\[].data.user\_name     | String; SIP digest username                             |
| response\[].data.friendly\_name | String or null; Optional label                          |
| response\[].data.date\_created  | String; ISO 8601 timestamp when created                 |
| response\[].data.date\_updated  | String; ISO 8601 timestamp when updated                 |

### 3. Delete credentials (rotate / revoke)

Deletes a credential entry when rotating credentials or removing access for a provider environment.

**HTTP Request**

:::BlockQuote
`DELETE https://<API_KEY>:<API_TOKEN>@<SUBDOMAIN>/v2/accounts/<ACCOUNT_SID>/trunks/<TRUNK_SID>/credentials?id=<CREDENTIAL_ID>`
:::

**Important:** credential id is passed as **query param** id (not /credentials/\<CREDENTIAL\_ID>).

**Example Request**

:::BlockQuote
curl -s -X DELETE "https\://\<API\_KEY>:\<API\_TOKEN>@\<SUBDOMAIN>/v2/accounts/\<ACCOUNT\_SID>/trunks/\<TRUNK\_SID>/credentials?id=\<CREDENTIAL\_ID>"
:::

**HTTP Response**

On success, the HTTP response status code will be **200 OK**.

**Example Response**

:::BlockQuote
\{
&#x20; "request\_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
&#x20; "method": "DELETE",
&#x20; "http\_code": 200,
&#x20; "response": \{
&#x20;   "code": 200,
&#x20;   "error\_data": null,
&#x20;   "status": "success",
&#x20;   "data": \{
&#x20;     "id": "1234",
&#x20;     "trunk\_sid": "trmum17d8e9a37a3732ecbf91a3u",
&#x20;     "user\_name": "voice\_ai\_user",
&#x20;     "friendly\_name": "voice\_ai\_platform",
&#x20;     "date\_created": "2026-01-23T11:37:36Z",
&#x20;     "date\_updated": "2026-01-23T11:37:36Z"
&#x20;   }
&#x20; }
}
:::

**Response Parameters**

| Parameter Name | Type & Value                                                      |
| -------------- | ----------------------------------------------------------------- |
| request\_id    | String; Unique identifier for this API request                    |
| method         | String; HTTP method used (DELETE)                                 |
| http\_code     | Integer; HTTP status code (200 for success)                       |
| id             | String; Deleted credential identifier                             |
| trunk\_sid     | String; Trunk SID this credential belonged to                     |
| user\_name     | String; SIP digest username that was deleted                      |
| friendly\_name | String or null; Optional label                                    |
| date\_created  | String; ISO 8601 timestamp when credential was originally created |
| date\_updated  | String; ISO 8601 timestamp when credential was last updated       |

