# Create bucket key (/docs/management-api/endpoints/buckets/post-buckets-by-bucket-id-keys)

> For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL.

Creates a new access key for the given bucket. The `secretAccessKey` field is returned exactly once in this response and is never stored — copy it immediately.

Location: Management API > Endpoints > Buckets > Create bucket key

Creates a new access key for the given bucket. The `secretAccessKey` field is returned exactly once in this response and is never stored — copy it immediately.

## API reference

### Create bucket key

`POST /v1/buckets/{bucketId}/keys`

Creates a new access key for the given bucket. The `secretAccessKey` field is returned exactly once in this response and is never stored — copy it immediately.

#### Parameters

- `bucketId` (path, string, required)

#### Request body

- `name` (string, optional): Display name for the key. Generated if omitted.
- `role` (string, required): Access role for the key: "read" or "read_write".

#### Responses

- `201`: Created a new bucket key. The secret is returned once in the response body.
- `400`: Invalid request parameters.
- `401`: Missing or invalid authorization token.
- `404`: Bucket with the given ID was not found.

## Related pages

- [`Create bucket`](https://www.prisma.io/docs/management-api/endpoints/buckets/post-buckets): Creates a new object-store bucket in the specified project.
- [`Delete bucket`](https://www.prisma.io/docs/management-api/endpoints/buckets/delete-buckets-by-bucket-id): Permanently deletes the bucket with the given ID, all objects stored in it, and all its access keys. This action cannot be undone.
- [`Delete bucket key`](https://www.prisma.io/docs/management-api/endpoints/buckets/delete-buckets-by-bucket-id-keys-by-key-id): Revokes and deletes the bucket key with the given ID.
- [`Get bucket`](https://www.prisma.io/docs/management-api/endpoints/buckets/get-buckets-by-bucket-id): Returns the bucket with the given ID.
- [`List bucket keys`](https://www.prisma.io/docs/management-api/endpoints/buckets/get-buckets-by-bucket-id-keys): Returns all access keys for the given bucket.