DM Champ Docs

Contacts API

A contact is a single person you message: their name, phone number, email, channel, tags, custom fields, and the lists they belong to. The Contacts API lets you create contacts, look them up, update them, tag them, import them in bulk, and remove them, all without the dashboard.

All paths on this page are relative to the base URL https://api.dmchamp.com/v1, so /contacts means https://api.dmchamp.com/v1/contacts. Every request needs your API key (see Authentication); errors use the shared format in Errors & Pagination. The API Reference has every field, parameter and response for the endpoints below.

Agencies: add sub_account_id to a call to act on one of your client accounts instead of your own.


How contacts work

  • One ID everywhere. The ID you get back when you create a contact (data.contactId) is the same ID you use to fetch, update, tag, message or delete it. You can also find it by phone number or email, or by listing contacts. It is also the ID in the conversation’s address in the app (everything after /chats/, used whole, as it is) and the contact.id in webhook payloads.
  • A contact lives on one channel. The same person on WhatsApp and on SMS is two contacts. You can link them so the app treats them as one person (see Link a contact across channels).
  • Custom fields are your own key/value data on a contact. Fields can have a type (date, number, dropdown, checkbox) that is checked on every write (see Custom field types).
  • Lists group contacts, either by hand (static) or by rules (smart). See Lists.
  • Lead score: contact responses carry the contact’s lead score label, outcome, reason and when it was scored, and the contact list takes a lead_score filter (field names in the API Reference).
  • AI switches on a contact: is_bot_active (the AI may reply), is_private (private, which also turns the AI off), do_not_disturb (no automated outreach and no AI replies) and follow_ups_disabled (no automatic follow ups, while the AI still answers messages they send; useful once someone has bought).

Endpoints

Task Method and path Reference
Create a contact POST /contacts Open in API Reference
Look up by phone or email, or list contacts GET /contacts Open in API Reference
Get a contact by ID GET /contacts/{contactId} Open in API Reference
Get message stats for a contact GET /contacts/{contactId}/stats Open in API Reference
Get what a contact cost GET /contacts/{contactId}/cost Open in API Reference
Count contacts GET /contacts/count Open in API Reference
Update a contact PUT /contacts/{contactId} Open in API Reference
Add or remove tags on a contact POST /contacts/{contactId}/tags Open in API Reference
Create a tag POST /tags Open in API Reference
Rename a tag PUT /tags/{tagId} Open in API Reference
Delete a tag DELETE /tags/{tagId} Open in API Reference
Delete several tags DELETE /tags Open in API Reference
Set a flag on many contacts POST /contacts/bulk-flag Open in API Reference
Import up to 500 contacts POST /contacts/import Open in API Reference
Start a CSV import POST /contacts/import-csv Open in API Reference
Poll a CSV import GET /contacts/import-csv/{jobId} Open in API Reference
Start an export POST /contacts/export Open in API Reference
Poll an export GET /contacts/export/{jobId} Open in API Reference
Send a message to a contact POST /contacts/{contactId}/send-message Open in API Reference
Send an AI follow up POST /contacts/{contactId}/ai-follow-up Open in API Reference
Assign an AI agent POST /contacts/{contactId}/assign-agent Open in API Reference
Assign an AI agent to many contacts POST /contacts/bulk-assign-agent Open in API Reference
Assign a department POST /contacts/{contactId}/department Open in API Reference
Link to another channel POST /contacts/{contactId}/link-channel Open in API Reference
List linked conversations GET /contacts/{contactId}/linked Open in API Reference
Unlink a contact DELETE /contacts/{contactId}/link Open in API Reference
Refresh the profile picture POST /contacts/{contactId}/profile-pic Open in API Reference
Start an AI tagging run POST /contacts/auto-tag Open in API Reference
Poll the AI tagging run GET /contacts/auto-tag/run Open in API Reference
Delete a contact DELETE /contacts/{contactId} Open in API Reference
Delete several contacts DELETE /contacts Open in API Reference
Read the custom field definitions GET /users/me/custom-fields Open in API Reference
Set the custom field definitions PUT /users/me/custom-fields Open in API Reference
Remove a custom field from every contact DELETE /contacts/custom-fields/{fieldKey} Open in API Reference
Add contacts to lists POST /contacts/lists Open in API Reference
Remove contacts from lists DELETE /contacts/lists Open in API Reference
Add many contacts to lists POST /contacts/lists/batch Open in API Reference
Create a list POST /lists Open in API Reference
Update a list PUT /lists/{listId} Open in API Reference
Preview a smart list’s rules POST /lists/preview Open in API Reference
Re-run a smart list now POST /lists/{listId}/evaluate Open in API Reference

Create a contact

A phone number with country code is required, except for an email contact: send "channel": "email" with a valid email and the phone number becomes optional (this needs a connected mailbox).

curl -X POST "https://api.dmchamp.com/v1/contacts?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phoneNumber": "+15551234567",
    "firstName": "Jane",
    "lastName": "Smith",
    "email": "[email protected]",
    "listIds": ["list123", "list456"]
  }'
{ "success": true, "data": { "message": "Successfully created new contact", "contactId": "contact_abc123", "listsAdded": ["list123", "list456"] } }

Good to know:

  • Flat payloads work. Any key that is not a standard create field is stored as a custom field, so a flat payload from Make or Zapier works without nesting. Common alternative names are accepted too: phone or phone_number, first_name / last_name, and full_name or name (split into first and last name). Missing required fields: phoneNumber means no phone value arrived at all.

  • listIds wins over listId when both are sent.

  • Duplicates are not created. If the phone number already exists on the channel you create on, the call answers HTTP 200 with error_code: 409 in the body, so branch on error_code, not on the HTTP status. The existing contact’s ID comes back as contactId (and data.contactId), so you can carry on with it. The same applies to a duplicate email on the Email channel. If your team seat can only see its own contacts and the existing one is not among them, the ID is left out; look it up by phone or email instead.

    { "success": false, "error_code": 409, "error": "A contact with this phone number already exists for the current user.", "contactId": "abc123", "data": { "contactId": "abc123" } }
    
  • Equivalent WhatsApp spellings count as the same number. Mexico (+52… and the legacy +521…), Brazil (with or without the ninth digit) and Argentina (with or without the 9 after +54) each have two valid spellings for one mobile line. The duplicate check and GET /contacts?phoneNumber= match across both, and the stored phone_number is never rewritten.


Get a contact by phone or email

GET /contacts?phoneNumber=... or GET /contacts?email=... returns one fully enriched contact: lists, tags and campaigns resolved to { id, name } pairs, plus the last message. Send neither parameter and the same endpoint lists contacts instead (below). GET /contacts/{contactId} returns the same shape when you already have the ID.

curl "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts?phoneNumber=%2B15551234567&apiKey=YOUR_API_KEY"

Good to know:

  • A + in a query string must be encoded as %2B, or it is read as a space.
  • The ID is returned both as contactId and as contact.id. No match is a 404.
  • avatarUrl (avatar_url in the list) is the profile photo taken from WhatsApp or Meta when the contact messages you. It is read only, null when there is none, and the link can expire, so do not store it. Refresh it on demand with POST /contacts/{contactId}/profile-pic: pictures are cached for 7 days, and a contact with no reachable photo is cached as unavailable for 24 hours (cached: true means the URL came from that cache).
  • adAttribution (ad_attribution in the list) is the ad click that led to your website, matched to this contact by the ad click script, or null. The fields are explained in Ad click attribution for WhatsApp.

Contacts whose number is hidden

A WhatsApp Web contact can arrive without a phone number when WhatsApp withholds it from the linked device (see Contacts Whose Number Is Hidden). Every contact you read carries number_hidden (numberHidden on the single contact shape) and whatsapp_lid (whatsappLid).

  • For a hidden number contact, phone_number is null, number_hidden is true and whatsapp_lid holds WhatsApp’s internal id, like 153055538446346@lid. It is not a dialable number. Match on that id in your own system, and pass it as phoneNumber to the lookup to find the contact again.
  • For every other contact, number_hidden is false and whatsapp_lid is the id WhatsApp reported, or null.

Outbound webhooks and automation payloads carry the same fields, and the contacts CSV export has Number Hidden and WhatsApp LID columns. Once WhatsApp shares the real number, phone_number fills in by itself.


List and count contacts

List contacts

GET /contacts without phoneNumber or email pages through your contacts, newest first, as compact summaries (lists and tags as ID arrays). Keep passing next_cursor back as cursor and stop when next_cursor is null.

curl "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts?limit=100&tag=Hot%20lead&apiKey=YOUR_API_KEY"
# next page: add &cursor=<next_cursor>

Filters and how they combine:

  • listId, tag and excludeTag (tag names, case insensitive) and updated_after can be combined. An unknown tag name or list ID is a 404, not an empty page, so typos show up. An invalid cursor is a 400.
  • updated_after returns contacts changed at or after that moment, oldest change first, so you can sync forward from your last run.
  • search matches name, phone, email and handles and returns the top matches only (next_cursor is null). tag, excludeTag and updated_after are ignored in this mode.
  • rules takes a URL encoded smart list rule set (see The smart_rules shape) for filters like channel, status, dates or custom fields. It cannot be combined with search, listId, tag, excludeTag or updated_after.

Count contacts

GET /contacts/count answers “how many” without paging: a total plus a per channel split (by_channel, with contacts on no channel under none), and filters echoing what was applied. Filters are optional and narrow the count together: agentId (or none for contacts with no assigned agent, which the channel’s default agent answers), channel, tag (name), listId, botActive, status, or rules on its own. No filter returns the account total.

curl "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/count?agentId=agent_xyz789&channel=messenger&apiKey=YOUR_API_KEY"
{ "success": true, "total": 3423, "by_channel": { "messenger": 2744, "instagram": 667, "none": 12 }, "filters": { "agentId": "agent_xyz789" } }

rules together with another filter, or rules that is not valid JSON, is a 400.


Update a contact

PUT /contacts/{contactId} changes only the fields you send; an empty update is a 400.

curl -X PUT "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/contact_abc123?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "do_not_disturb": true, "custom_fields": { "tier": "gold" } }'

Good to know:

  • Custom fields are merged per key. Sending { "custom_fields": { "tier": "gold" } } sets only tier; the others stay. Keys can also be sent at the top level. To remove a key from every contact, use Delete a custom field.
  • Setting is_private: true also turns the AI off; do_not_disturb: true stops the AI replying as well as automated outreach. follow_ups_disabled stays on until you set it back to false.
  • A phone_number that is one of your own connected numbers is rejected, so the AI never ends up messaging itself.

Tags

Add or remove tags

POST /contacts/{contactId}/tags takes tag IDs in addTagIds and removeTagIds (at least one non empty). The tags must already exist; an unknown contact or tag is a 404.

curl -X POST "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/contact_abc123/tags?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "addTagIds": ["tagHotLead"], "removeTagIds": ["tagColdLead"] }'

Manage your tag library

These endpoints rename or delete the tag itself, as opposed to tagging one contact. A tag’s ID is the one in the dashboard’s tag manager, and the tag_id you get back when you create a tag with POST /tags and a body of just { "name": "..." } (no phoneNumber, email or contactId).

  • Deleting a tag cannot be undone; contacts carrying it simply lose it.
  • Deleting a tag that is already gone answers 200 with deleted: 0, not a 404. In DELETE /tags (up to 1,000 IDs), unknown IDs or IDs from another account are skipped silently and not counted.

Auto-tag contacts with AI

POST /contacts/auto-tag runs your tag rules over contacts’ full conversation history and applies or removes tags exactly like the realtime tagging in a live chat: same rules, same per tag credit cost. Use scope: "contacts" with 1 to 500 contact_ids, or scope: "agent" with an agent_id to tag every conversation that agent handles (with scope: "contacts", agent_id only narrows which of that agent’s rules run).

curl -X POST "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/auto-tag?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "scope": "contacts", "contact_ids": ["contact_abc123", "contact_def456"] }'
  • A single contact runs inline and returns result at once. Two or more contacts, or scope: "agent", run in the background and answer 202 with a run_id.
  • Poll with GET /contacts/auto-tag/run, which returns the account’s current or latest run (null if there never was one); status goes from running to completed or failed.
  • Only one bulk run per account at a time: a second one is a 409 with error_code: "auto_tag_run_in_progress".
  • Out of credits on a single contact run is a 402 with error_code: "insufficient_credits"; a bulk run stops early and reports how far it got.

Bulk changes

  • POST /contacts/bulk-flag sets one flag (bot_active, dnd, spam or private) to true or false on up to 500 contacts. Unknown IDs are counted in skipped.
  • DELETE /contacts deletes up to 500 contacts by ID with their message history; unknown IDs and contacts on another account are counted in skipped and left alone. This cannot be undone, and neither can DELETE /contacts/{contactId}, which answers 404 for a contact on another account.
curl -X POST "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/bulk-flag?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "contactIds": ["contactId1", "contactId2"], "field": "bot_active", "value": false }'

Bulk import contacts

POST /contacts/import creates up to 500 contacts from a JSON array. Each record needs a phone_number in international format (a missing + is added).

curl -X POST "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/import?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contacts": [
      { "phone_number": "+12025551234", "first_name": "Ann", "tags": ["vip", "newsletter"] },
      { "phone_number": "+12025551235", "first_name": "Bob" }
    ],
    "listId": "list123",
    "defaultChannel": "whatsapp_web",
    "updateExisting": true
  }'
{ "success": true, "imported": 1, "contact_ids": ["contact_abc123"], "updated": 0, "updated_contact_ids": [], "added_to_list": 1, "added_to_list_contact_ids": ["contact_def456"], "skipped": [{ "index": 1, "phone_number": "+12025551235", "reason": "duplicate" }] }

How records are handled:

  • Bad records are skipped, not fatal. Each skipped record is reported with its index and reason (invalid_record, missing_phone_number, invalid_phone_number, invalid_channel, duplicate_in_request, duplicate, contact_limit_reached, create_failed), so you can fix and retry just those. A record with a bad typed custom field value fails with the field’s message while the rest goes through.
  • Existing numbers are skipped as duplicate by default. With a listId, such a contact is still added to the list and counted in added_to_list, so a re-import fills the list without touching the contact.
  • updateExisting: true updates existing contacts instead: fields present in the record overwrite (first_name, last_name, email, lead_profile; custom_fields merged per key), tags are added and the contact joins listId. Channel, phone number and bot flags are never changed on an existing contact.
  • tags are names (a "a; b" string works too, max 25 per record). Missing tags are created; existing ones are matched ignoring case.
  • Plan limits: if your contact limit cannot fit the new contacts, the whole request is a 403 up front. If the limit is reached partway, the rest come back skipped as contact_limit_reached.

Import contacts from a CSV file

For bigger imports (up to roughly 50,000 rows), POST /contacts/import-csv queues a job against a CSV already in your account’s storage, under users/{your account id}/imports/ and ending in .csv. This endpoint does not take an upload; the dashboard’s CSV importer puts the file there as its first step. Every imported contact joins a list named listName (created or reused) and any existingListRefs.

curl -X POST "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/import-csv?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "csvStoragePath": "users/abc123/imports/leads.csv", "listName": "Webinar signups" }'

It answers 202 with a job_id. Poll GET /contacts/import-csv/{jobId}: status moves queued, processing, then completed or failed (reason in error_message).


Export contacts

POST /contacts/export queues a CSV export of every contact, or only a listId or a set of contactIds, and answers 202 with a job_id. Poll GET /contacts/export/{jobId}; once status is completed you get export_id and contact_count. To download the CSV yourself, use Export at the top of the Contacts page in the app.


Stats and cost

GET /contacts/{contactId}/stats returns message totals, AI vs human replies, credits used and first and last message times. botMessageCount is the same AI message counter the in-app “reset” button on a contact zeroes, and creditsUsed is a running total kept on the contact.

Get contact cost

GET /contacts/{contactId}/cost returns the credits one contact used, split per conversation (chat session) and per kind of action, plus the average cost of a conversation the AI handled alone versus one your team stepped into. Use it to show a client what a conversation costs.

curl "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/contact_abc123/cost?apiKey=YOUR_API_KEY"
{
  "total_credits": 23,
  "unattributed_credits": 0,
  "summary": {
    "contained": { "sessions": 1, "credits": 13, "avg_credits": 13 },
    "handed_off": { "sessions": 1, "credits": 7, "avg_credits": 7 },
    "no_ai": { "sessions": 0, "credits": 0, "avg_credits": 0 }
  }
}
  • total_credits counts every charge on the contact (AI replies, tool calls, tags, follow ups, summaries, background evaluation steps, template and delivery fees) minus refunds on the contact. Credit grants, top ups and renewals never belong to a contact, and playground test runs are left out.
  • A charge lands in the conversation whose window it falls in. A window runs from the conversation’s start until it closes or the next one starts, so nothing is counted twice. Charges outside every window are in unattributed_credits (and in the total).
  • outcome per conversation: contained (the AI replied and nobody from your team stepped in), handed_off (someone sent a message after the AI had replied, or the AI alerted a human), no_ai (the AI never replied).
  • Up to 200 conversations are listed, newest first; sessions_truncated is true when there are more.
  • For an agency client, pass sub_account_id; the figures are in that client’s own credits.
  • This figure is rebuilt from the credit ledger, so it can differ a little from creditsUsed on stats, mostly on older contacts.
  • Team members need the billing permission. 503 means the figures cannot be computed right now; retry shortly.

Message a contact

Send a message to a contact

POST /contacts/{contactId}/send-message sends on whichever channel the contact is on. It is queued, so the response means accepted, not delivered. A contact on do-not-disturb or private, or on a channel that cannot receive outbound messages, is a 422. Sending by phone number or other identity, and everything else about messaging, is in the Messages API.

Send an AI follow-up to a contact

POST /contacts/{contactId}/ai-follow-up has an AI agent write one message in its own voice, from the conversation so far and your instruction, and sends it. It is the same as the Send AI follow-up automation step and costs the same credits as an AI follow up.

curl -X POST "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/contact_abc123/ai-follow-up?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: reminder-contact_abc123-0612" \
  -d '{
    "instruction": "Remind them their reserved link expires tonight and ask if they want to lock it in",
    "mustContain": ["https://example.com/r/abc123"]
  }'
{ "sent": false, "skipReason": "window_closed" }
  • A skip is a normal answer (200), not an error. Check sent before assuming anything went out. A skipped call uses no credits.
  • skipReason values: no_agent (no agent handles the contact and none was given), dnd, ai_paused (the AI is off for this contact, checked only while skipWhenAiPaused is true, the default; or paused for your whole account or this agent, which always applies), window_closed (outside the 24 hour window on WhatsApp Business API, Instagram and Messenger, or the contact never wrote on that channel; checked only while respectMessagingWindow is true, the default), no_credits, text_check_failed (a mustContain item was missing, so nothing was sent), no_text, linkedin_gap (a LinkedIn lead got an automatic message less than 24 hours ago; nextAllowedAt says when the next may go), billing_blocked (the account cannot send until its billing issue is resolved) or crisis_care (a recent message talks about suicidal thoughts, self-harm or danger, so no automatic follow up goes out; the AI still answers their next message).
  • Leave out agentId to use the agent already handling the contact.
  • Retrying safely: send the same idempotency key (body idempotency_key or the Idempotency-Key header) on a retry and the message is written, sent and charged once. For 24 hours a repeat returns the first answer with "replayed": true. A repeat while the first call still runs is a 409 ("error": "in_progress"); wait and retry. A skipped call does not use up its key.
  • A team member’s key needs edit access to contacts.

Route a contact

Assign an AI agent to a contact

POST /contacts/{contactId}/assign-agent moves a conversation to another agent from the next message on, the same as Assign AI Agent in a chat’s menu and the Assign AI agent automation action. agentId: null clears the assignment so the conversation goes back to your team inbox.

curl -X POST "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/contact_abc123/assign-agent?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agentId": "agent_xyz789" }'
  • triggerAIResponse: true messages the contact right away: the new agent answers their latest unanswered messages. Only use it when you want them messaged now. On Messenger and Instagram that reply fails if the contact last wrote more than 24 hours ago. When the contact was already on this agent and its last message is answered, nothing starts and the response says why in aiTriggerError. When the previous agent already answered the contact’s latest message (a hand-off called from inside its own reply), the new agent does not answer it a second time and waits for the contact’s next message; if the previous agent only said it was passing them on, the new agent answers.
  • The agent must be on the same account as the contact (otherwise 404 or 403). An agent’s ID is at the end of its URL on the AI Agents page.

Assign an AI agent to many contacts

POST /contacts/bulk-assign-agent is a pure routing change: no message is sent and no agent replies, which is why there is no triggerAIResponse. Each contact gets the new agent the next time they write. Select contacts with exactly one of contactIds (up to 500), filter (the same keys as Count contacts) or rules.

curl -X POST "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/contacts/bulk-assign-agent?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agentId": "agent_xyz789", "filter": { "agentId": "agent_abc123", "channel": "messenger" } }'

Moving everyone: a call moves at most 500 contacts (limit, newest first). Use a filter that stops matching once a contact has moved, like filter.agentId set to the old agent, and repeat the same call until remaining is 0. matched is the total found, updated the number moved by this call, skipped the IDs not on your account. With contactIds, remaining is always 0.

Assign a contact to a department

POST /contacts/{contactId}/department files a contact under a department (null clears it) and, by default, hands it to whoever on that department has the fewest contacts (hand_to_member). A contact someone already owns is never reassigned; assigned_to is then null. A department answers “which team owns this”, an agent answers “which AI answers this”, and setting one never clears the other.

POST /contacts/{contactId}/link-channel is “Continue on WhatsApp” (or SMS): it finds or creates this person’s contact on whatsapp, whatsapp_web or sms and links the two, so the app knows they are the same person. It uses the source contact’s number unless you pass phoneNumber.

  • Safe to repeat: a second call returns the same contact_id with created: false.
  • 422: the contact is already on that channel family, has no phone number, or there is no connected sender for the target channel. 409: the two contacts are already linked to two different people; unlink one first.
  • GET /contacts/{contactId}/linked lists the other conversations of the same person. An unlinked contact returns an empty array, not a 404.
  • DELETE /contacts/{contactId}/link removes only this contact from its person; the others keep their link.

Custom fields

Custom field types

Every custom field has a type: text (the default), number, date, select (a dropdown with fixed options) or boolean (a checkbox). A typed field is validated on every write (create, update, import, the automations engine and the AI’s own field collection) and stored in one canonical shape, so filters and automation conditions compare like with like:

Type Stored as Accepted on input
text Whatever you send Anything
number A JSON number 42, "42", "19,99"
date "YYYY-MM-DD" 2026-02-01, an ISO date-time (the date part is kept), 01/02/2026 (day first or month first per the account’s date format; an unambiguous value like 13/02/2026 always wins), February 1, 2026, 1 de febrero de 2026
select One of the options, in the option’s own spelling Any case insensitive match of an option
boolean true / false true/false, yes/no, 1/0, si/no, ja/nein and similar
  • null or an empty string clears a typed field. Unregistered keys and text fields are stored exactly as sent.
  • A create or update with a value that does not fit is rejected as a whole with a 400 and a field_errors array (key and message per bad field). On a bulk import only that record fails.
  • GET /users/me/custom-fields returns custom_fields (the plain list of keys, kept for older clients) and definitions (the type per key). Use it to offer a field picker instead of guessing.
  • PUT /users/me/custom-fields replaces the whole list. Each entry is a bare key (keeps its current type, text for a new one) or { key, type, options }. Up to 50 fields; keys use lowercase letters, digits and underscores and start with a letter or underscore; a select has 1 to 100 unique options of up to 64 characters.
  • Changing a field’s type does not rewrite values already stored; they are checked the next time they are written.
curl -X PUT "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/users/me/custom-fields?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "customFields": ["company", { "key": "birthday", "type": "date" }, { "key": "plan", "type": "select", "options": ["Free", "Pro"] }] }'

Delete a custom field

DELETE /contacts/custom-fields/{fieldKey} removes one key from every contact on your account and returns how many were updated. Use it after renaming or retiring a field. The key may contain letters, numbers, underscores and hyphens only (anything else is a 400). This cannot be undone.


Lists

Lists group contacts. A list is either static (you decide who is on it) or smart (membership is computed from rules and kept up to date; see Organizing Lists & Contacts). A list has a name (up to 100 characters), a status of live (default) or draft, a type of static (default) or smart, and smart_rules for a smart list. contact_ids on create or update works on static lists only.

curl -X POST "<span data-t="apiBaseUrl">https://api.dmchamp.com</span>/v1/lists?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "name": "Hot leads (active)",
        "type": "smart",
        "smart_rules": {
          "match": "all",
          "conditions": [
            { "field": "tags", "op": "has_any", "value": ["tagHotLead"] },
            { "field": "last_activity_at", "op": "within_last", "value": { "amount": 90, "unit": "days" } }
          ]
        }
      }'
{ "success": true, "list_id": "list_abc123", "evaluation": { "added": 3, "removed": 0, "total": 3 } }

How smart lists behave:

  • A smart list is evaluated in the same request on create, and again whenever PUT /lists/{listId} changes smart_rules, so evaluation tells you exactly who is on it. On a static list evaluation is null.
  • Switch kinds with PUT: { "type": "smart", "smart_rules": {…} } makes the rules take over at once; { "type": "static" } drops the rules and keeps whoever is on the list.
  • Smart lists update by themselves when a contact changes, and every 15 minutes for time based rules. POST /lists/{listId}/evaluate (the Refresh now button) forces it now; evaluation.skipped: true means an evaluation of that list was already running.
  • POST /lists/preview counts and samples (up to 10, most recently active first) what a rule set would match, without saving anything.
  • Smart lists refuse hand-picked members. POST /contacts/lists, DELETE /contacts/lists, POST /contacts/lists/batch, contact_ids on POST /lists and PUT /lists/{listId}, and choosing a smart list as a CSV import target all answer 409 (“its members are computed from its rules”). Change the rules instead. POST /lists/{listId}/evaluate on a static list is also a 409.

The smart_rules shape

{
  "match": "all",
  "conditions": [
    { "field": "tags", "op": "has_any", "value": ["tagHotLead"] },
    { "field": "channel", "op": "is_any", "value": ["whatsapp", "sms"] },
    { "field": "last_incoming_message_at", "op": "not_within_last", "value": { "amount": 7, "unit": "days" } },
    { "field": "created_at", "op": "after", "value": "2026-01-01" },
    { "field": "email", "op": "is_set" },
    { "field": "custom_field", "key": "Plan", "op": "eq", "value": "pro" }
  ]
}

match is all (every condition) or any (at least one); 1 to 20 conditions, each with at most 100 values and strings of up to 200 characters. You can filter on tags, lists, channel, status, assigned agent, the contact’s date stamps (created, last activity, last incoming or outgoing message, first and last AI interaction), the AI and DND switches, name, phone, email and custom fields. The full field and operator list is in the API Reference. Rules that are easy to get wrong:

  • A smart list cannot be built from another smart list: the lists condition takes static lists only.

  • not_within_last also matches contacts the date was never set on (“more than N ago, or never”). Text comparisons ignore case. before / after compare a plain date as whole days and a full date-time to the exact moment.

  • AI engagement. has_interacted_with_ai is a lifetime flag: true for every contact your AI has sent at least one message to, stamped on that first message and never cleared, so switching the AI off or moving the contact does not reset it. For a period (for example “contacts my AI handled this month”, the usual billing question) range over last_ai_interaction_at instead:

    { "field": "last_ai_interaction_at", "op": "within_last", "value": { "amount": 30, "unit": "days" } }
    

    Do not confuse either with is_bot_active (the AI is allowed to reply) or has_ever_responded (the contact wrote back, to anyone). Every contact carries the same two stamps as first_ai_interaction_at / last_ai_interaction_at.

  • The same rule set works on GET /contacts?rules= and GET /contacts/count?rules=, so you can list or count matches without creating a list.


Errors on contact endpoints

Contact endpoints use the standard error envelope ({ "success": false, "error": "..." }); some add an error_code that usually matches the HTTP status. The one exception is the duplicate on create: HTTP 200 with error_code: 409.

  • 400: a missing or invalid field, an empty body, a bad cursor, over 500 IDs in a batch, or a typed custom field value that does not fit (field_errors).
  • 402: not enough credits for a single contact AI tagging run.
  • 403: besides plan access, a contact limit or list permission problem.
  • 404: the contact, list, tag or agent is not on your account.
  • 409: duplicate on create (in the body only), an AI tagging run already in progress, two contacts already linked to different people, a smart list membership change, or a retried AI follow up still running.
  • 422: the contact cannot be messaged right now (do-not-disturb, private, unsupported channel), or a channel link is not possible.

The shared codes (401, 403, 429, 500) and retry guidance are in Errors & Pagination.


Next steps

  • Messages API: send messages by channel identity and manage conversations.
  • API Reference: every endpoint, field and response, including tags and lists.
  • API Access: generating your key, rate limits and error handling.