Skip to Content
sesameSend

Contacts

Create and manage Contacts

Retrieve a list of contacts

GET /contacts

Query parameters

NameTypeRequiredDescription
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/contacts" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "e169aa45-1ecf-4183-9955-b1499d5701d3",
      "email": "ada@example.com",
      "first_name": "Ada",
      "last_name": "Lovelace",
      "created_at": "2023-10-06 23:47:56.678+00",
      "unsubscribed": false
    }
  ]
}

Create a new contact

POST /contacts

Body

FieldTypeRequiredDescription
emailstringyesEmail address of the contact.
first_namestringnoFirst name of the contact.
last_namestringnoLast name of the contact.
unsubscribedbooleannoThe Contact's global subscription status. If set to true, the contact will be unsubscribed from all Broadcasts.
propertiesobjectnoA map of custom property keys and values to create.
segmentsobject[]noArray of segment IDs to add the contact to.
segments[].idstringnoThe segment ID
topicsobject[]noArray of topic subscriptions for the contact.
topics[].idstringnoThe topic ID.
topics[].subscription"opt_in" | "opt_out"noThe subscription status for this topic.
audience_idstringnoUnique identifier of the audience to which the contact belongs.

Example

curl -X POST "$SESAMESEND_URL/contacts" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "ada@example.com",
  "first_name": "Ada",
  "last_name": "Lovelace",
  "unsubscribed": false,
  "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf"
}'

Responses

StatusDescription
201OK
{
  "object": "contact",
  "id": "479e3145-dd38-476b-932c-529ceb705947"
}

Retrieve a list of contact imports

GET /contacts/imports

Query parameters

NameTypeRequiredDescription
status"queued" | "in_progress" | "completed" | "failed"noFilter contact imports by status.
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/contacts/imports" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "contact_import",
      "id": "479e3145-dd38-476b-932c-529ceb705947",
      "status": "completed",
      "created_at": "2023-10-06 23:47:56.678+00",
      "completed_at": "2023-10-06 23:50:56.678+00",
      "counts": {
        "total": 100,
        "created": 80,
        "updated": 10,
        "skipped": 5,
        "failed": 5
      }
    }
  ]
}

Create a contact import

POST /contacts/imports

Example

curl -X POST "$SESAMESEND_URL/contacts/imports" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
201OK
{
  "object": "contact_import",
  "id": "479e3145-dd38-476b-932c-529ceb705947"
}

Retrieve a single contact import

GET /contacts/imports/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Contact Import ID.

Example

curl -X GET "$SESAMESEND_URL/contacts/imports/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "contact_import",
  "id": "479e3145-dd38-476b-932c-529ceb705947",
  "status": "completed",
  "created_at": "2023-10-06 23:47:56.678+00",
  "completed_at": "2023-10-06 23:50:56.678+00",
  "counts": {
    "total": 100,
    "created": 80,
    "updated": 10,
    "skipped": 5,
    "failed": 5
  }
}

Retrieve a single contact by ID or email

GET /contacts/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Contact ID or email address.

Example

curl -X GET "$SESAMESEND_URL/contacts/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "contact",
  "id": "e169aa45-1ecf-4183-9955-b1499d5701d3",
  "email": "ada@example.com",
  "first_name": "Ada",
  "last_name": "Lovelace",
  "created_at": "2023-10-06 23:47:56.678+00",
  "unsubscribed": false,
  "properties": {}
}

Update a single contact by ID or email

PATCH /contacts/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Contact ID or email address.

Body

FieldTypeRequiredDescription
emailstringnoEmail address of the contact.
first_namestringnoFirst name of the contact.
last_namestringnoLast name of the contact.
unsubscribedbooleannoThe Contact's global subscription status. If set to true, the contact will be unsubscribed from all Broadcasts.
propertiesobjectnoA map of custom property keys and values to update.

Example

curl -X PATCH "$SESAMESEND_URL/contacts/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "ada@example.com",
  "first_name": "Ada",
  "last_name": "Lovelace",
  "unsubscribed": false
}'

Responses

StatusDescription
200OK
{
  "object": "contact",
  "id": "479e3145-dd38-476b-932c-529ceb705947"
}

Remove an existing contact by ID or email

DELETE /contacts/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Contact ID or email address.

Example

curl -X DELETE "$SESAMESEND_URL/contacts/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "contact",
  "id": "520784e2-887d-4c25-b53c-4ad46ad38100",
  "deleted": true
}

Retrieve a list of segments for a contact

GET /contacts/{contact_id}/segments

Path parameters

NameTypeRequiredDescription
contact_idstringyesThe Contact ID or email address.

Query parameters

NameTypeRequiredDescription
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/contacts/<contact_id>/segments" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "has_more": true,
  "data": [
    {
      "id": "string",
      "name": "string",
      "created_at": "2023-10-06 23:47:56.678+00"
    }
  ]
}

Add a contact to a segment

POST /contacts/{contact_id}/segments/{segment_id}

Path parameters

NameTypeRequiredDescription
contact_idstringyesThe Contact ID or email address.
segment_idstringyesThe Segment ID.

Example

curl -X POST "$SESAMESEND_URL/contacts/<contact_id>/segments/<segment_id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "contact_segment",
  "contact_id": "string",
  "segment_id": "string"
}

Remove a contact from a segment

DELETE /contacts/{contact_id}/segments/{segment_id}

Path parameters

NameTypeRequiredDescription
contact_idstringyesThe Contact ID or email address.
segment_idstringyesThe Segment ID.

Example

curl -X DELETE "$SESAMESEND_URL/contacts/<contact_id>/segments/<segment_id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "contact_segment",
  "contact_id": "string",
  "segment_id": "string",
  "deleted": true
}

Retrieve topics for a contact

GET /contacts/{contact_id}/topics

Path parameters

NameTypeRequiredDescription
contact_idstringyesThe Contact ID or email address.

Query parameters

NameTypeRequiredDescription
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/contacts/<contact_id>/topics" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "has_more": true,
  "data": [
    {
      "id": "string",
      "name": "string",
      "description": "string",
      "subscription": "opt_in"
    }
  ]
}

Update topics for a contact

PATCH /contacts/{contact_id}/topics

Path parameters

NameTypeRequiredDescription
contact_idstringyesThe Contact ID or email address.

Body

FieldTypeRequiredDescription
topicsobject[]yes
topics[].idstringnoThe ID of the topic.
topics[].subscription"opt_in" | "opt_out"noThe subscription status (opt_in or opt_out).

Example

curl -X PATCH "$SESAMESEND_URL/contacts/<contact_id>/topics" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "topics": [
    {}
  ]
}'

Responses

StatusDescription
200OK
{
  "object": "contact_topics",
  "contact_id": "string",
  "topics": [
    {
      "id": "string",
      "subscription": "opt_in"
    }
  ]
}