API reference
Contacts
Manage contact phone numbers and metadata.
/v1/contactsList all contacts
contacts:rRequires contacts:r.
Parameters
| Parameter | Type | Description |
|---|---|---|
limitquery | integer |
|
offsetquery | integer |
|
searchquery | string | Filter by name, phone number or email (case-insensitive, partial match) |
Responses
200A page of contacts, newest first.
Field Type Description totalrequiredinteger Total matching records.
limitrequiredinteger offsetrequiredinteger data[]requiredobject[] idrequiredstring phone_numberrequiredstring E.164; null for an email-only contact. Only contacts with a phone can join groups and lists.
- Can be null
emailrequiredstring Lower-cased; null for a phone-only contact. At least one of phone_number and email is set.
- Can be null
namerequiredstring - Can be null
notesrequiredstring - 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/contacts \
-H "Authorization: Bearer mk_live_YOUR_KEY"/v1/contactsCreate a contact
contacts:wRequires contacts:w.
Request body
| Field | Type | Description |
|---|---|---|
phone_number | string | E.164 phone number. Provide phone_number, email, or both. |
email | string | Stored lower-cased. Provide phone_number, email, or both.
|
name | string |
|
notes | string |
|
Responses
201The contact.
Field Type Description idrequiredstring phone_numberrequiredstring E.164; null for an email-only contact. Only contacts with a phone can join groups and lists.
- Can be null
emailrequiredstring Lower-cased; null for a phone-only contact. At least one of phone_number and email is set.
- Can be null
namerequiredstring - Can be null
notesrequiredstring - 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_ALREADY_EXISTS: the phone number or the email is already a contact.The standard error body.
- 422VALIDATION_ERROR (neither phone_number nor email, or a malformed email) or INVALID_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/contacts \
-H "Authorization: Bearer mk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+1613XXXXXXX",
"name": "Sam Tremblay"
}'/v1/contacts/{id}Get a contact
contacts:rRequires contacts:r.
Parameters
| Parameter | Type | Description |
|---|---|---|
idrequiredpath | string |
Responses
200The contact.
Field Type Description idrequiredstring phone_numberrequiredstring E.164; null for an email-only contact. Only contacts with a phone can join groups and lists.
- Can be null
emailrequiredstring Lower-cased; null for a phone-only contact. At least one of phone_number and email is set.
- Can be null
namerequiredstring - Can be null
notesrequiredstring - 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_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/contacts/ID \
-H "Authorization: Bearer mk_live_YOUR_KEY"/v1/contacts/{id}Update a contact
contacts:mRequires contacts:m.
Parameters
| Parameter | Type | Description |
|---|---|---|
idrequiredpath | string |
Request body
| Field | Type | Description |
|---|---|---|
phone_number | string | E.164, or null to clear (refused with 409 CONTACT_IN_USE while the contact is in a group or list, and with 422 when the contact would be left with neither identifier).
|
email | string |
|
name | string |
|
notes | string |
|
Responses
200The updated contact.
Field Type Description idrequiredstring phone_numberrequiredstring E.164; null for an email-only contact. Only contacts with a phone can join groups and lists.
- Can be null
emailrequiredstring Lower-cased; null for a phone-only contact. At least one of phone_number and email is set.
- Can be null
namerequiredstring - Can be null
notesrequiredstring - 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_NOT_FOUND.The standard error body.
- 409CONTACT_ALREADY_EXISTS (the new phone number or email is another contact's) or CONTACT_IN_USE (clearing the phone of a contact that is in a group or a list).The standard error body.
- 422VALIDATION_ERROR (the contact would be left with neither phone_number nor email) or INVALID_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 PATCH https://api.honkio.ca/v1/contacts/ID \
-H "Authorization: Bearer mk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Sam Tremblay",
"notes": "Prefers texts after 5 p.m."
}'/v1/contacts/{id}Delete a contact
contacts:dRequires contacts:d.
Parameters
| Parameter | Type | Description |
|---|---|---|
idrequiredpath | string |
Responses
- 204Deleted, with its group memberships and list entries.
- 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_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/contacts/ID \
-H "Authorization: Bearer mk_live_YOUR_KEY"
HonkIO