---
title: PUT /user/api-keys
description: "Update an API key — Changes the name, description, rate limits or project restriction of one of your active keys. Send only the fields you want to change."
full: true
---

**Auth:** required. Send a signed-in session token (`Authorization: Bearer …`) or the session cookie (browser sessions). See [Authentication](/docs/api/authentication).

Changes the name, description, rate limits or project restriction of one of your active keys. Send only the fields you want to change. Scopes and expiry cannot be changed. Requires a signed-in session; an `ivy_` key is answered with `401`.

## Request

### Request body

- `keyId` (string (uuid)) —
The key's `id`.

- `name` (string) —
New display name. Must not be blank.

- `description` (string) —

- `rateLimitPerHour` (integer) —

- `rateLimitPerDay` (integer) —

- `maxConcurrentJobs` (integer) —

- `allowedProjectIds` (string[]) —
New project restriction. Send null to remove it.

## Responses

### `200` OK

The updated key

Response shape:

- `id` (string (uuid)) —
Key id. Pass it as `keyId` to read usage.

- `keyId` (string) —
Public key identifier.

- `keyPrefix` (string) —
First characters of the key, for recognising it.

- `name` (string) —

- `description` (string) —

- `status` (enum (&quot;active&quot; | &quot;revoked&quot; | &quot;expired&quot;)) —

- `scopes` (string[]) —

- `allowedProjectIds` (string[]) —
Projects the key is limited to; null means all of your projects.

- `rateLimitPerHour` (integer) —

- `rateLimitPerDay` (integer) —

- `maxConcurrentJobs` (integer) —

- `totalRequests` (integer) —

- `lastUsedAt` (string (date-time)) —

- `expiresAt` (string (date-time)) —

- `createdAt` (string (date-time)) —

### `400` Bad Request

`keyId` is missing, the name is empty, or a limit is not a positive bounded integer

Response shape: `object`

### `401` Unauthorized

A signed-in session is required

Response shape: `object`

### `403` Forbidden

The key would be limited to projects you cannot access (`unauthorizedProjectIds` lists them)

Response shape: `object`

### `404` Not Found

No active key with that id on your account

Response shape: `object`

### `429` Too Many Requests

Rate limit exceeded

Response shape: `object`

**curl**

```bash
curl -X PUT 'https://ivybiosciences.com/api/user/api-keys' \
  -H "Authorization: Bearer $IVY_SESSION_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "keyId": "00000000-0000-0000-0000-000000000000"
}'
```

**JavaScript**

```js
const res = await fetch('https://ivybiosciences.com/api/user/api-keys', {
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${process.env.IVY_SESSION_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "keyId": "00000000-0000-0000-0000-000000000000"
}),
});
const data = await res.json();
```

**Python**

```python
import os, requests

res = requests.put(
    "https://ivybiosciences.com/api/user/api-keys",
    headers={"Authorization": f"Bearer {os.environ['IVY_SESSION_TOKEN']}"},
    json={
  "keyId": "00000000-0000-0000-0000-000000000000"
},
)
data = res.json()
```
