Hira Documentation
FR EN
Free trial

API conventions

Format, pagination, errors and retries.

What applies to every route: data formats, pagination, errors, and how to retry without sending twice.

Address and format#

All routes live under https://hira.localtechstudio.com/api/v1, over HTTPS, with JSON bodies (Content-Type: application/json). The version is in the address (/api/v1). The OpenAPI 3.1 specification is public: https://hira.localtechstudio.com/openapi.json.

  • Dates use the ISO 8601 format.
  • Phone numbers are written in international format with the +: +237600000000.
  • Every resource has a prefixed identifier that you pass as is: acc_ (account), cmp_ (company), con_ (connected number), key_ (key), msg_ (message), tpl_ (template), camp_ (campaign), ct_ (contact), flw_ (Flow), wh_ (webhook), ast_ (media).

Pagination#

Lists accept page and perPage as query parameters and answer:

JSON
{
  "data": [ ... ],
  "meta": { "page": 1, "perPage": 50, "total": 128, "lastPage": 3 }
}

perPage is 50 by default and 200 at most. The campaign list returns 25 items by default (100 at most).

Errors#

An error always has the same shape, with a stable code to test in your program and a message for humans:

JSON
{ "error": { "code": "validation_failed", "message": "...", "details": { }, "request_id": "..." } }

Authentication, quota and access codes are described in Authentication. In addition:

HTTP Code Meaning
422 validation_failed A field is invalid. details.errors lists the faulty fields, before any call to Meta.
422 graph_error Meta refused the request. details holds metaCode, metaType, httpStatus and, when Meta provides it, fbtraceId. Look metaCode up in the error codes.
503 graph_unreachable Meta cannot be reached right now: retry.
405 method_not_allowed The route exists but not with this method.
500 server_error An error on our side: give the request_id to support.

Trace a request#

Every API response carries the X-Request-Id header, repeated in error.request_id when there is an error. You can send your own in the request (8 to 128 characters: letters, digits, ., _ and -): we return it unchanged, which ties your logs to ours.

Retry safely#

The API has no idempotency key: if you resend a POST /messages whose response you never received, the message may go out twice.

  • Retry a 503 graph_unreachable or a 500 after an increasing delay, with a little randomness.
  • For a 422 graph_error, look at the "Retry?" column of the Meta code in the error codes. Never retry a 422 validation_failed, a 401, a 403 or a 404: the result will be the same.
  • After a send whose response was lost, do not resend blindly. If you know the msg_ identifier, read GET /messages/{id}. Otherwise wait for the status in your webhooks. For a verification code, generate a new code: a duplicate is then harmless.

Limits#

Two sources, not to be confused:

  • Meta limits the number's throughput (130429), the app's calls (4, 80007) and how many people you can reach in 24 hours depending on the tier. These refusals arrive as a 422 graph_error with the Meta code.
  • Your plan limits messages, numbers and media storage. These refusals arrive as a 402, see Subscription and quotas.