Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

CredentialPublicKey Resource



Resource URI


_10
/Credentials/PublicKeys/


CredentialPublicKey Properties

Property nameTypePIIDescription
sidSID<CR>
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>

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_namestring
PII MTL: 0 days

The string that you assigned to describe the resource.


date_createdstring<date-time>

date_updatedstring<date-time>

The date and time in GMT when the resource was last updated specified in RFC 2822 format.


urlstring<uri>

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


Create a CredentialPublicKey resource

POST https://accounts.twilio.com/v1/Credentials/PublicKeys

Request body parameters

Property nameTypeRequiredPIIDescription
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 Key

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function createCredentialPublicKey() {
_18
const publicKey = await client.accounts.v1.credentials.publicKey.create({
_18
publicKey: "PublicKey",
_18
});
_18
_18
console.log(publicKey.sid);
_18
}
_18
_18
createCredentialPublicKey();

Output

_10
{
_10
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"date_created": "2015-07-31T04:00:00Z",
_10
"date_updated": "2015-07-31T04:00:00Z",
_10
"friendly_name": "friendly_name",
_10
"sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"url": "https://accounts.twilio.com/v1/Credentials/PublicKeys/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_10
}


Fetch a CredentialPublicKey resource

GET https://accounts.twilio.com/v1/Credentials/PublicKeys/{Sid}

Path parameters

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

Fetch a Public Key

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchCredentialPublicKey() {
_18
const publicKey = await client.accounts.v1.credentials
_18
.publicKey("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.fetch();
_18
_18
console.log(publicKey.sid);
_18
}
_18
_18
fetchCredentialPublicKey();

Output

_10
{
_10
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"date_created": "2015-07-31T04:00:00Z",
_10
"date_updated": "2015-07-31T04:00:00Z",
_10
"friendly_name": "friendly_name",
_10
"sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"url": "https://accounts.twilio.com/v1/Credentials/PublicKeys/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_10
}


Read multiple CredentialPublicKey resources

GET https://accounts.twilio.com/v1/Credentials/PublicKeys

Query parameters

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.

Read Public Keys

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function listCredentialPublicKey() {
_18
const publicKeys = await client.accounts.v1.credentials.publicKey.list({
_18
limit: 20,
_18
});
_18
_18
publicKeys.forEach((p) => console.log(p.sid));
_18
}
_18
_18
listCredentialPublicKey();

Output

_12
{
_12
"credentials": [],
_12
"meta": {
_12
"first_page_url": "https://accounts.twilio.com/v1/Credentials/PublicKeys?PageSize=50&Page=0",
_12
"key": "credentials",
_12
"next_page_url": null,
_12
"page": 0,
_12
"page_size": 50,
_12
"previous_page_url": null,
_12
"url": "https://accounts.twilio.com/v1/Credentials/PublicKeys?PageSize=50&Page=0"
_12
}
_12
}


Update a CredentialPublicKey resource

POST https://accounts.twilio.com/v1/Credentials/PublicKeys/{Sid}

Path parameters

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

Request body parameters

Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

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

Update a Public Key

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function updateCredentialPublicKey() {
_18
const publicKey = await client.accounts.v1.credentials
_18
.publicKey("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.update({ friendlyName: "FriendlyName" });
_18
_18
console.log(publicKey.sid);
_18
}
_18
_18
updateCredentialPublicKey();

Output

_10
{
_10
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"date_created": "2015-07-31T04:00:00Z",
_10
"date_updated": "2015-07-31T04:00:00Z",
_10
"friendly_name": "FriendlyName",
_10
"sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"url": "https://accounts.twilio.com/v1/Credentials/PublicKeys/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_10
}


Delete a CredentialPublicKey resource

DELETE https://accounts.twilio.com/v1/Credentials/PublicKeys/{Sid}

Path parameters

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

Delete a Public Key

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function deleteCredentialPublicKey() {
_16
await client.accounts.v1.credentials
_16
.publicKey("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_16
.remove();
_16
}
_16
_16
deleteCredentialPublicKey();


Rate this page: