Contacts


Create, read, update, and list contacts in your account. A contact is addressed by its E.164 phone number (/contacts/by-phone/{phoneNumber}) or by its ID (/contacts/{contactId}, the con_* value in id).

Endpoints

MethodPathPurpose
GET/api/v1/contactsList contacts, page by page
POST/api/v1/contacts/by-phone/{phoneNumber}Create a contact
GET/api/v1/contacts/by-phone/{phoneNumber}Read a contact
PATCH/api/v1/contacts/by-phone/{phoneNumber}Update profile fields
GET/api/v1/contacts/{contactId}Read a contact by its ID
PATCH/api/v1/contacts/{contactId}Update a contact by its ID

A contact is addressed either by its phone number (/contacts/by-phone/{phoneNumber}) or by its ID (/contacts/{contactId}, the con_* value returned in id) — both reach the same contact with the same behaviour and errors. Creating a contact is by phone only: a new contact has no ID yet.

Group memberships are managed at a separate path — see Group Membership.

phoneNumber in every URL must be a valid E.164 phone number (+ followed by country code and subscriber digits). URL-encode the + as %2B if your HTTP client doesn't handle it automatically.


POST — Create a contact

Registers a new contact at the given phone number. The phone is taken from the URL — do not send it in the body. Creation does not trigger any consent flow on its own; the contact becomes messageable only after you add them to a group (see Group Membership).

curl -X POST https://platform.textingline.com/api/v1/contacts/by-phone/+18005551234 \
  -u "your_key_id:your_key_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Alice",
    "lastName": "Doe",
    "email": "[email protected]",
    "birthDate": "1985-04-12",
    "address": {
      "street": "1 Main St",
      "city": "New York",
      "state": "NY",
      "postalCode": "10001",
      "country": "US"
    },
    "isFavorite": false,
    "customFields": {
      "Favorite Color": "Red",
      "Age": 42,
      "Interests": ["Sports", "Music"]
    }
  }'

A successful response returns 201 Created with the contact projection (see Response shape below).

Request body

All fields are optional. Unknown properties are rejected with 400.

FieldTypeDescription
firstNamestringFirst name. Up to 40 characters.
lastNamestringLast name. Up to 40 characters.
emailstringRFC 5322 email address.
birthDatestring (YYYY-MM-DD)ISO date.
genderstringOne of MALE, FEMALE, OTHER.
addressobjectMailing address. See Address shape below.
isFavoritebooleanOperator flag — purely an annotation, has no effect on messaging.
customFieldsobjectCustom-field values keyed by label. See Custom fields. Discover labels via Custom Fields.

Read-only fields

  • tz is not accepted in the request body. The server derives it from the contact's address.postalCode (when present, US) or from the area code of the phone number, returning one of the 6 supported US zones. See Timezone derivation.
  • phoneNumber is taken from the URL only — don't put it in the body. Including it returns 400.

Idempotency

If a contact already exists at this phone number, POST returns 409 ContactAlreadyExists (33037) and does not modify the existing record. To merge new data into an existing contact, fetch it with GET and then PATCH instead:

# Common upsert pattern
curl -X GET https://platform.textingline.com/api/v1/contacts/by-phone/+18005551234 \
     -u "your_key_id:your_key_secret"
# If 404 → POST a new contact.
# If 200 → PATCH any changed fields.

See Upsert a contact from a CRM for a worked example.


GET — Read a contact

Returns the full contact projection including profile fields, derived timezone, group memberships (active + pending), and the customFields map keyed by label.

curl https://platform.textingline.com/api/v1/contacts/by-phone/+18005551234 \
  -u "your_key_id:your_key_secret"

Response shape

{
  "id": "con_7J424HdkdtYdQcFfd",
  "phoneNumber": "+18005551234",
  "firstName": "Alice",
  "lastName": "Doe",
  "email": "[email protected]",
  "birthDate": "1985-04-12",
  "address": {
    "street": "1 Main St",
    "city": "New York",
    "state": "NY",
    "postalCode": "10001",
    "country": "US"
  },
  "tz": "America/New_York",
  "isFavorite": false,
  "customFields": {
    "Favorite Color": "Red",
    "Age": 42,
    "Interests": ["Sports", "Music"]
  },
  "groups": [
    {
      "id": "grp_7L1uzUXqj3eJvAwHi",
      "name": "VIP Customers",
      "optInAt": "2026-04-01T00:00:00.000Z",
      "tags": [
        {
          "id": "tag_ClyOhUtpAJb4anDpxZt3Ov",
          "name": "Gold",
          "createdAt": "2025-08-01T00:00:00.000Z",
          "updatedAt": "2025-08-02T00:00:00.000Z"
        }
      ]
    }
  ],
  "pendingGroups": [],
  "createdAt": "2026-01-15T10:30:00.000Z"
}
FieldDescription
idStable contact ID, prefixed con_. Address the contact by it (/contacts/{contactId}) or by phone — both work.
phoneNumberE.164 phone number. Cannot be changed.
tzServer-derived IANA timezone. Read-only. See Timezone derivation.
customFieldsObject keyed by label (see Custom fields). Only fields visible on the schema appear; values for deleted/disabled fields are stripped.
groupsActive memberships. The contact is opted in and messageable for each group listed here.
pendingGroupsMemberships awaiting opt-in confirmation. Created by Group Membership POST with optInMode: CONFIRM. Move to groups once the contact replies YES.
createdAtISO 8601 timestamp of when the contact was created.

Profile fields (firstName, lastName, email, birthDate, gender, address) are omitted from the response when unset.


PATCH — Update a contact

Updates one or more profile fields. Uses JSON Merge Patch (RFC 7396) semantics:

  • Fields absent from the body are left unchanged.
  • Fields with a value are set.
  • Fields with null (or empty string for nullable string fields) are cleared.
curl -X PATCH https://platform.textingline.com/api/v1/contacts/by-phone/+18005551234 \
  -u "your_key_id:your_key_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Alicia",
    "address": {
      "postalCode": "94102",
      "country": "US"
    },
    "customFields": {
      "Favorite Color": "Blue"
    }
  }'

What can't be changed via PATCH

  • phoneNumber — cannot be changed. The body must not include phoneNumber.
  • tz — server-derived. Re-evaluated automatically whenever address.postalCode changes (since the derivation depends on it).
  • Group memberships and pending memberships — use the Group Membership endpoints instead. The contact response includes groups[] and pendingGroups[] for visibility, but PATCH on this endpoint never touches them.

customFields per-label merge

The customFields map merges per-label — only labels present in the body are touched:

{ "customFields": { "Favorite Color": "Blue" } }

The above changes only Favorite Color and leaves every other custom field unchanged. To clear a single field, send null:

{ "customFields": { "Favorite Color": null } }

To clear every custom field at once, send customFields: null:

{ "customFields": null }

A successful response returns 200 OK with the same shape as GET.


LIST — List contacts

Returns your contacts one page at a time. Each item in results has the same shape as GET. Use it for a full export, a filtered export (by group, tag or creation date), or an incremental sync of only what changed.

curl "https://platform.textingline.com/api/v1/contacts?limit=100" \
  -u "your_key_id:your_key_secret"
{
  "limit": 100,
  "nextCursor": "eyJ2IjoxLCJjIjoiMjAyNi0wOS0xNFQxNzowMjoxMS4wMDBaIiwiaSI6IjY1YTFiMmMzZDRlNWY2YTdiOGM5ZDBlMSJ9.Xq3vN8mB0kR2...",
  "hasMore": true,
  "results": [
    {
      "id": "con_7J424HdkdtYdQcFfd",
      "phoneNumber": "+18005551234",
      "firstName": "Alice",
      "isFavorite": false,
      "customFields": {},
      "groups": [],
      "pendingGroups": [],
      "createdAt": "2026-09-14T17:02:11.000Z"
    }
  ]
}

Query parameters

ParameterTypeDescription
limitnumberPage size, 1–100. Defaults to 50.
cursorstringThe previous response's nextCursor. Omit it for the first page.
groupIdstringA grp_* ID. Only contacts with an active membership in that group (pending memberships are not included).
tagIdstringA tag_* ID. Only contacts carrying that tag in the group. Requires groupId — a tag belongs to one group.
createdAfterdateOnly contacts created at or after this time (inclusive).
createdBeforedateOnly contacts created before this time (exclusive).
updatedAfterdateSwitches to changes mode: contacts created or changed since this time.

Dates are either a date (2026-09-01, read as midnight UTC) or an ISO 8601 datetime with a timezone (2026-09-01T00:00:00Z, 2026-09-01T09:00:00+03:00). A datetime without a timezone is rejected with 400.

groupId, tagId, createdAfter and createdBefore can be combined. updatedAfter can't be combined with any of them. Any other query parameter is rejected with 400. There is no search, no sort option and no total count.

Results are newest first, except in changes mode, which returns the oldest change first.

Walking every contact

Call without a cursor, then keep passing the previous response's nextCursor as cursor until hasMore is false. On the last page nextCursor is null.

let cursor = null;
do {
  const params = new URLSearchParams({ limit: '100' });
  if (cursor) params.set('cursor', cursor);

  const res = await fetch(`https://platform.textingline.com/api/v1/contacts?${params}`, {
    headers: { Authorization: 'Basic ' + btoa('your_key_id:your_key_secret') },
  });

  if (res.status === 429) {
    await new Promise((r) => setTimeout(r, Number(res.headers.get('Retry-After')) * 1000));
    continue; // retry the same page
  }

  const page = await res.json();
  for (const contact of page.results) handleContact(contact);
  cursor = page.nextCursor;
} while (cursor);

Keep the same query parameters for the whole walk. A cursor only works with the filters it was issued with.

About the cursor

  • Treat it as opaque. Store it and send it back unchanged. Don't parse, build or edit it.
  • It is tied to your account and your filters. A cursor that was edited, came from another account, or is sent with different filters is rejected with 400 InvalidCursor (33045). Restart from the first page without a cursor.
  • It doesn't expire. You can stop a walk and resume it later from the last nextCursor you stored.

What a walk returns

  • Contacts that exist for the whole walk are returned exactly once.
  • Contacts created after you fetched the first page are not included, because the list is newest first. Start a new walk to pick them up.
  • Contacts deleted during the walk are not returned if the walk hasn't reached them yet. Edits show up if the walk hasn't reached the contact yet.
  • The list includes every contact on your account, including contacts that are opted out or in no group — the same contacts you can read with GET.
  • With groupId, the first page returns 404 GroupNotFound (33031) if the group isn't on your account. With tagId, it returns 404 TagNotFound (33046) if the tag isn't in that group.

Syncing only what changed

Pass updatedAfter to get only contacts created or changed since a time, oldest change first. Every response in this mode includes updatedUntil: the walk covers changes up to that time. Save it, and pass it as updatedAfter on your next sync.

# First sync: everything changed since Sept 1
curl "https://platform.textingline.com/api/v1/contacts?updatedAfter=2026-09-01&limit=100" \
  -u "your_key_id:your_key_secret"
# ...follow nextCursor to the end, then store the response's updatedUntil,
# e.g. "2026-10-03T11:59:00.000Z"

# Next sync: only what changed since then
curl "https://platform.textingline.com/api/v1/contacts?updatedAfter=2026-10-03T11:59:00.000Z&limit=100" \
  -u "your_key_id:your_key_secret"
  • updatedUntil is about a minute before your first request. Changes after it show up in your next sync, so nothing is skipped between syncs.
  • A contact can appear in two consecutive syncs. Treat each one as an upsert.
  • A contact changed during a walk isn't returned twice in that walk. It shows up in the next sync.
  • Deleted contacts aren't returned. To track opt-outs and removals as they happen, use webhooks.
  • updatedAfter can't be combined with groupId, tagId, createdAfter or createdBefore.

Rate limit

LIST has its own bucket, contactApiList: 20 requests per 60 seconds, or up to 2,000 contacts per minute at limit=100. It does not use your contact-management read budget, so a running sync doesn't slow down single-contact reads. When you hit the limit, wait for Retry-After and retry the same page. See Rate Limits.


Address shape

The address object on the request and response uses a fixed sub-shape:

FieldTypeDescription
streetstringStreet line.
citystringCity.
statestringState or region (free-form).
postalCodestringPostal code.
countrystringISO 3166-1 alpha-2 country code (e.g. US, CA, GB). Case-insensitive on writes, normalized to uppercase. Invalid codes return 400.

On PATCH, send the address sub-fields you want to change — omitted sub-fields are kept. To clear the entire address, send "address": null.


Custom fields

customFields is a JSON object keyed by label — the human-readable name you gave the field in your dashboard (e.g. "Favorite Color", "Birthday"). Match is case-insensitive and trims whitespace.

{
  "customFields": {
    "Favorite Color": "Red",
    "Age": 42,
    "Birthday": "1985-04-12",
    "Interests": ["Sports", "Music"]
  }
}

Value shape depends on the field's type:

TypeValue
TEXTstring
NUMBERnumber
BOOLEANboolean
DATEYYYY-MM-DD string
SINGLE_SELECTstring matching one of the field's options
MULTI_SELECTarray of strings, each matching an option

Discover the available labels, types, and options via Custom Fields.

Validation errors return 33033 InvalidCustomField with details.label and details.reason:

{
  "code": 33033,
  "message": "Invalid custom field \"Faverite Color\": unknown_label",
  "status": 400,
  "moreInfo": "https://docs.textingline.com/docs/error-codes",
  "details": {
    "label": "Faverite Color",
    "reason": "unknown_label"
  }
}

details.reason is one of: unknown_label, duplicate_label_input, type_mismatch, unknown_option, duplicate_option, invalid_date_format, invalid_calendar_date, length_exceeded. See Error Codes for descriptions of each.


Timezone derivation

tz is derived server-side every time the contact's phone or address changes, in this order:

  1. address.postalCode — if present, US, and resolvable to a supported zone.
  2. phoneNumber NANP area code — fallback when no zip is available or when the zip doesn't resolve.
  3. Unset — for non-US contacts or numbers we can't resolve.

The product supports 6 US IANA zones: America/New_York, America/Chicago, America/Denver, America/Los_Angeles, America/Anchorage, Pacific/Honolulu. Non-US contacts intentionally have no tz field in the response — sending to them is allowed; timezone-aware features (e.g. flow scheduling) treat them as having no preferred local time.

PATCH a contact's address.postalCode and tz is recomputed automatically on the next read.


Rate limit

EndpointLimitWindow
POST / PATCH /api/v1/contacts/by-phone/{phoneNumber}, PATCH /api/v1/contacts/{contactId} (write)150 requests60 seconds
GET /api/v1/contacts/by-phone/{phoneNumber}, GET /api/v1/contacts/{contactId} (read)150 requests60 seconds
GET /api/v1/contacts (list)20 requests60 seconds

Writes share a single contactApiWrite bucket with the Group Membership write endpoints. Reads share a single contactApiRead bucket with Groups LIST/GET and Custom Fields. LIST has its own contactApiList bucket. See Rate Limits for headers and bucket details.


Common errors

CodeHTTPDescription
33003400Invalid phone number — phoneNumber is not a valid E.164 format.
33030404Contact not found — no contact with this phone number or ID on your account.
33031404Group not found — LIST groupId is not a group on your account.
33046404Tag not found — LIST tagId is not a tag in that group.
33034400Invalid ID — contactId is not a valid con_* ID, or LIST groupId / tagId is not a valid grp_* / tag_* ID.
33045400Invalid cursor — LIST cursor was edited, is from another account, or doesn't match the filters. Restart without a cursor.
33024400Request validation failed — e.g. LIST tagId without groupId, updatedAfter with another filter, or a datetime without a timezone. details.reason says which.
33033400Invalid custom field — see Custom fields above for details.reason values.
33037409A contact with this phone number already exists. Use GET + PATCH to merge.
—400Body validation error (e.g. invalid address.country — must be ISO 3166-1 alpha-2). Standard envelope.

See Error Codes for the full reference.


Did this page help you?