pydo.functions_access_key.create()

Generated on 3 Aug 2026 from pydo version v0.40.0

Usage

client.functions_access_key.create(
    namespace_id="fn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    body={
        "name": "my-function-access-key",
        "expires_in": "7d",
    },
)
Returns JSONRaises HttpResponseError

Description

Creates a new access key for a serverless functions namespace. The access key can be used to authenticate requests to the namespace’s functions. The secret key is only returned once upon creation.

To create an access key, send a POST request to /v2/functions/namespaces/{namespace_id}/keys.

Parameters

namespace_id string required

The ID of the namespace to be managed.

name string required

Example: my-function-access-key

The access key's name.

expires_in string optional

Example: 7d

The duration after which the access key expires, specified as a human-readable duration string in the format <int>h (hours) or <int>d (days). Minimum value is 1h. If omitted, the key will never expire.

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "name": "my-function-access-key"
}

resp = client.functions_access_key.create(namespace_id="fn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", body=req)

Response Example

Show Response Example
{
  "access_key": {
    "id": "dof_v1-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "name": "my-function-access-key",
    "secret": "DOSECRETKEYEXAMPLE",
    "expires_at": "2026-12-19T10:30:00Z",
    "created_at": "2025-12-19T10:30:00Z",
    "updated_at": "2025-12-19T10:30:00Z"
  }
}

More Information

See /v2/functions/namespaces/{namespace_id}/keys in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.