Skip to documentation

API · Contacts

Add Contact to Segment

Add a contact to a segment and return the segment ID (requires full access). Adding an existing membership leaves it unchanged.

POST/contacts/{id}/segments/{segment}Full access

Request parameters

ParameterTypeDescription
id
path · required
stringContact id or URL-encoded email (case-insensitive).
segment
path · required
stringOpaque resource id.
Idempotency-Key
header · optional
string
1–256 characters
Makes the request safe to retry. See Idempotency.

Request example

Set OPENSEND_BASE_URL=https://api.example.com and OPENSEND_API_KEY=os_replace_me on your server.

bash
curl -X POST "$OPENSEND_BASE_URL/contacts/YOUR_id/segments/YOUR_segment" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Response

200 · application/json. Example IDs stand for IDs returned by your installation.

json
{
  "id": "YOUR_ID"
}

Behavior and errors

The response is { "id" } with the segment ID. Repeated adds are harmless. Both resources must belong to your team. The contact can be given as an ID or a URL-encoded email address.

Use a full-access credential. Resource IDs belong to your team; an unknown or foreign resource returns 404. See authentication, errors, rate limits, and compatibility for the shared contract.