> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update API key

> Rename an existing API key or adjust its expiration date.

Update API key metadata via the Mailofly API.

### Path Parameters

**id** `string` *required*

The unique identifier of the API key.

### Body Parameters

**name** `string`

New descriptive label.

**expires\_at** `string`

New expiration date in ISO 8601 format, or `null` for no expiration.

### Response

**data** `object`

**id** `string`

Key ID.

**name** `string`

Updated name.

**expires\_at** `string`

Updated expiration.

```bash cURL theme={null}
curl -X PATCH https://api.mailofly.com/api-keys/key_123456 \
  -H "Authorization: Bearer mf_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Staging Backend"
  }'
```

```json 200 OK theme={null}
{
  "data": {
    "id": "key_123456",
    "name": "Staging Backend",
    "secret_suffix": "9aBc",
    "expires_at": null
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.