Skip to content

Documentation

API for the backend

Through the API, the backend of your website sends events, errors, feedback and server-side requests. Both the request body and the response are JSON.

Base address and authentication

Base address
https://www.lunaboard.com/api/v1
  • Every request carries the header Authorization: Bearer luna_… with the API key of the site.
  • A key belongs to one site. You create it in the site settings and see it in full only once. Lunaboard stores only its hash.
  • A key can be revoked at any time. A request with a missing, unknown or revoked key ends with code 401.
Response without a valid key
HTTP/1.1 401 Unauthorized {"error": "unauthorized", "message": "Missing, unknown or revoked API key."}

Overview of endpoints

EndpointPurposeBatchSuccess
POST /eventsEvent from the backendYes201
POST /errorsError from the backend with a traceYes201
POST /feedbackMessage from your own formNo201
POST /hitsServer-side requestsYes202

Events

POST /events

FieldRequiredDescription
typeYesType key, for example order.created. Letters, digits, period, underscore, colon and hyphen, at most 80 characters.
titleYesShort title for the overview, at most 200 characters.
detailNoOne sentence with details, at most 500 characters.
urlNoLink to the administration of your website (http or https).
occurred_atNoTime of the event. Without it, the time of receipt is used.
flow_idNoShared flow identifier, at most 80 characters. Events with the same value are combined and the times between the steps are shown.

The prepared types are user.registered, order.created, order.paid and listing.created. You can also send any custom type.

curl
curl -X POST https://www.lunaboard.com/api/v1/events \ -H "Authorization: Bearer luna_VAS_KLIC" \ -H "Content-Type: application/json" \ -d '{ "type": "order.created", "title": "Objednávka 2026-0042", "detail": "3 položky, 1 490 Kč", "url": "https://vas-web.cz/admin/objednavky/42", "flow_id": "order-42" }'
Response
HTTP/1.1 201 Created {"id": 1284}
PHP (Laravel)
<?php // Laravel: odeslání události z backendu. Chyba Lunaboardu nesmí shodit objednávku. use Illuminate\Support\Facades\Http; try { Http::withToken(config('services.lunaboard.key')) ->timeout(3) ->post('https://www.lunaboard.com/api/v1/events', [ 'type' => 'order.created', 'title' => 'Objednávka '.$order->number, 'detail' => $order->items_count.' položek, '.$order->total_formatted, 'url' => route('admin.orders.show', $order), 'flow_id' => 'order-'.$order->id, ]); } catch (Throwable $e) { report($e); }

Batches

Instead of one object, you can send an array of objects, at most 500 items in one request. The whole batch is validated in advance: if any item is invalid, nothing is stored and the 422 response states the position of the item and the field.

curl
curl -X POST https://www.lunaboard.com/api/v1/events \ -H "Authorization: Bearer luna_VAS_KLIC" \ -H "Content-Type: application/json" \ -d '[ {"type": "order.created", "title": "Objednávka 2026-0042", "flow_id": "order-42"}, {"type": "order.paid", "title": "Zaplaceno 2026-0042", "flow_id": "order-42"} ]' # Odpověď: 201 {"accepted": 2, "ids": [1285, 1286]}

Errors

POST /errors

FieldRequiredDescription
messageYesError message. The first 500 characters are stored for the overview.
urlNoThe page where the error occurred.
statusNoHTTP response code, for example 500.
traceNoTrace as text. The first 20,000 characters are stored.
user, user_signatureNoSigned user identifier, see user identity.
occurred_atNoTime of the occurrence. Without it, the time of receipt is used.

Identical errors are added up into one record with the number of occurrences and the time of the first and last occurrence. Grouping is by source, code, message and page, not by trace. When an error marked as resolved appears again, it returns with the status Appeared again.

curl
curl -X POST https://www.lunaboard.com/api/v1/errors \ -H "Authorization: Bearer luna_VAS_KLIC" \ -H "Content-Type: application/json" \ -d '{ "message": "SQLSTATE[23000]: Integrity constraint violation", "url": "/kosik/odeslat", "status": 500, "trace": "#0 app/Http/Controllers/CartController.php(88): ..." }'

Feedback

POST /feedback always accepts one message.

FieldRequiredDescription
kindYesbroken, missing, idea or praise.
textYesText of the message, at most 5,000 characters.
urlNoThe page to which the message relates.
emailNoEmail for a reply.
user, user_signatureNoSigned user identifier.
screenshotNoScreenshot as a data URL (PNG, JPEG or WebP) up to 1,500 kB.
curl
curl -X POST https://www.lunaboard.com/api/v1/feedback \ -H "Authorization: Bearer luna_VAS_KLIC" \ -H "Content-Type: application/json" \ -d '{ "kind": "broken", "text": "Po kliknutí na Odeslat objednávku se nic nestane.", "url": "/kosik", "email": "[email protected]" }'

Server-side requests

POST /hits accepts requests that your server handled. It is the only way to measure AI bots. The fields, samples and the recommended procedure are in the section Server side and AI bots.

Response codes

CodeMeaning
201Stored. The response carries id; for a batch, accepted and ids.
202Server-side requests accepted. The response carries totals.
401The key is missing, unknown or revoked.
422Invalid data. The response states the fields that did not pass.
429Limit exceeded. The Retry-After header says after how many seconds to try again.

Limits

  • 600 requests per minute for one API key.
  • At most 500 items in one batch.
  • Do not place the API call in the path of a visitor request. Send it from a queue or with a short timeout, so that an outage of Lunaboard does not slow down your website.