Skip to content
Start here

Temporary Credentials

Create Temporary Access Credentials
POST/accounts/{account_id}/r2/temp-access-credentials
ModelsExpand Collapse
TemporaryCredential object { bucket, parentAccessKeyId, permission, 3 more }
bucket: string

Name of the R2 bucket.

parentAccessKeyId: string

Access key ID of the parent R2 API token. The temporary credentials cannot exceed this token’s permissions.

permission: "admin-read-write" or "admin-read-only" or "object-read-write" or "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

Lifetime of the temporary credentials in seconds, up to 604800 seconds (7 days).

maximum604800
objects: optional array of string

Optional object paths to scope the credentials to.

prefixes: optional array of string

Optional prefix paths to scope the credentials to.

TemporaryCredentialCreateResponse object { accessKeyId, secretAccessKey, sessionToken }
accessKeyId: optional string

ID for new access key.

secretAccessKey: optional string

Secret access key.

sessionToken: optional string

Security token.