import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const telephonyCredential = await client.telephonyCredentials.create({ connection_id: '1234567890' });
console.log(telephonyCredential.data);{
"data": {
"id": "c215ade3-0d39-418e-94be-c5f780760199",
"record_type": "credential",
"name": "2020-06-18 21:32:38.917732Z",
"expired": "false",
"user_id": "user-id",
"resource_id": "connection:804252963366242252",
"sip_password": "a92dbcfb60184a8cb330b0acb2f7617b",
"sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX",
"created_at": "2020-06-18T21:32:38",
"expires_at": "2042-06-18T21:32:38",
"updated_at": "2020-06-18T21:32:38.000Z"
}
}Create a credential.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const telephonyCredential = await client.telephonyCredentials.create({ connection_id: '1234567890' });
console.log(telephonyCredential.data);{
"data": {
"id": "c215ade3-0d39-418e-94be-c5f780760199",
"record_type": "credential",
"name": "2020-06-18 21:32:38.917732Z",
"expired": "false",
"user_id": "user-id",
"resource_id": "connection:804252963366242252",
"sip_password": "a92dbcfb60184a8cb330b0acb2f7617b",
"sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX",
"created_at": "2020-06-18T21:32:38",
"expires_at": "2042-06-18T21:32:38",
"updated_at": "2020-06-18T21:32:38.000Z"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Parameters that can be defined during credential creation
Identifies the Credential Connection this credential is associated with.
"1234567890"
Tags a credential. A single tag can hold at maximum 1000 credentials.
"some_tag"
ISO-8601 formatted date indicating when the credential will expire.
"2018-02-02T22:25:27.521Z"
Successful response with details about a credential
Show child attributes
Identifies the resource.
"c215ade3-0d39-418e-94be-c5f780760199"
Identifies the type of the resource.
"credential"
Identifies the resource this credential is associated with.
"connection:1234567890"
Defaults to false
The randomly generated SIP username for the credential.
"gencrednCvHU5IYpSBPPsXI2iQsDX"
The randomly generated SIP password for the credential.
"a92dbcfb60184a8cb330b0acb2f7617b"
ISO-8601 formatted date indicating when the resource was created.
"2018-02-02T22:25:27.521Z"
ISO-8601 formatted date indicating when the resource was updated.
"2018-02-02T22:25:27.521Z"
ISO-8601 formatted date indicating when the resource will expire.
"2018-02-02T22:25:27.521Z"
{
"id": "c215ade3-0d39-418e-94be-c5f780760199",
"record_type": "credential",
"name": "2020-06-18 21:32:38.917732Z",
"expired": "false",
"user_id": "user-id",
"resource_id": "connection:804252963366242252",
"sip_password": "a92dbcfb60184a8cb330b0acb2f7617b",
"sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX",
"created_at": "2020-06-18T21:32:38",
"expires_at": "2042-06-18T21:32:38",
"updated_at": "2020-06-18T21:32:38.000Z"
}Was this page helpful?