Skip to main content
Retrieves detailed information about a specific segment.

Methods

Get

Get(segmentId string) (Segment, error)
Retrieves a segment using the default background context.

GetWithContext

GetWithContext(ctx context.Context, segmentId string) (Segment, error)
Retrieves a segment with a custom context for cancellation and timeout control.

Parameters

segmentId
string
required
The unique identifier of the segment to retrieve.

Response

id
string
The unique identifier for the segment.
name
string
The name of the segment.
object
string
The object type, always segment.
created_at
string
ISO 8601 timestamp of when the segment was created.

Example

package main

import (
    "fmt"
    "github.com/resend/resend-go/v2"
)

func main() {
    client := resend.NewClient("re_123456789")

    segment, err := client.Segments.Get("seg_123456")
    if err != nil {
        panic(err)
    }

    fmt.Println("Segment Name:", segment.Name)
    fmt.Println("Created At:", segment.CreatedAt)
}

Build docs developers (and LLMs) love