{"openapi":"3.1.0","info":{"title":"CaptiFi Connect API","version":"1.0.0","description":"Send and receive SMS with UK numbers.\n\nAuthenticate with `Authorization: Bearer <api key>`. Keys starting `cc_live_` send real texts; keys starting `cc_test_` send nothing, simulate delivery a few seconds later (webhooks included) and charge no credit.\n\nSuccessful responses are `{ \"data\": ..., \"meta\": ... }`. Errors are `{ \"error\": { \"code\", \"message\", \"details\" } }` with a stable `code`.\n\nLists are newest first. Pass `meta.next_cursor` back as `cursor` for the next page.\n\nPOST /messages accepts an `Idempotency-Key` header: a retry with the same key and body returns the first answer instead of sending again.\n\nSend request bodies as JSON (`Content-Type: application/json`), up to 1 MB.\n\nTest keys send to at most 50 numbers a request and 300 an hour.\n\nWebhooks are signed: `X-Connect-Signature: t=<unix seconds>,v1=<hex>`, where v1 is HMAC-SHA256 of `<t>.<raw body>` with your webhook secret. Reject a timestamp more than five minutes old.","contact":{"name":"CaptiFi Connect support","email":"support@captificonnect.co.uk"}},"servers":[{"url":"https://captificonnect.co.uk/api/v1"}],"security":[{"bearer":[]}],"tags":[{"name":"Messages","description":"Send texts and read what was sent and received."},{"name":"Conversations","description":"Two-way threads, one per number that replied."},{"name":"Contacts","description":"Your address book."},{"name":"Lists","description":"Groups of contacts."},{"name":"Campaigns","description":"One text to a whole list."},{"name":"Templates","description":"Saved texts."},{"name":"Opt-outs","description":"Numbers that must not be texted."},{"name":"Sender names","description":"Alphanumeric senders (approval needed)."},{"name":"Webhooks","description":"Endpoints that receive events."},{"name":"Account","description":"Balance and usage."},{"name":"Keywords","description":"Words people text in for an automatic reply and a list."},{"name":"Links","description":"Short tracked links and their clicks."}],"paths":{"/keywords":{"get":{"tags":["Keywords"],"summary":"List keywords","parameters":[{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Keywords.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Keyword"}},"meta":{"type":["object","null"],"properties":{"next_cursor":{"type":["string","null"]}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Keywords"],"summary":"Create a keyword","description":"A keyword is matched against the first word of an inbound text, ignoring case and punctuation. When it matches, the sender becomes a contact, is added to `add_to_list_id` when set, and gets `reply` as a text from your number (one credit per part, nothing to an opted-out number). STOP, STOPALL, UNSUBSCRIBE, CANCEL, END, QUIT, OPTOUT, START and UNSTOP are reserved and refused with `reserved_keyword`. On a shared number a keyword works for people you texted in the last 30 days; on a dedicated number it works for anyone.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeywordInput"},"example":{"keyword":"JOIN","reply":"Thanks, you are on the list.","add_to_list_id":"lst_01J9Z8X7W6V5T4S3R2Q1P0N9M2"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Keyword"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]},"example":{"data":{"id":"kw_01J9Z8X7W6V5T4S3R2Q1P0N9M1","keyword":"JOIN","reply":"Thanks, you are on the list. Reply STOP at any time to leave.","add_to_list_id":"lst_01J9Z8X7W6V5T4S3R2Q1P0N9M2","enabled":true,"match_count":12,"last_matched_at":"2026-10-16T09:12:00.000Z","created_at":"2026-10-01T10:00:00.000Z","updated_at":"2026-10-01T10:00:00.000Z"},"meta":null}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"That keyword already exists on the account (`keyword_exists`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/keywords/{id}":{"get":{"tags":["Keywords"],"summary":"Get a keyword","parameters":[{"name":"id","in":"path","required":true,"description":"The keyword id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The keyword.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Keyword"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Keywords"],"summary":"Edit a keyword","parameters":[{"name":"id","in":"path","required":true,"description":"The keyword id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeywordInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Keyword"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"That keyword already exists on the account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Keywords"],"summary":"Delete a keyword","parameters":[{"name":"id","in":"path","required":true,"description":"The keyword id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/links":{"get":{"tags":["Links"],"summary":"List tracked links","description":"One row per URL per recipient, newest first. Filter by campaign or message.","parameters":[{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}},{"name":"campaign_id","in":"query","schema":{"type":"string"}},{"name":"message_id","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Links.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Link"}},"meta":{"type":["object","null"],"properties":{"next_cursor":{"type":["string","null"]}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/links/{id}":{"get":{"tags":["Links"],"summary":"Get a tracked link","parameters":[{"name":"id","in":"path","required":true,"description":"The link id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The link.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Link"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]},"example":{"data":{"id":"lnk_01J9Z8X7W6V5T4S3R2Q1P0N9M3","code":"k3Dx9aQ","short_url":"https://captificonnect.co.uk/l/k3Dx9aQ","url":"https://example.com/october-offer","message_id":"msg_01J9Z8X7W6V5T4S3R2Q1P0N9M8","campaign_id":"cmp_01J9Z8X7W6V5T4S3R2Q1P0N9M4","contact_number":"+447412000001","clicks":1,"first_clicked_at":"2026-10-16T09:05:00.000Z","last_clicked_at":"2026-10-16T09:05:00.000Z","created_at":"2026-10-16T09:00:00.000Z"},"meta":null}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/numbers":{"get":{"tags":["Account"],"summary":"List dedicated numbers","description":"The UK mobile numbers dedicated to the account. Texts on the SIM route go from one of them and every reply to it belongs to the account. Each is rented monthly in credits (`rental_credits`, taken every 30 days from `rental_charged_at`). Ask for one, or release one, from the Numbers page in the dashboard.","responses":{"200":{"description":"Dedicated numbers.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DedicatedNumber"}},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]},"example":{"data":[{"id":"gw_01J9Z8X7W6V5T4S3R2Q1P0N9M8","phone_number":"+447700900321","online":true,"rental_credits":250,"monthly_credits":250,"rental_charged_at":"2026-10-16T09:00:00.000Z","assigned_at":"2026-10-16T09:00:00.000Z"}],"meta":null}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts/fields":{"get":{"tags":["Contacts"],"summary":"List custom field names","description":"The distinct custom field names in use across your contacts, so a text can merge them as `{field_name}`.","responses":{"200":{"description":"Field names, sorted.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"string"}},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]},"example":{"data":["booking_ref","branch"],"meta":null}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/messages":{"post":{"tags":["Messages"],"summary":"Send texts","description":"Sends one text to every recipient given in `to`, `contact_ids` and `list_id` together. Numbers are checked and de-duplicated; refused numbers are listed in `rejected` and not charged. Merge fields such as {first_name} are filled from contacts. Credits are taken when the request is accepted (one per SMS part) and refunded for any text that fails before leaving.","parameters":[{"name":"Idempotency-Key","in":"header","description":"Up to 200 characters. Makes a retried request safe.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendRequest"},"example":{"to":["07412 000001","+447412000002"],"body":"Hi {first_name}, your order is ready.","client_ref":"order-881"}}}},"responses":{"200":{"description":"An idempotent replay of an earlier request."},"201":{"description":"Accepted. Texts are queued (or scheduled).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"batch_id":{"type":"string"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"rejected":{"type":"array","items":{"$ref":"#/components/schemas/Rejection"}}}},"meta":{"type":["object","null"],"properties":{"credits":{"type":"integer"},"balance":{"type":"integer"},"replayed":{"type":"boolean"},"test":{"type":"boolean"}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredit"},"403":{"description":"The account is pending approval (`account_pending`) or suspended (`account_suspended`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"get":{"tags":["Messages"],"summary":"List messages","parameters":[{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}},{"name":"direction","in":"query","schema":{"type":"string","enum":["outbound","inbound"]}},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/MessageStatus"}},{"name":"q","in":"query","description":"A number (any format) or text to find in the body.","schema":{"type":"string"}},{"name":"campaign_id","in":"query","schema":{"type":"string"}},{"name":"batch_id","in":"query","schema":{"type":"string"}},{"name":"client_ref","in":"query","schema":{"type":"string"}},{"name":"since","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"until","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"A page of messages.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"meta":{"type":["object","null"],"properties":{"next_cursor":{"type":["string","null"]}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/messages/quote":{"post":{"tags":["Messages"],"summary":"Price a send without sending","description":"Takes the same body as POST /messages and returns what it would charge.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendRequest"}}}},"responses":{"200":{"description":"The quote.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Quote"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/messages/{id}":{"get":{"tags":["Messages"],"summary":"Get a message with its status timeline","parameters":[{"name":"id","in":"path","required":true,"description":"The message id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The message.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#/components/schemas/Message"},{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/MessageEvent"}}}}]},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]},"example":{"data":{"id":"msg_01J9Z8X7W6V5T4S3R2Q1P0N9M8","direction":"outbound","status":"delivered","to":"+447412000001","from":"+447700900321","contact_number":"+447412000001","body":"Your table for 4 at 7pm is confirmed.","encoding":"gsm7","segments":1,"credits":1,"route":"sim","sender":null,"client_ref":"booking-1042","batch_id":"bat_01J9Z8X7W6V5T4S3R2Q1P0N9M7","campaign_id":null,"contact_id":null,"error_code":null,"error_message":null,"test":false,"scheduled_at":null,"sent_at":"2026-10-16T09:00:02.000Z","delivered_at":"2026-10-16T09:00:06.000Z","failed_at":null,"cancelled_at":null,"received_at":null,"read_at":null,"created_at":"2026-10-16T09:00:00.000Z","events":[{"status":"queued","detail":null,"at":"2026-10-16T09:00:00.000Z"}]},"meta":null}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/messages/{id}/cancel":{"post":{"tags":["Messages"],"summary":"Cancel a scheduled text","description":"Works while the text is scheduled or still queued. Its credits are refunded.","parameters":[{"name":"id","in":"path","required":true,"description":"The message id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Cancelled.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Message"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Already on its way.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/messages/export":{"get":{"tags":["Messages"],"summary":"Export messages as CSV","description":"Accepts the list filters. Up to 50,000 rows.","responses":{"200":{"description":"CSV file.","content":{"text/csv":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/conversations":{"get":{"tags":["Conversations"],"summary":"List conversations","description":"One entry per number that has texted you, newest activity first.","parameters":[{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}},{"name":"unread","in":"query","schema":{"type":"string","enum":["true","false"]}},{"name":"q","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Conversations.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"meta":{"type":["object","null"],"properties":{"next_cursor":{"type":["string","null"]},"unread_total":{"type":"integer"}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/conversations/{phone}":{"get":{"tags":["Conversations"],"summary":"Get one conversation","parameters":[{"name":"phone","in":"path","required":true,"description":"The number in E.164, URL-encoded (%2B447412000001).","schema":{"type":"string"}}],"responses":{"200":{"description":"The last 200 texts, oldest first.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Thread"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/conversations/{phone}/read":{"post":{"tags":["Conversations"],"summary":"Mark a conversation read","parameters":[{"name":"phone","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"How many texts were marked read.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"marked_read":{"type":"integer"}}},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts":{"get":{"tags":["Contacts"],"summary":"List contacts","parameters":[{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}},{"name":"q","in":"query","schema":{"type":"string"}},{"name":"list_id","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of contacts.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"meta":{"type":["object","null"],"properties":{"next_cursor":{"type":["string","null"]}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Contacts"],"summary":"Create a contact","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"},"example":{"phone":"07412 000001","first_name":"Priya","last_name":"Shah"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contact"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"That number is already a contact.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts/{id}":{"get":{"tags":["Contacts"],"summary":"Get a contact","parameters":[{"name":"id","in":"path","required":true,"description":"The contact id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The contact and its list ids.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contact"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Contacts"],"summary":"Update a contact","parameters":[{"name":"id","in":"path","required":true,"description":"The contact id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contact"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Contacts"],"summary":"Delete a contact","parameters":[{"name":"id","in":"path","required":true,"description":"The contact id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/contacts/import":{"post":{"tags":["Contacts"],"summary":"Import contacts","description":"Upserts up to 20,000 rows by number. Blank fields leave stored values alone.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ContactInput"}},"list_id":{"type":["string","null"]}},"required":["rows"]}}}},"responses":{"200":{"description":"What happened to each row.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ImportResult"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/lists":{"get":{"tags":["Lists"],"summary":"List lists","parameters":[{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Lists.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/List"}},"meta":{"type":["object","null"],"properties":{"next_cursor":{"type":["string","null"]}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Lists"],"summary":"Create a list","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/List"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/lists/{id}":{"get":{"tags":["Lists"],"summary":"Get a list","parameters":[{"name":"id","in":"path","required":true,"description":"The list id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The list.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/List"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Lists"],"summary":"Rename a list","parameters":[{"name":"id","in":"path","required":true,"description":"The list id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/List"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Lists"],"summary":"Delete a list (contacts stay)","parameters":[{"name":"id","in":"path","required":true,"description":"The list id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/lists/{id}/contacts":{"get":{"tags":["Lists"],"summary":"List members","parameters":[{"name":"id","in":"path","required":true,"description":"The list id.","schema":{"type":"string"}},{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Members.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"meta":{"type":["object","null"],"properties":{"next_cursor":{"type":["string","null"]}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Lists"],"summary":"Add members","description":"By contact id or by number (new numbers become contacts).","parameters":[{"name":"id","in":"path","required":true,"description":"The list id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contact_ids":{"type":"array","items":{"type":"string"}},"phones":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"How many were added.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"added":{"type":"integer"},"invalid":{"type":"array","items":{"type":"string"}}}},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/lists/{id}/contacts/{contactId}":{"delete":{"tags":["Lists"],"summary":"Remove a member","parameters":[{"name":"id","in":"path","required":true,"description":"The list id.","schema":{"type":"string"}},{"name":"contactId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Removed."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns":{"get":{"tags":["Campaigns"],"summary":"List campaigns","parameters":[{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Campaigns with message counts.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Campaign"}},"meta":{"type":["object","null"],"properties":{"next_cursor":{"type":["string","null"]}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Campaigns"],"summary":"Create a draft campaign","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignInput"}}}},"responses":{"201":{"description":"The draft.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Campaign"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}":{"get":{"tags":["Campaigns"],"summary":"Get a campaign","parameters":[{"name":"id","in":"path","required":true,"description":"The campaign id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The campaign.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Campaign"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Campaigns"],"summary":"Edit a draft","parameters":[{"name":"id","in":"path","required":true,"description":"The campaign id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Campaign"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Campaigns"],"summary":"Delete a draft","parameters":[{"name":"id","in":"path","required":true,"description":"The campaign id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}/send":{"post":{"tags":["Campaigns"],"summary":"Send or schedule a draft","parameters":[{"name":"id","in":"path","required":true,"description":"The campaign id.","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"schedule_at":{"type":["string","null"],"format":"date-time"}}}}}},"responses":{"200":{"description":"Launched.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Campaign"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredit"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Already launched.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}/cancel":{"post":{"tags":["Campaigns"],"summary":"Cancel a scheduled or sending campaign","description":"Texts not yet taken by a route are cancelled and refunded.","parameters":[{"name":"id","in":"path","required":true,"description":"The campaign id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Cancelled.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Campaign"},"meta":{"type":["object","null"],"properties":{"cancelled_messages":{"type":"integer"}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/templates":{"get":{"tags":["Templates"],"summary":"List templates","parameters":[{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}},{"name":"q","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Templates.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Template"}},"meta":{"type":["object","null"],"properties":{"next_cursor":{"type":["string","null"]}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Templates"],"summary":"Create a template","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Template"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/templates/{id}":{"get":{"tags":["Templates"],"summary":"Get a template","parameters":[{"name":"id","in":"path","required":true,"description":"The template id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The template.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Template"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Templates"],"summary":"Update a template","parameters":[{"name":"id","in":"path","required":true,"description":"The template id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Template"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Templates"],"summary":"Delete a template","parameters":[{"name":"id","in":"path","required":true,"description":"The template id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/opt-outs":{"get":{"tags":["Opt-outs"],"summary":"List opt-outs","parameters":[{"name":"limit","in":"query","schema":{"type":"integer"}},{"name":"offset","in":"query","schema":{"type":"integer"}},{"name":"q","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Opt-outs.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OptOut"}},"meta":{"type":["object","null"],"properties":{"total":{"type":"integer"}}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Opt-outs"],"summary":"Add an opt-out","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phone":{"type":"string"},"note":{"type":["string","null"]}},"required":["phone"]}}}},"responses":{"200":{"description":"Already opted out.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OptOut"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"201":{"description":"Added.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OptOut"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/opt-outs/{phone}":{"delete":{"tags":["Opt-outs"],"summary":"Remove an opt-out","description":"Only when the person has asked to hear from you again.","parameters":[{"name":"phone","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Removed."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/sender-ids":{"get":{"tags":["Sender names"],"summary":"List sender names","responses":{"200":{"description":"Sender names and their review state.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SenderId"}},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Sender names"],"summary":"Ask for a sender name","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"string","minLength":3,"maxLength":11},"purpose":{"type":"string"}},"required":["value"]}}}},"responses":{"201":{"description":"Waiting for review.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SenderId"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks":{"get":{"tags":["Webhooks"],"summary":"List webhooks","responses":{"200":{"description":"Webhooks.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Webhooks"],"summary":"Create a webhook","description":"The response includes `secret`, shown only this once.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"},"example":{"url":"https://example.com/connect/events","events":["message.delivered","message.received"]}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Webhook"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks/{id}":{"patch":{"tags":["Webhooks"],"summary":"Update a webhook","description":"`rotate_secret: true` issues a new secret, returned once.","parameters":[{"name":"id","in":"path","required":true,"description":"The webhook id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Webhook"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Webhooks"],"summary":"Delete a webhook","parameters":[{"name":"id","in":"path","required":true,"description":"The webhook id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks/{id}/test":{"post":{"tags":["Webhooks"],"summary":"Send a test event now","parameters":[{"name":"id","in":"path","required":true,"description":"The webhook id.","schema":{"type":"string"}}],"responses":{"200":{"description":"What your endpoint answered.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks/{id}/deliveries":{"get":{"tags":["Webhooks"],"summary":"Recent deliveries","parameters":[{"name":"id","in":"path","required":true,"description":"The webhook id.","schema":{"type":"string"}},{"name":"limit","in":"query","description":"Items per page, 1 to 100 (default 25).","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","description":"The `meta.next_cursor` of the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Deliveries.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/balance":{"get":{"tags":["Account"],"summary":"Credit balance","responses":{"200":{"description":"Balance.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"credits":{"type":"integer"},"account_status":{"type":"string"}}},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]},"example":{"data":{"credits":1240,"account_status":"active"},"meta":null}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/stats/summary":{"get":{"tags":["Account"],"summary":"Totals for a period","parameters":[{"name":"days","in":"query","schema":{"type":"integer"}},{"name":"from","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Sent, delivered, received and credits, with the change on the period before.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/stats/timeseries":{"get":{"tags":["Account"],"summary":"Daily counts for a period","parameters":[{"name":"days","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"One row per day.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array"},"meta":{"type":["object","null"],"properties":{}}},"required":["data","meta"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"webhooks":{"message.sent":{"post":{"summary":"A text left for the network","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Answer 2xx within 8 seconds."}}}},"message.delivered":{"post":{"summary":"The handset received a text","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Answer 2xx."}}}},"message.failed":{"post":{"summary":"A text failed or was not delivered","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Answer 2xx."}}}},"message.received":{"post":{"summary":"Someone texted you","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Answer 2xx."}}}},"opt_out.created":{"post":{"summary":"A number texted STOP","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Answer 2xx."}}}},"link.clicked":{"post":{"summary":"Someone tapped a tracked link","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkClickedEvent"}}}},"responses":{"200":{"description":"Answer 2xx."}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"An API key from Developers > API keys."}},"responses":{"Unauthorized":{"description":"Missing, wrong or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"No such resource in this account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ValidationFailed":{"description":"The request is not valid; `details` lists the fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Over 20 requests a second (burst 40). Retry after the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InsufficientCredit":{"description":"Not enough credit. `details.needed` and `details.balance` say by how much.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Keyword":{"type":"object","description":"An inbound keyword with its automatic reply and list.","properties":{"id":{},"keyword":{},"reply":{},"add_to_list_id":{},"enabled":{},"match_count":{},"last_matched_at":{},"created_at":{},"updated_at":{}},"example":{"id":"kw_01J9Z8X7W6V5T4S3R2Q1P0N9M1","keyword":"JOIN","reply":"Thanks, you are on the list. Reply STOP at any time to leave.","add_to_list_id":"lst_01J9Z8X7W6V5T4S3R2Q1P0N9M2","enabled":true,"match_count":12,"last_matched_at":"2026-10-16T09:12:00.000Z","created_at":"2026-10-01T10:00:00.000Z","updated_at":"2026-10-01T10:00:00.000Z"}},"KeywordInput":{"type":"object","properties":{"keyword":{"type":"string","maxLength":20,"description":"Letters and digits; stored upper-case. Not an opt-out or opt-in word."},"reply":{"type":["string","null"],"maxLength":1600,"description":"Sent back from your number when the keyword matches. Leave empty for no reply."},"add_to_list_id":{"type":["string","null"],"description":"A list of yours the sender is added to."},"enabled":{"type":"boolean"}},"required":["keyword"]},"Link":{"type":"object","description":"A short tracked link sent to one recipient. `clicks` counts every hit on the short URL.","properties":{"id":{},"code":{},"short_url":{},"url":{},"message_id":{},"campaign_id":{},"contact_number":{},"clicks":{},"first_clicked_at":{},"last_clicked_at":{},"created_at":{}},"example":{"id":"lnk_01J9Z8X7W6V5T4S3R2Q1P0N9M3","code":"k3Dx9aQ","short_url":"https://captificonnect.co.uk/l/k3Dx9aQ","url":"https://example.com/october-offer","message_id":"msg_01J9Z8X7W6V5T4S3R2Q1P0N9M8","campaign_id":"cmp_01J9Z8X7W6V5T4S3R2Q1P0N9M4","contact_number":"+447412000001","clicks":1,"first_clicked_at":"2026-10-16T09:05:00.000Z","last_clicked_at":"2026-10-16T09:05:00.000Z","created_at":"2026-10-16T09:00:00.000Z"}},"TrackLinksField":{"type":"object","properties":{"track_links":{"type":"boolean","description":"Replace each URL in the text with a short tracked link per recipient (`<link base>/l/<code>`), so clicks show per text and per campaign. The quote reflects the shorter text. Ignored on a test send. For a campaign the default is the account setting `track_links_default`."}}},"IgnoreQuietHoursField":{"type":"object","properties":{"ignore_quiet_hours":{"type":"boolean","description":"Send inside the account quiet hours (Europe/London, default 21:00 to 09:00) instead of waiting. Without it a launch inside the window comes back `scheduled` for the window end and `meta.quiet_hours_applied` is true."}}},"CampaignLinkStats":{"type":"object","properties":{"track_links":{"type":"boolean"},"links":{"type":"integer","description":"Tracked links sent."},"clicks":{"type":"integer","description":"Hits on them, all recipients together."},"unique_clicked":{"type":"integer","description":"Links clicked at least once (at most one per URL per recipient)."}}},"LinkClickedEvent":{"type":"object","description":"Webhook event `link.clicked`, raised for every hit on a short link. Subscribe with `events: [\"link.clicked\"]`.","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["link.clicked"]},"created_at":{"type":"string"},"data":{"$ref":"#/components/schemas/LinkClickedData"}},"example":{"id":"evt_01J9Z8X7W6V5T4S3R2Q1P0N9M5","type":"link.clicked","created_at":"2026-10-16T09:05:00.000Z","data":{"link_id":"lnk_01J9Z8X7W6V5T4S3R2Q1P0N9M3","code":"k3Dx9aQ","url":"https://example.com/october-offer","message_id":"msg_01J9Z8X7W6V5T4S3R2Q1P0N9M8","campaign_id":"cmp_01J9Z8X7W6V5T4S3R2Q1P0N9M4","contact_number":"+447412000001","clicks":1,"clicked_at":"2026-10-16T09:05:00.000Z"}}},"LinkClickedData":{"type":"object","properties":{"link_id":{"type":"string"},"code":{"type":"string"},"url":{"type":"string"},"message_id":{"type":["string","null"]},"campaign_id":{"type":["string","null"]},"contact_number":{"type":["string","null"]},"clicks":{"type":"integer","description":"The count after this click."},"clicked_at":{"type":"string","format":"date-time"}}},"DedicatedNumber":{"type":"object","properties":{"id":{"type":"string"},"phone_number":{"type":["string","null"],"description":"E.164."},"online":{"type":"boolean","description":"Whether the gateway behind the number has checked in within the last few minutes."},"rental_credits":{"type":"integer","description":"Credits taken from the balance every 30 days; 0 is free."},"monthly_credits":{"type":"integer","description":"The standard monthly rent for a dedicated number."},"rental_charged_at":{"type":["string","null"],"format":"date-time","description":"When the current month was charged; null before the first charge."},"assigned_at":{"type":"string","format":"date-time"}},"required":["id","phone_number","online","rental_credits","monthly_credits","rental_charged_at","assigned_at"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}},"example":{"error":{"code":"insufficient_credit","message":"This send needs 12 credits and the balance is 3.","details":{"needed":12,"balance":3}}}},"MessageStatus":{"type":"string","enum":["scheduled","queued","sending","sent","delivered","undelivered","failed","cancelled","received"]},"Message":{"type":"object","description":"One text. `credits` is the number of SMS parts charged.","properties":{"id":{},"direction":{},"status":{},"to":{},"from":{},"contact_number":{},"body":{},"encoding":{},"segments":{},"credits":{},"route":{},"sender":{},"client_ref":{},"batch_id":{},"campaign_id":{},"contact_id":{},"error_code":{},"error_message":{},"test":{},"scheduled_at":{},"sent_at":{},"delivered_at":{},"failed_at":{},"cancelled_at":{},"received_at":{},"read_at":{},"created_at":{}},"example":{"id":"msg_01J9Z8X7W6V5T4S3R2Q1P0N9M8","direction":"outbound","status":"delivered","to":"+447412000001","from":"+447700900321","contact_number":"+447412000001","body":"Your table for 4 at 7pm is confirmed.","encoding":"gsm7","segments":1,"credits":1,"route":"sim","sender":null,"client_ref":"booking-1042","batch_id":"bat_01J9Z8X7W6V5T4S3R2Q1P0N9M7","campaign_id":null,"contact_id":null,"error_code":null,"error_message":null,"test":false,"scheduled_at":null,"sent_at":"2026-10-16T09:00:02.000Z","delivered_at":"2026-10-16T09:00:06.000Z","failed_at":null,"cancelled_at":null,"received_at":null,"read_at":null,"created_at":"2026-10-16T09:00:00.000Z"}},"MessageEvent":{"type":"object","properties":{"status":{"type":"string"},"detail":{"type":["string","null"]},"at":{"type":"string","format":"date-time"}}},"Rejection":{"type":"object","properties":{"to":{"type":"string"},"reason":{"type":"string","enum":["invalid_number","unsupported_destination","not_mobile","duplicate","opted_out","too_long","empty_body"]}}},"SendRequest":{"type":"object","properties":{"to":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"},"maxItems":1000}],"description":"UK numbers in any common format. A string may hold several, separated by commas or new lines."},"contact_ids":{"type":"array","items":{"type":"string"}},"list_id":{"type":"string"},"body":{"type":"string","maxLength":1600,"description":"Up to 10 SMS parts. Merge fields: {first_name}, {last_name}, {full_name}, {phone}, {email}."},"template_id":{"type":"string","description":"Used when body is empty."},"sender":{"type":["string","null"],"description":"An approved sender name. Leave out to send from a number people can reply to."},"schedule_at":{"type":["string","null"],"format":"date-time","description":"Up to a year ahead."},"client_ref":{"type":["string","null"],"maxLength":64,"description":"Your own reference, echoed back in webhooks."},"append_opt_out":{"type":"boolean","description":"Adds the account opt-out line (for marketing texts)."}}},"Quote":{"type":"object","properties":{"recipients":{"type":"integer"},"rejected":{"type":"array","items":{"$ref":"#/components/schemas/Rejection"}},"credits":{"type":"integer"},"encoding":{"type":"string","enum":["gsm7","ucs2"]},"preview":{"type":["string","null"]},"balance":{"type":"integer"}}},"Conversation":{"type":"object","properties":{"contact_number":{"type":"string"},"contact_id":{"type":["string","null"]},"contact_name":{"type":["string","null"]},"unread":{"type":"integer"},"last_message":{"$ref":"#/components/schemas/Message"}}},"Thread":{"type":"object","properties":{"contact_number":{"type":"string"},"contact":{},"opted_out":{"type":"boolean"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}}},"Contact":{"type":"object","properties":{"id":{"type":"string"},"phone":{"type":"string"},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":["string","null"]},"notes":{"type":["string","null"]},"custom":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ContactInput":{"type":"object","properties":{"phone":{"type":"string"},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":["string","null"]},"notes":{"type":["string","null"]},"custom":{"type":"object","additionalProperties":{"type":"string"}}},"required":["phone"]},"ImportResult":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer"},"skipped":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer"},"phone":{"type":"string"},"reason":{"type":"string"}}}},"added_to_list":{"type":"integer"}}},"List":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"member_count":{"type":["integer","null"]},"created_at":{"type":"string"}}},"ListInput":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"]}},"required":["name"]},"Campaign":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"body":{"type":"string"},"list_id":{"type":["string","null"]},"sender":{"type":["string","null"]},"append_opt_out":{"type":"boolean"},"status":{"type":"string","enum":["draft","launching","scheduled","sending","completed","cancelled"]},"scheduled_at":{"type":["string","null"]},"recipient_count":{"type":"integer"},"credits":{"type":"integer"},"stats":{"type":["object","null"],"additionalProperties":{"type":"integer"},"description":"Message counts by status."}}},"CampaignInput":{"type":"object","properties":{"name":{"type":"string"},"body":{"type":"string"},"list_id":{"type":"string"},"sender":{"type":["string","null"]},"append_opt_out":{"type":"boolean"}},"required":["name","body","list_id"]},"Template":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"body":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}}},"TemplateInput":{"type":"object","properties":{"name":{"type":"string"},"body":{"type":"string"}},"required":["name","body"]},"OptOut":{"type":"object","properties":{"phone":{"type":"string"},"source":{"type":"string","enum":["keyword","manual","api","import"]},"note":{"type":["string","null"]},"created_at":{"type":"string"}}},"SenderId":{"type":"object","properties":{"id":{"type":"string"},"value":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"purpose":{"type":["string","null"]},"review_note":{"type":["string","null"]}}},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"secret":{"type":"string","description":"Only on create and rotate."}}},"WebhookInput":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["message.sent","message.delivered","message.failed","message.received","opt_out.created"]}},"description":{"type":["string","null"]},"enabled":{"type":"boolean"},"rotate_secret":{"type":"boolean"}}},"WebhookEvent":{"type":"object","description":"Headers: X-Connect-Event, X-Connect-Delivery (same on retries) and X-Connect-Signature.","properties":{"id":{"type":"string"},"type":{"type":"string"},"created_at":{"type":"string"},"data":{}},"example":{"id":"evt_01J9Z8X7W6V5T4S3R2Q1P0N9M9","type":"message.delivered","created_at":"2026-10-16T09:00:06.000Z","data":{"id":"msg_01J9Z8X7W6V5T4S3R2Q1P0N9M8","direction":"outbound","status":"delivered","to":"+447412000001","from":"+447700900321","contact_number":"+447412000001","body":"Your table for 4 at 7pm is confirmed.","encoding":"gsm7","segments":1,"credits":1,"route":"sim","sender":null,"client_ref":"booking-1042","batch_id":"bat_01J9Z8X7W6V5T4S3R2Q1P0N9M7","campaign_id":null,"contact_id":null,"error_code":null,"error_message":null,"test":false,"scheduled_at":null,"sent_at":"2026-10-16T09:00:02.000Z","delivered_at":"2026-10-16T09:00:06.000Z","failed_at":null,"cancelled_at":null,"received_at":null,"read_at":null,"created_at":"2026-10-16T09:00:00.000Z"}}}}}}