Skip to content
Start here

Temporary Credentials

Create Temporary Access Credentials
client.r2.temporaryCredentials.create(TemporaryCredentialCreateParams { account_id, bucket, parentAccessKeyId, 4 more } params, RequestOptionsoptions?): TemporaryCredentialCreateResponse { accessKeyId, secretAccessKey, sessionToken }
POST/accounts/{account_id}/r2/temp-access-credentials
ModelsExpand Collapse
TemporaryCredential { bucket, parentAccessKeyId, permission, 3 more }
bucket: string

Name of the R2 bucket.

parentAccessKeyId: string

The parent access key id to use for signing.

permission: "admin-read-write" | "admin-read-only" | "object-read-write" | "object-read-only"

Permissions allowed on the credentials.

One of the following:
"admin-read-write"
"admin-read-only"
"object-read-write"
"object-read-only"
ttlSeconds: number

How long the credentials will live for in seconds.

maximum604800
objects?: Array<string>

Optional object paths to scope the credentials to.

prefixes?: Array<string>

Optional prefix paths to scope the credentials to.

TemporaryCredentialCreateResponse { accessKeyId, secretAccessKey, sessionToken }
accessKeyId?: string

ID for new access key.

secretAccessKey?: string

Secret access key.

sessionToken?: string

Security token.