---
title: "Update Segment API"
slug: update-segment-api
description: "Rename a segment from the API, CLI, or any official SDK."
created_at: "2026-09-14"
updated_at: "2026-09-14"
image: https://cdn.resend.com/posts/update-segment-api.jpg
humans: ["gabriel-miranda", "diel-duarte"]
---

You could already create, retrieve, list, and delete segments from the API. Today we're adding [`PATCH /segments/:id`](/docs/api-reference/segments/update-segment) so you can **rename a segment** the same way.

## Renaming a segment

Pass the segment ID and the new name.

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

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.segments.update(
  '78261eea-8f8b-4381-83c6-79fa7120f1cf',
  {
    name: 'Active Users',
  },
);
```

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

$resend->segments->update('78261eea-8f8b-4381-83c6-79fa7120f1cf', [
  'name' => 'Active Users',
]);
```

```python
import resend

resend.api_key = "re_xxxxxxxxx"

params: resend.Segments.UpdateParams = {
  "name": "Active Users",
}

segment = resend.Segments.update("78261eea-8f8b-4381-83c6-79fa7120f1cf", params)
```

```ruby
require "resend"

Resend.api_key = "re_xxxxxxxxx"

params = {
  segment_id: "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  name: "Active Users"
}
Resend::Segments.update(params)
```

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

client := resend.NewClient("re_xxxxxxxxx")

params := &resend.UpdateSegmentRequest{
  Name: "Active Users",
}

updated, _ := client.Segments.Update("78261eea-8f8b-4381-83c6-79fa7120f1cf", params)
```

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

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

  let _segment = resend
    .segments
    .update("78261eea-8f8b-4381-83c6-79fa7120f1cf", "Active Users")
    .await?;

  Ok(())
}
```

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

UpdateSegmentOptions options = UpdateSegmentOptions.builder()
        .name("Active Users")
        .build();

UpdateSegmentResponseSuccess response = resend.segments().update("78261eea-8f8b-4381-83c6-79fa7120f1cf", options);
```

```dotnet
using Resend;

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

var resp = await resend.SegmentUpdateAsync( new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), new SegmentData() {
  Name = "Active Users",
} );
Console.WriteLine( "Segment Id={0}", resp.Content.Id );
```

```curl
curl -X PATCH 'https://api.resend.com/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json' \
     -d $'{
  "name": "Active Users"
}'
```

```cli
resend segments update 78261eea-8f8b-4381-83c6-79fa7120f1cf --name "Active Users"
```
</CodeTabs>

The response confirms the rename:

```json
{
  "object": "segment",
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf"
}
```

Renaming segments is also available in the [Resend CLI](/docs/cli) and through the [MCP server](/docs/mcp-server).
