---
title: "Create a New Spaces Access Key"
method: POST
path: "/v2/spaces/keys"
tags: ["DigitalOcean-public.v2-new_Spaces Keys"]
---

# Create a New Spaces Access Key

`POST /v2/spaces/keys`

To create a new Spaces Access Key, send a POST request to `/v2/spaces/keys`.
At the moment, you cannot mix a fullaccess permission with scoped permissions.
A fullaccess permission will be prioritized if fullaccess and scoped permissions are both added.

## Request body

- Key
  - `name` string — The access key's name.
  - `grants` Grant[] — The list of permissions for the access key.
    - `bucket` string, required — The name of the bucket.
    - `permission` string, required — The permission to grant to the user. Possible values are `read`, `readwrite`, `fullaccess`, or an empty string.
  - `access_key` string — The Access Key ID used to access a bucket.
  - `created_at` string, date-time — The date and time the key was created.

## Response `201`

A JSON response containing details about the new key.

- object
  - `key` KeyCreateResponse
    - `secret_key` string — The secret key used to access the bucket. We return secret keys only once upon creation. Make sure to copy the key and securely store it.
    - `name` string — The access key's name.
    - `grants` Grant[] — The list of permissions for the access key.
      - `bucket` string, required — The name of the bucket.
      - `permission` string, required — The permission to grant to the user. Possible values are `read`, `readwrite`, `fullaccess`, or an empty string.
    - `access_key` string — The Access Key ID used to access a bucket.
    - `created_at` string, date-time — The date and time the key was created.

## Other responses

- `400` — Cannot mix fullaccess permission with scoped permissions
- `401` — Authentication failed due to invalid credentials.
- `429` — The API rate limit has been exceeded.
- `500` — There was a server error.
- `default` — There was an unexpected error.

---

[API](https://skmtc.net/digitalocean/apis/digitalocean-api.md) · [All operations](https://skmtc.net/digitalocean/apis/digitalocean-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/digitalocean/digitalocean-api/versions/cb3bf9b21459/schema)
