NAME

Twilio::Rest::Iam::V1::NewApiKey - The NewApiKey resource

SYNOPSIS

my $client = Twilio::Rest::Client->new($account_sid, $auth_token);

my $new_api_key = $client->iam->v1->new_api_key->create($account_sid, \%options);

DESCRIPTION

API keys

This file holds NewApiKeyList and NewApiKeyInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

NewApiKeyList

Returned by $client->iam->v1->new_api_key. See also Twilio::ListResource.

create

my $new_api_key = $client->iam->v1->new_api_key->create($account_sid, \%options);

Create a new Signing Key for the account making the request. Returns a NewApiKeyInstance.

The required values are:

$account_sid

The SID of the Account that created the Payments resource.

The options are:

friendly_name

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

key_type

The \KeyType\ form parameter is used to specify the type of key you want to create. Default Behavior: If \KeyType\ is not specified, the API will generate a standard key. Restricted Key: If \KeyType\ is set to \restricted\, the API will create a new restricted key. In this case, a policy object is required to define the permissions.

policy

The \Policy\ object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the Twilio documentation. A hash or array reference, or a string of JSON.

NewApiKeyInstance

See also Twilio::InstanceResource.

Its fields are:

date_created

The date and time in GMT that the API Key was created specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT that the new API Key was last updated specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

friendly_name

The string that you assigned to describe the resource.

policy

Collection of allow assertions.

secret

The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth password). Note that for security reasons, this field is ONLY returned when the API Key is first created.

sid

The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth user when authenticating to the API.

CONSTRUCTORS

new

Objects here come from the methods above, so there is no need to call new directly.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.