Documentation Index
Fetch the complete documentation index at: https://mintlify.com/resend/resend-go/llms.txt
Use this file to discover all available pages before exploring further.
Creates a new segment entry based on the provided parameters.
Methods
Create
Create(params *CreateSegmentRequest) (CreateSegmentResponse, error)
Creates a segment using the default background context.
CreateWithContext
CreateWithContext(ctx context.Context, params *CreateSegmentRequest) (CreateSegmentResponse, error)
Creates a segment with a custom context for cancellation and timeout control.
Request
Response
The unique identifier for the created segment.
The object type, always segment.
Example
package main
import (
"fmt"
"github.com/resend/resend-go/v2"
)
func main() {
client := resend.NewClient("re_123456789")
params := &resend.CreateSegmentRequest{
Name: "My Segment",
}
segment, err := client.Segments.Create(params)
if err != nil {
panic(err)
}
fmt.Println("Segment ID:", segment.Id)
}