Skip to contentSkip to navigationSkip to topbar
On this page

CredentialPublicKey Resource



Resource URI

resource-uri page anchor
/Credentials/PublicKeys/

Property nameTypeRequiredDescriptionChild properties
sidSID<CR>Optional
Not PII

The unique string that that we created to identify the PublicKey resource.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>Optional

The SID of the Account that created the Credential that the PublicKey resource belongs to.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

friendly_namestringOptional
PII MTL: 0 days

The string that you assigned to describe the resource.


date_updatedstring<date-time>Optional

The date and time in GMT when the resource was last updated specified in RFC 2822(link takes you to an external page) format.


urlstring<uri>Optional

The URI for this resource, relative to https://accounts.twilio.com


Create a CredentialPublicKey resource

create-a-credentialpublickey-resource page anchor
POST https://accounts.twilio.com/v1/Credentials/PublicKeys

Request body parameters

request-body-parameters page anchor
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
PublicKeystringrequired

A URL encoded representation of the public key. For example, -----BEGIN PUBLIC KEY-----MIIBIjANB.pa9xQIDAQAB-----END PUBLIC KEY-----


FriendlyNamestringOptional

A descriptive string that you create to describe the resource. It can be up to 64 characters long.


AccountSidSID<AC>Optional

The SID of the Subaccount that this Credential should be associated with. Must be a valid Subaccount of the account issuing the request

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34
Create a Public KeyLink to code sample: Create a Public Key
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createCredentialPublicKey() {
11
const publicKey = await client.accounts.v1.credentials.publicKey.create({
12
publicKey: "PublicKey",
13
});
14
15
console.log(publicKey.sid);
16
}
17
18
createCredentialPublicKey();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-31T04:00:00Z",
4
"date_updated": "2015-07-31T04:00:00Z",
5
"friendly_name": "friendly_name",
6
"sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"url": "https://accounts.twilio.com/v1/Credentials/PublicKeys/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
8
}

Fetch a CredentialPublicKey resource

fetch-a-credentialpublickey-resource page anchor
GET https://accounts.twilio.com/v1/Credentials/PublicKeys/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<CR>required

The Twilio-provided string that uniquely identifies the PublicKey resource to fetch.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchCredentialPublicKey() {
11
const publicKey = await client.accounts.v1.credentials
12
.publicKey("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.fetch();
14
15
console.log(publicKey.sid);
16
}
17
18
fetchCredentialPublicKey();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-31T04:00:00Z",
4
"date_updated": "2015-07-31T04:00:00Z",
5
"friendly_name": "friendly_name",
6
"sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"url": "https://accounts.twilio.com/v1/Credentials/PublicKeys/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
8
}

Read multiple CredentialPublicKey resources

read-multiple-credentialpublickey-resources page anchor
GET https://accounts.twilio.com/v1/Credentials/PublicKeys

Property nameTypeRequiredPIIDescription
PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listCredentialPublicKey() {
11
const publicKeys = await client.accounts.v1.credentials.publicKey.list({
12
limit: 20,
13
});
14
15
publicKeys.forEach((p) => console.log(p.sid));
16
}
17
18
listCredentialPublicKey();

Output

1
{
2
"credentials": [],
3
"meta": {
4
"first_page_url": "https://accounts.twilio.com/v1/Credentials/PublicKeys?PageSize=50&Page=0",
5
"key": "credentials",
6
"next_page_url": null,
7
"page": 0,
8
"page_size": 50,
9
"previous_page_url": null,
10
"url": "https://accounts.twilio.com/v1/Credentials/PublicKeys?PageSize=50&Page=0"
11
}
12
}

Update a CredentialPublicKey resource

update-a-credentialpublickey-resource page anchor
POST https://accounts.twilio.com/v1/Credentials/PublicKeys/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<CR>required

The Twilio-provided string that uniquely identifies the PublicKey resource to update.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
FriendlyNamestringOptional

A descriptive string that you create to describe the resource. It can be up to 64 characters long.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateCredentialPublicKey() {
11
const publicKey = await client.accounts.v1.credentials
12
.publicKey("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.update({ friendlyName: "FriendlyName" });
14
15
console.log(publicKey.sid);
16
}
17
18
updateCredentialPublicKey();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2015-07-31T04:00:00Z",
4
"date_updated": "2015-07-31T04:00:00Z",
5
"friendly_name": "FriendlyName",
6
"sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"url": "https://accounts.twilio.com/v1/Credentials/PublicKeys/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
8
}

Delete a CredentialPublicKey resource

delete-a-credentialpublickey-resource page anchor
DELETE https://accounts.twilio.com/v1/Credentials/PublicKeys/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<CR>required

The Twilio-provided string that uniquely identifies the PublicKey resource to delete.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteCredentialPublicKey() {
11
await client.accounts.v1.credentials
12
.publicKey("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.remove();
14
}
15
16
deleteCredentialPublicKey();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.