Contacts

Manage contacts in your Txtly account with full CRUD operations.

Create Contact

POST
/v1/contacts

Create a new contact. Email must be unique within your team.

Parameters

ParameterTypeDescription
emailrequiredstringEmail address (unique per team)
first_namestringFirst name
last_namestringLast name
unsubscribedbooleanWhether contact is unsubscribed
propertiesobjectCustom JSON properties

Example Request

curl -X POST https://api.txtly.io/v1/contacts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "john.doe@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "properties": {
      "company": "Acme Corp",
      "plan": "premium"
    }
  }'

Example Response

{
  "id": "contact_abc123xyz789",
  "email": "john.doe@example.com",
  "first_name": "John",
  "last_name": "Doe",
  "unsubscribed": false,
  "properties": {
    "company": "Acme Corp",
    "plan": "premium"
  },
  "created_at": "2026-03-21T10:30:00Z",
  "updated_at": "2026-03-21T10:30:00Z"
}

List Contacts

GET
/v1/contacts

List all contacts with pagination support.

Query Parameters

ParameterTypeDescription
limitnumberResults per page (default: 20, max: 100)
offsetnumberNumber of results to skip

Example Response

{
  "contacts": [
    {
      "id": "contact_abc123xyz789",
      "email": "john.doe@example.com",
      "first_name": "John",
      "last_name": "Doe",
      "unsubscribed": false,
      "created_at": "2026-03-21T10:30:00Z"
    }
  ],
  "pagination": {
    "total": 150,
    "limit": 20,
    "offset": 0
  }
}

Get Contact

GET
/v1/contacts/{id}

Retrieve a specific contact by ID.

Path Parameters

ParameterTypeDescription
idrequiredstringContact ID

Update Contact

PATCH
/v1/contacts/{id}

Update a contact. All fields are optional.

Parameters

ParameterTypeDescription
first_namestringFirst name
last_namestringLast name
unsubscribedbooleanUnsubscribe status
propertiesobjectCustom properties (merged with existing)

Example Request

curl -X PATCH https://api.txtly.io/v1/contacts/contact_abc123xyz789 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "Jane",
    "properties": {
      "plan": "enterprise"
    }
  }'

Delete Contact

DELETE
/v1/contacts/{id}

Delete a contact. By default, the contact is soft-deleted. Add ?permanent=true to permanently delete.

Path Parameters

ParameterTypeDescription
idrequiredstringContact ID

Query Parameters

ParameterTypeDescription
permanentbooleanPermanently delete (default: false for soft delete)

Example Requests

# Soft delete (recoverable)
curl -X DELETE https://api.txtly.io/v1/contacts/contact_abc123xyz789 \
  -H "Authorization: Bearer YOUR_API_KEY"

# Permanent delete (non-recoverable)
curl -X DELETE "https://api.txtly.io/v1/contacts/contact_abc123xyz789?permanent=true" \
  -H "Authorization: Bearer YOUR_API_KEY"

Contact Properties

Store custom data on contacts using the properties field. Any valid JSON object is supported.

Example Properties

{
  "company": "Acme Corp",
  "plan": "premium",
  "signup_date": "2026-01-15",
  "ltv": 5000,
  "preferences": {
    "newsletter": true,
    "frequency": "weekly"
  }
}