---
title: Temporary Credentials
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

[R2](https://developers.cloudflare.com/api/python/resources/r2)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Temporary Credentials

##### [Create Temporary Access Credentials](https://developers.cloudflare.com/api/python/resources/r2/subresources/temporary_credentials/methods/create)

r2.temporary\_credentials.create(TemporaryCredentialCreateParams\*\*kwargs) -> [TemporaryCredentialCreateResponse](<https://developers.cloudflare.com/api/python/resources/r2#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential_create_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/r2/temp-access-credentials

##### ModelsExpand Collapse

<details>

<summary>

class TemporaryCredential: …

</summary>

bucket: str

Name of the R2 bucket.

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20bucket">Link to this property</a>

parent\_access\_key\_id: str

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

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20parentAccessKeyId">Link to this property</a>

<details>

<summary>

permission: Literal\["admin-read-write", "admin-read-only", "object-read-write", "object-read-only"]

Permissions allowed on the credentials.

</summary>

One of the following:

"admin-read-write"

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20permission%20%3E%20(member)%200">Link to this property</a>

"admin-read-only"

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20permission%20%3E%20(member)%201">Link to this property</a>

"object-read-write"

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20permission%20%3E%20(member)%202">Link to this property</a>

"object-read-only"

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20permission%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20permission">Link to this property</a>

ttl\_seconds: float

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

maximum604800

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20ttlSeconds">Link to this property</a>

objects: Optional\[List\[str]]

Optional object paths to scope the credentials to.

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20objects">Link to this property</a>

prefixes: Optional\[List\[str]]

Optional prefix paths to scope the credentials to.

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)%20%3E%20(property)%20prefixes">Link to this property</a>

</details>

[Link to this property](<#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential%20%3E%20(schema)>)

<details>

<summary>

class TemporaryCredentialCreateResponse: …

</summary>

access\_key\_id: Optional\[str]

ID for new access key.

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential_create_response%20%3E%20(schema)%20%3E%20(property)%20accessKeyId">Link to this property</a>

secret\_access\_key: Optional\[str]

Secret access key.

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential_create_response%20%3E%20(schema)%20%3E%20(property)%20secretAccessKey">Link to this property</a>

session\_token: Optional\[str]

Security token.

<a href="#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential_create_response%20%3E%20(schema)%20%3E%20(property)%20sessionToken">Link to this property</a>

</details>

[Link to this property](<#(resource)%20r2.temporary_credentials%20%3E%20(model)%20temporary_credential_create_response%20%3E%20(schema)>)