---
title: pydo.spaces_key.update()
description: Update Spaces Access Keys
product: Reference
url: https://docs.digitalocean.com/reference/pydo/reference/spaces_key/update/
last_updated: "2026-08-03"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# pydo.spaces_key.update()

Generated on 3 Aug 2026 from `pydo` version [`v0.40.0`](https://github.com/digitalocean/pydo/releases/tag/v0.40.0v0.40.0)

## Usage

```python
client.spaces_key.update(
    access_key="DOACCESSKEYEXAMPLE",
    body={
        "name": "my-access-key",
        "grants": [...],
    },
)
```

Returns `JSON`Raises `HttpResponseError`

## Description

To update Spaces Access Key, send a PUT or PATCH request to [`/v2/spaces/keys/{access_key}`](https://docs.digitalocean.com/reference/api/reference/spaces-keys/index.html.md#spacesKey_patch). At the moment, you cannot convert a fullaccess key to a scoped key or vice versa. You can only update the name of the key.

## Parameters

`access_key` string required

The access key's ID.

`name` string optional

Example: `my-access-key`

The access key's name.

`grants` array of objects optional

The list of permissions for the access key.

Default: `[]`

## Show child properties

`bucket` string required

Example: `my-bucket`

The name of the bucket.

`permission` string required

Example: `read`

The permission to grant to the user. Possible values are `read`, `readwrite`, `fullaccess`, or an empty string.

`access_key` string optional read-only

Example: `DOACCESSKEYEXAMPLE`

The Access Key ID used to access a bucket.

`created_at` string optional read-only

Example: `2018-07-19T15:04:16Z`

The date and time the key was created.

## Request Sample

## Show Request Sample

```python
import os
from pydo import Client

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

req = {
  "name": "new-key-name"
}

resp = client.spaces_key.update(access_key="DOACCESSKEYEXAMPLE", body=req)
```

## Response Example

## Show Response Example

```json
{
  "key": {
    "name": "new-key-name",
    "access_key": "DOACCESSKEYEXAMPLE",
    "grants": [
      {
        "bucket": "my-bucket",
        "permission": "read"
      }
    ],
    "created_at": "2018-07-19T15:04:16Z"
  }
}
```

## More Information

See [`/v2/spaces/keys/{access_key}`](https://docs.digitalocean.com/reference/api/reference/spaces-keys/index.html.md#spacesKey_update) in the API reference for additional detail on responses, headers, parameters, and more.