API reference
Contact groups
Group contacts and send group broadcasts.
/v1/contact-groupsList contact groups
contact_groups:rRequires contact_groups:r.
Parameters
| Parameter | Type | Description |
|---|---|---|
limitquery | integer |
|
offsetquery | integer |
|
searchquery | string | Filter by group name (case-insensitive, partial match) |
Responses
200A page of groups, newest first, each with its members.
Field Type Description totalrequiredinteger Total matching records.
limitrequiredinteger offsetrequiredinteger data[]requiredobject[] idrequiredstring namerequiredstring descriptionrequiredstring - Can be null
member_countrequiredinteger members[]requiredobject[] idrequiredstring The contact id.
phone_numberrequiredstring - Can be null
namerequiredstring - Can be null
created_atrequiredstring - Format: date-time
updated_atrequiredstring - Format: date-time
- 401Missing, invalid, revoked or expired API key.The standard error body.
- 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
- 403The API key lacks the permission this operation requires, or the account is suspended or closed.The standard error body.
- 422VALIDATION_ERROR: the request failed validation; details names the fields.The standard error body.
- 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
- 500Unexpected server error.The standard error body.
Example
curl https://api.honkio.ca/v1/contact-groups \
-H "Authorization: Bearer mk_live_YOUR_KEY"/v1/contact-groupsCreate a contact group
contact_groups:wRequires contact_groups:w.
Request body
| Field | Type | Description |
|---|---|---|
namerequired | string |
|
description | string |
|
Responses
201The group.
Field Type Description idrequiredstring namerequiredstring descriptionrequiredstring - Can be null
member_countrequiredinteger members[]requiredobject[] idrequiredstring The contact id.
phone_numberrequiredstring - Can be null
namerequiredstring - Can be null
created_atrequiredstring - Format: date-time
updated_atrequiredstring - Format: date-time
- 401Missing, invalid, revoked or expired API key.The standard error body.
- 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
- 403The API key lacks the permission this operation requires, or the account is suspended or closed.The standard error body.
- 409CONTACT_GROUP_ALREADY_EXISTS: the name is taken.The standard error body.
- 422VALIDATION_ERROR: the request failed validation; details names the fields.The standard error body.
- 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
- 500Unexpected server error.The standard error body.
Example
curl -X POST https://api.honkio.ca/v1/contact-groups \
-H "Authorization: Bearer mk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "..."
}'/v1/contact-groups/{id}Get a contact group with its members
contact_groups:rRequires contact_groups:r.
Parameters
| Parameter | Type | Description |
|---|---|---|
idrequiredpath | string |
Responses
200The group with its members.
Field Type Description idrequiredstring namerequiredstring descriptionrequiredstring - Can be null
member_countrequiredinteger members[]requiredobject[] idrequiredstring The contact id.
phone_numberrequiredstring - Can be null
namerequiredstring - Can be null
created_atrequiredstring - Format: date-time
updated_atrequiredstring - Format: date-time
- 401Missing, invalid, revoked or expired API key.The standard error body.
- 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
- 403The API key lacks the permission this operation requires, or the account is suspended or closed.The standard error body.
- 404CONTACT_GROUP_NOT_FOUND.The standard error body.
- 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
- 500Unexpected server error.The standard error body.
Example
curl https://api.honkio.ca/v1/contact-groups/ID \
-H "Authorization: Bearer mk_live_YOUR_KEY"/v1/contact-groups/{id}Update a contact group
contact_groups:mRequires contact_groups:m.
Parameters
| Parameter | Type | Description |
|---|---|---|
idrequiredpath | string |
Request body
| Field | Type | Description |
|---|---|---|
name | string |
|
description | string |
|
Responses
200The updated group.
Field Type Description idrequiredstring namerequiredstring descriptionrequiredstring - Can be null
member_countrequiredinteger members[]requiredobject[] idrequiredstring The contact id.
phone_numberrequiredstring - Can be null
namerequiredstring - Can be null
created_atrequiredstring - Format: date-time
updated_atrequiredstring - Format: date-time
- 401Missing, invalid, revoked or expired API key.The standard error body.
- 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
- 403LIVE_KEY_REQUIRED when a test key tries to change something a live key's allow/deny list references. Also FORBIDDEN when the key lacks the permission.The standard error body.
- 404CONTACT_GROUP_NOT_FOUND.The standard error body.
- 409CONTACT_GROUP_ALREADY_EXISTS: the name is taken.The standard error body.
- 422VALIDATION_ERROR: the request failed validation; details names the fields.The standard error body.
- 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
- 500Unexpected server error.The standard error body.
Example
curl -X PATCH https://api.honkio.ca/v1/contact-groups/ID \
-H "Authorization: Bearer mk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Patients due for a recall visit"
}'/v1/contact-groups/{id}Delete a contact group
contact_groups:dRequires contact_groups:d.
Parameters
| Parameter | Type | Description |
|---|---|---|
idrequiredpath | string |
Responses
- 204Deleted. Its contacts are kept.
- 401Missing, invalid, revoked or expired API key.The standard error body.
- 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
- 403LIVE_KEY_REQUIRED when a test key tries to change something a live key's allow/deny list references; KEY_FENCED when the change would loosen the calling key's own allow/deny fence. Also FORBIDDEN when the key lacks the permission.The standard error body.
- 404CONTACT_GROUP_NOT_FOUND.The standard error body.
- 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
- 500Unexpected server error.The standard error body.
Example
curl -X DELETE https://api.honkio.ca/v1/contact-groups/ID \
-H "Authorization: Bearer mk_live_YOUR_KEY"/v1/contact-groups/{id}/membersAdd a member to a contact group
contact_groups:mProvide either contact_id (existing Contact record) or phone_number (will be auto-created if not exists).
Requires contact_groups:m.
Parameters
| Parameter | Type | Description |
|---|---|---|
idrequiredpath | string |
Request body
| Field | Type | Description |
|---|---|---|
contact_id | string | |
phone_number | string |
Responses
201The member added.
Field Type Description idrequiredstring The contact id.
phone_numberrequiredstring namerequiredstring - Can be null
added_atrequiredstring - Format: date-time
- 401Missing, invalid, revoked or expired API key.The standard error body.
- 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
- 403LIVE_KEY_REQUIRED when a test key tries to change something a live key's allow/deny list references; KEY_FENCED when the change would loosen the calling key's own allow/deny fence. Also FORBIDDEN when the key lacks the permission.The standard error body.
- 404CONTACT_GROUP_NOT_FOUND or CONTACT_NOT_FOUND.The standard error body.
- 409CONTACT_GROUP_MEMBER_EXISTS.The standard error body.
- 422VALIDATION_ERROR (neither contact_id nor phone_number), INVALID_PHONE_NUMBER or CONTACT_HAS_NO_PHONE (the contact has no phone number).The standard error body.
- 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
- 500Unexpected server error.The standard error body.
Example
curl -X POST https://api.honkio.ca/v1/contact-groups/ID/members \
-H "Authorization: Bearer mk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"contact_id": "CONTACT_ID"
}'/v1/contact-groups/{id}/members/{contactId}Remove a member from a contact group
contact_groups:mRequires contact_groups:m.
Parameters
| Parameter | Type | Description |
|---|---|---|
idrequiredpath | string | |
contactIdrequiredpath | string |
Responses
- 204Removed from the group. The contact is kept.
- 401Missing, invalid, revoked or expired API key.The standard error body.
- 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
- 403LIVE_KEY_REQUIRED when a test key tries to change something a live key's allow/deny list references; KEY_FENCED when the change would loosen the calling key's own allow/deny fence. Also FORBIDDEN when the key lacks the permission.The standard error body.
- 404CONTACT_GROUP_NOT_FOUND or CONTACT_GROUP_MEMBER_NOT_FOUND.The standard error body.
- 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
- 500Unexpected server error.The standard error body.
Example
curl -X DELETE https://api.honkio.ca/v1/contact-groups/ID/members/CONTACT_ID \
-H "Authorization: Bearer mk_live_YOUR_KEY"/v1/contact-groups/{id}/messagesSend an SMS to all members of a contact group
messages:wAlways answers 207, whether every member sent or every member failed: check each entry in results rather than the HTTP status. Each result names the member to number. A live broadcast repeated with the same Idempotency-Key within 24 hours answers with the first attempt's stored 207, without running the whole-group checks again or using another daily broadcast slot. A later retry with that key runs the checks again (and can use a slot) but never re-messages a member the first attempt already reached.
Requires messages:w.
Parameters
| Parameter | Type | Description |
|---|---|---|
idrequiredpath | string | |
Idempotency-Keyheader | string |
|
Request body
| Field | Type | Description |
|---|---|---|
fromrequired | string | Sending number (E.164, must be owned by account) |
bodyrequired | string | Up to 1600 characters and 10 SMS parts. Longer bodies are rejected with 422 MESSAGE_TOO_LONG before any member is messaged.
|
skip_consent_check | boolean |
Responses
207Always 207: check each result, not the status. A live broadcast repeated with the same Idempotency-Key within 24 hours answers with the first attempt's stored result.
Field Type Description group_idrequiredstring sent_torequiredinteger Members not failed.
failedrequiredinteger results[]requiredobject[] torequiredstring The member's number.
statusrequiredstring Lowercase: the message status (queued, sent, delivered and so on), or failed.
message_idstring Absent when the member failed before a message was created.
errorstring An error code: why the member failed, or the message's own error_code.
- 401Missing, invalid, revoked or expired API key.The standard error body.
- 402INSUFFICIENT_BALANCE: the balance cannot cover the send. Also PAYMENT_REQUIRED when a LIVE key is used before the first top-up.The standard error body.
- 403FORBIDDEN (skip_consent_check on a live key, or the key lacks messages:w), ACCOUNT_NOT_VERIFIED or SENDING_PAUSED.The standard error body.
- 404CONTACT_GROUP_NOT_FOUND.The standard error body.
- 422VALIDATION_ERROR, BROADCAST_TOO_LARGE, MESSAGE_TOO_LONG or LINK_SHORTENER_BLOCKED.The standard error body.
- 429BROADCAST_LIMIT_REACHED, DAILY_LIMIT_REACHED, FANOUT_LIMIT_REACHED or RECIPIENT_RATE_LIMITED, or RATE_LIMITED at 100 requests per second.The standard error body.
- 500Unexpected server error.The standard error body.
Example
curl -X POST https://api.honkio.ca/v1/contact-groups/ID/messages \
-H "Authorization: Bearer mk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+1416XXXXXXX",
"body": "Hello from HonkIO!"
}'
HonkIO