API reference

Contacts

Manage contact phone numbers and metadata.

get/v1/contacts

List all contacts

Permissioncontacts:r

Requires contacts:r.

Parameters

ParameterTypeDescription
limitqueryinteger
  • Minimum: 1
  • Maximum: 100
  • Default: 50
offsetqueryinteger
  • Minimum: 0
  • Default: 0
searchquerystring

Filter by name, phone number or email (case-insensitive, partial match)

Responses

  • 200A page of contacts, newest first.
    FieldTypeDescription
    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
curl https://api.honkio.ca/v1/contacts \
  -H "Authorization: Bearer mk_live_YOUR_KEY"
post/v1/contacts

Create a contact

Permissioncontacts:w

Requires contacts:w.

Request body

FieldTypeDescription
phone_numberstring

E.164 phone number. Provide phone_number, email, or both.

emailstring

Stored lower-cased. Provide phone_number, email, or both.

  • Format: email
  • At most 254 characters
namestring
  • At most 200 characters
notesstring
  • At most 1000 characters

Responses

  • 201The contact.
    FieldTypeDescription
    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
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"
  }'
get/v1/contacts/{id}

Get a contact

Permissioncontacts:r

Requires contacts:r.

Parameters

ParameterTypeDescription
idrequiredpathstring

Responses

  • 200The contact.
    FieldTypeDescription
    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
curl https://api.honkio.ca/v1/contacts/ID \
  -H "Authorization: Bearer mk_live_YOUR_KEY"
patch/v1/contacts/{id}

Update a contact

Permissioncontacts:m

Requires contacts:m.

Parameters

ParameterTypeDescription
idrequiredpathstring

Request body

FieldTypeDescription
phone_numberstring

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).

  • Can be null
emailstring
  • Format: email
  • At most 254 characters
  • Can be null
namestring
  • At most 200 characters
  • Can be null
notesstring
  • At most 1000 characters
  • Can be null

Responses

  • 200The updated contact.
    FieldTypeDescription
    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
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."
  }'
delete/v1/contacts/{id}

Delete a contact

Permissioncontacts:d

Requires contacts:d.

Parameters

ParameterTypeDescription
idrequiredpathstring

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
curl -X DELETE https://api.honkio.ca/v1/contacts/ID \
  -H "Authorization: Bearer mk_live_YOUR_KEY"