---
title: "Update API Key Name"
slug: update-api-key-name
description: "Rename an existing API key from the API without regenerating its token."
created_at: "2026-08-31"
updated_at: "2026-08-31"
image: https://cdn.resend.com/posts/update-api-key-name.jpg
humans: ["diel-duarte"]
---

Today we're introducing [`PATCH /api-keys/:id`](/docs/api-reference/api-keys/update-api-key) to **rename an API key in place**. The token stays the same, and so do the key's permission and domain restriction.

## What you can build with it

- **Provisioning workflows**: keep key names in sync when a project gets renamed.
- **Naming convention cleanups**: rename every key from a script without rotating secrets.
- **Platform integrations**: let your users rename the keys your app provisions for them.

## Renaming a key

Send the new name (up to 50 characters) with the ID of the key you want to rename.

<CodeTabs codeHeight={475}>
```nodejs
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.apiKeys.update(
  'b6d24b8e-af0b-4c3c-be0c-359bbd97381e',
  { name: 'Production' },
);
```

```php
$resend = Resend::client('re_xxxxxxxxx');

$resend->apiKeys->update('b6d24b8e-af0b-4c3c-be0c-359bbd97381e', [
  'name' => 'Production',
]);
```

```python
import resend

resend.api_key = "re_xxxxxxxxx"

params: resend.ApiKeys.UpdateParams = {
  "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
  "name": "Production",
}

resend.ApiKeys.update(params)
```

```ruby
require "resend"

Resend.api_key = "re_xxxxxxxxx"

params = {
  id: "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
  name: "Production"
}
Resend::ApiKeys.update(params)
```

```go
import "github.com/resend/resend-go/v3"

client := resend.NewClient("re_xxxxxxxxx")

params := &resend.UpdateApiKeyRequest{
  Name: "Production",
}

updated, _ := client.ApiKeys.Update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", params)
```

```rust
use resend_rs::types::UpdateApiKeyOptions;
use resend_rs::{Resend, Result};

#[tokio::main]
async fn main() -> Result<()> {
  let resend = Resend::new("re_xxxxxxxxx");

  let _api_key = resend
    .api_keys
    .update(
      "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
      UpdateApiKeyOptions::new("Production"),
    )
    .await?;

  Ok(())
}
```

```java
Resend resend = new Resend("re_xxxxxxxxx");

UpdateApiKeyOptions params = UpdateApiKeyOptions.builder()
        .name("Production")
        .build();

UpdateApiKeyResponseSuccess apiKey = resend.apiKeys().update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", params);
```

```dotnet
using Resend;

IResend resend = ResendClient.Create( "re_xxxxxxxxx" );

var resp = await resend.ApiKeyUpdateAsync(
    new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ),
    "Production" );
```

```curl
curl -X PATCH 'https://api.resend.com/api-keys/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json' \
     -d $'{
  "name": "Production"
}'
```

```cli
resend api-keys update b6d24b8e-af0b-4c3c-be0c-359bbd97381e --name "Production"
```
</CodeTabs>

The response confirms the rename:

```json
{
  "object": "api_key",
  "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e"
}
```

<Callout>
  This endpoint only updates the name. To change a key's permission or domain
  restriction, edit the key in the
  [Resend Dashboard](https://resend.com/api-keys).
</Callout>

## Conclusion

Renaming keys is also available in the [Resend CLI](/docs/cli) and through the [MCP server](/docs/mcp-server), so your agents can tidy up key names too.
