API reference
Every route of the public API, generated from the OpenAPI specification the API itself serves. Each operation says how to call it: the scope, the parameters, the body, the responses and examples in curl, Node and Python. To understand the reason behind a decision, follow the guide link on each operation.
Groups#
- MessagesSend messages and read what came in and went out. Sending is asynchronous: the answer is 202 and delivery happens at the pace Meta allows.8 operations
- ConversationsOne row per contact per number, with the state of the 24 hour customer service window.1 operation
- MediaUpload a file to Meta and download the media that arrived in a message.3 operations
- TemplatesMessages pre-approved by Meta, required to start a conversation outside the 24 hour window.9 operations
- Phone numbersThe connected numbers: connect, read state, quality and throughput, edit and disconnect.22 operations
- Connection linksA link your customer opens to connect their WhatsApp number, without receiving your console login. One link per customer of yours, tied to the externalId you chose.6 operations
- Webhooks and eventsWhere Luna delivers what arrives at your number, the secret that signs those deliveries, and the event types, each with its schema and an example.11 operations
- KeysCreate, list and revoke the credentials that authenticate your calls.6 operations
- Account and planThe credential's account, the plan, the number capacity and how many are in use in the period.6 operations
- StatusAvailability probes and the state of the platform. No authentication.3 operations
- Console and public pagesRoutes the Luna console and the public connection link page use: sign-up, login, session and completion of the flow. You normally do not need them. They exist here because the console is a client of this same API, with no privileged route.16 operations
- Webhook eventsLuna delivers each event by POST to the endpoint you registered.31
- ErrorsEvery API error has the same format.36
Authentication#
Base URL: https://api.lunahia.com.br
Every integration route asks for an API key in the Authorization header, in the form Bearer hlsn_.... The public routes, which each operation’s page marks, ask for no key.
The key carries scopes. Each operation says the scope it demands, and a key without it gets 403. With no key, or with an invalid or revoked one, the answer is 401. The key shows exactly once, when it is created. The step by step to create and revoke keys, with curl, is in Account and keys.
Sending a message is asynchronous: the answer is 202, and Luna delivers to Meta at the pace it allows. The result arrives as a webhook event, at your endpoint.
There is a request limit per API key. It is technical, the same for every customer, and the 429 answer carries Retry-After with the time to wait.
Every error returns a JSON body with error (a stable code) and message (text for a person to read). Decide by the status and by error, never by the text of message. The errors page lists the codes.