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
The unique identifier of the segment to retrieve.
Response
The unique identifier for the segment.
The object type, always segment.
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)
}