Credentials API

Credentials operations API

List all credentials

List all On-demand Credentials.

SecuritybearerAuth
Request
query Parameters
page[number]
integer >= 1
Default: 1

The page number to load

page[size]
integer [ 1 .. 250 ]
Default: 20

The size of the page

filter[tag]
string

Filter by tag

filter[name]
string

Filter by name

filter[status]
string

Filter by status

filter[resource_id]
string

Filter by resource_id

filter[sip_username]
string

Filter by sip_username

Responses
200

Successful response with multiple credentials

Response Schema: application/json
Array of objects (On-demand Credential)
object (PaginationMeta)
400

Bad request

401

Unauthorized

404

Resource not found

get/telephony_credentials
Request samples
import telnyx
telnyx.api_key = "YOUR_API_KEY"

telnyx.TelephonyCredential.list(page={"number":1,"size":20})
Response samples
application/json
{
  • "data": [
    • {
      • "created_at": "2020-06-18T21:32:38",
      • "expired": "false",
      • "expires_at": "2042-06-18T21:32:38",
      • "id": "c215ade3-0d39-418e-94be-c5f780760199",
      • "name": "2020-06-18 21:32:38.917732Z",
      • "record_type": "credential",
      • "resource_id": "connection:804252963366242252",
      • "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b",
      • "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX",
      • "updated_at": "2020-06-18T21:32:38.000Z",
      • "user_id": "user-id"
      }
    ],
  • "meta": {
    • "page_number": 2,
    • "page_size": 25,
    • "total_pages": 3,
    • "total_results": 55
    }
}

Create a credential

Create a credential.

SecuritybearerAuth
Request
Request Body schema: application/json
required

Parameters that can be defined during credential creation

connection_id
required
string

Identifies the Credential Connection this credential is associated with.

expires_at
string

ISO-8601 formatted date indicating when the credential will expire.

name
string
tag
string

Tags a credential to filter for bulk operations. A single tag can hold at maximum 1000 credentials.

Responses
201

Successful response with details about a credential

Response Schema: application/json
object (TelephonyCredential)
created_at
string

ISO-8601 formatted date indicating when the resource was created.

expired
boolean

Defaults to false

expires_at
string

ISO-8601 formatted date indicating when the resource will expire.

id
string <string>

Identifies the resource.

name
string
record_type
string

Identifies the type of the resource.

resource_id
string

Identifies the resource this credential is associated with.

sip_password
string

The randomly generated SIP password for the credential.

sip_username
string

The randomly generated SIP username for the credential.

updated_at
string

ISO-8601 formatted date indicating when the resource was updated.

422

Bad request

post/telephony_credentials
Request samples
application/json
{
  • "connection_id": "1234567890",
  • "name": "My-new-credential"
}
Response samples
application/json
{
  • "data": {
    • "created_at": "2020-06-18T21:32:38",
    • "expired": "false",
    • "expires_at": "2042-06-18T21:32:38",
    • "id": "c215ade3-0d39-418e-94be-c5f780760199",
    • "name": "2020-06-18 21:32:38.917732Z",
    • "record_type": "credential",
    • "resource_id": "connection:804252963366242252",
    • "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b",
    • "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX",
    • "updated_at": "2020-06-18T21:32:38.000Z",
    • "user_id": "user-id"
    }
}

List all tags

Returns a list of tags used on Credentials

SecuritybearerAuth
Request
query Parameters
page[number]
integer >= 1
Default: 1

The page number to load

page[size]
integer [ 1 .. 250 ]
Default: 20

The size of the page

Responses
200

Successful response with multiple tags

Response Schema: application/json
Array of objects
object (PaginationMeta)
400

Bad request

401

Unauthorized

404

Resource not found

get/telephony_credentials/tags
Request samples
Response samples
application/json
{
  • "data": [
    • {
      • "amount": 1,
      • "tag": "a_tag"
      }
    ],
  • "meta": {
    • "page_number": 2,
    • "page_size": 25,
    • "total_pages": 3,
    • "total_results": 55
    }
}

Delete a credential

Delete an existing credential.

SecuritybearerAuth
Request
path Parameters
id
required
string

Identifies the resource.

Responses
200

Successful response with details about a credential

Response Schema: application/json
object (TelephonyCredential)
created_at
string

ISO-8601 formatted date indicating when the resource was created.

expired
boolean

Defaults to false

expires_at
string

ISO-8601 formatted date indicating when the resource will expire.

id
string <string>

Identifies the resource.

name
string
record_type
string

Identifies the type of the resource.

resource_id
string

Identifies the resource this credential is associated with.

sip_password
string

The randomly generated SIP password for the credential.

sip_username
string

The randomly generated SIP username for the credential.

updated_at
string

ISO-8601 formatted date indicating when the resource was updated.

401

Unauthorized

404

Resource not found

422

Bad request

delete/telephony_credentials/{id}
Request samples
import telnyx
telnyx.api_key = "YOUR_API_KEY"

res=telnyx.TelephonyCredential.retrieve("ID")
res.delete()
Response samples
application/json
{
  • "data": {
    • "created_at": "2020-06-18T21:32:38",
    • "expired": "false",
    • "expires_at": "2042-06-18T21:32:38",
    • "id": "c215ade3-0d39-418e-94be-c5f780760199",
    • "name": "2020-06-18 21:32:38.917732Z",
    • "record_type": "credential",
    • "resource_id": "connection:804252963366242252",
    • "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b",
    • "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX",
    • "updated_at": "2020-06-18T21:32:38.000Z",
    • "user_id": "user-id"
    }
}

Get a credential

Get the details of an existing On-demand Credential.

SecuritybearerAuth
Request
path Parameters
id
required
string

Identifies the resource.

Responses
200

Successful response with details about a credential

Response Schema: application/json
object (TelephonyCredential)
created_at
string

ISO-8601 formatted date indicating when the resource was created.

expired
boolean

Defaults to false

expires_at
string

ISO-8601 formatted date indicating when the resource will expire.

id
string <string>

Identifies the resource.

name
string
record_type
string

Identifies the type of the resource.

resource_id
string

Identifies the resource this credential is associated with.

sip_password
string

The randomly generated SIP password for the credential.

sip_username
string

The randomly generated SIP username for the credential.

updated_at
string

ISO-8601 formatted date indicating when the resource was updated.

400

Bad request

401

Unauthorized

404

Resource not found

get/telephony_credentials/{id}
Request samples
import telnyx
telnyx.api_key = "YOUR_API_KEY"

telnyx.TelephonyCredential.retrieve("ID")
Response samples
application/json
{
  • "data": {
    • "created_at": "2020-06-18T21:32:38",
    • "expired": "false",
    • "expires_at": "2042-06-18T21:32:38",
    • "id": "c215ade3-0d39-418e-94be-c5f780760199",
    • "name": "2020-06-18 21:32:38.917732Z",
    • "record_type": "credential",
    • "resource_id": "connection:804252963366242252",
    • "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b",
    • "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX",
    • "updated_at": "2020-06-18T21:32:38.000Z",
    • "user_id": "user-id"
    }
}

Update a credential

Update an existing credential.

SecuritybearerAuth
Request
path Parameters
id
required
string

Identifies the resource.

Request Body schema: application/json
required

Parameters that can be updated in a credential

connection_id
string

Identifies the Credential Connection this credential is associated with.

expires_at
string

ISO-8601 formatted date indicating when the credential will expire.

name
string
tag
string

Tags a credential to filter for bulk operations. A single tag can hold at maximum 1000 credentials.

Responses
200

Successful response with details about a credential

Response Schema: application/json
object (TelephonyCredential)
created_at
string

ISO-8601 formatted date indicating when the resource was created.

expired
boolean

Defaults to false

expires_at
string

ISO-8601 formatted date indicating when the resource will expire.

id
string <string>

Identifies the resource.

name
string
record_type
string

Identifies the type of the resource.

resource_id
string

Identifies the resource this credential is associated with.

sip_password
string

The randomly generated SIP password for the credential.

sip_username
string

The randomly generated SIP username for the credential.

updated_at
string

ISO-8601 formatted date indicating when the resource was updated.

401

Unauthorized

404

Resource not found

422

Bad request

patch/telephony_credentials/{id}
Request samples
application/json
{
  • "connection_id": "987654321",
  • "name": "My-new-updated-credential"
}
Response samples
application/json
{
  • "data": {
    • "created_at": "2020-06-18T21:32:38",
    • "expired": "false",
    • "expires_at": "2042-06-18T21:32:38",
    • "id": "c215ade3-0d39-418e-94be-c5f780760199",
    • "name": "2020-06-18 21:32:38.917732Z",
    • "record_type": "credential",
    • "resource_id": "connection:804252963366242252",
    • "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b",
    • "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX",
    • "updated_at": "2020-06-18T21:32:38.000Z",
    • "user_id": "user-id"
    }
}

Perform activate or deactivate action on provided Credential

Perform activate or deactivate action on provided Credential. Activate action will change the status to active, making it possible to connect calls with the credential. Deactivate action will change the status to inactive, making it impossible to connect calls with the credential.

SecuritybearerAuth
Request
path Parameters
id
required
string

Identifies the resource.

action
required
string

Identifies the action to be taken.

Enum: "activate" "deactivate"
Responses
200

Successful response with details about a credential

Response Schema: application/json
object (TelephonyCredential)
created_at
string

ISO-8601 formatted date indicating when the resource was created.

expired
boolean

Defaults to false

expires_at
string

ISO-8601 formatted date indicating when the resource will expire.

id
string <string>

Identifies the resource.

name
string
record_type
string

Identifies the type of the resource.

resource_id
string

Identifies the resource this credential is associated with.

sip_password
string

The randomly generated SIP password for the credential.

sip_username
string

The randomly generated SIP username for the credential.

updated_at
string

ISO-8601 formatted date indicating when the resource was updated.

400

Bad request

401

Unauthorized

404

Resource not found

post/telephony_credentials/{id}/actions/{action}
Request samples
Response samples
application/json
{
  • "data": {
    • "created_at": "2020-06-18T21:32:38",
    • "expired": "false",
    • "expires_at": "2042-06-18T21:32:38",
    • "id": "c215ade3-0d39-418e-94be-c5f780760199",
    • "name": "2020-06-18 21:32:38.917732Z",
    • "record_type": "credential",
    • "resource_id": "connection:804252963366242252",
    • "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b",
    • "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX",
    • "updated_at": "2020-06-18T21:32:38.000Z",
    • "user_id": "user-id"
    }
}