Spektakular API v1.0.0

Download openapi.json openapi.json

Spektakular integration API: connect your applications (management, accounting, website, ticketing, warehouse…) with your profiles on Spektakular. Every call is HTTPS and JSON. Method, parameter and code names are in English; this documentation can be read in any language.

Authentication

Every call carries an API key in the «Authorization: Bearer <key>» header (or «X-Api-Key: <key>»). Spektakular administration generates the keys: each one belongs to a user and to ONE of their profiles, and only allows the methods of that profile type the user has enabled. Keep it like a password: it is only shown once. If it is compromised, ask for it to be revoked.

curl -X POST https://api.spektakular.horion.cloud/v1/me.get \
  -H "Authorization: Bearer spk_test_xxxxxxxxxxxx_…" \
  -H "Content-Type: application/json" \
  -d '{}'

Live and test zones

Keys starting with «spk_live_» work with live data; keys starting with «spk_test_» work with the test database, where you can try your integration safely. The address is the same: the key decides the zone. Every response states its zone in «meta.zone».

Responses

Every response is JSON with «ok» (true or false). On success the data is in «data»; otherwise «error» holds a stable code («code»), a message and sometimes «details». The HTTP status goes with the error (401, 403, 404, 422, 429, 503…). «meta.request_id» identifies the request: include it if you contact us.

{"ok": true, "data": {…}, "meta": {"request_id": "…", "zone": "live", "api_version": "1"}}
{"ok": false, "error": {"code": "rate_limited", "message": "…"}, "meta": {…}}

Rate limits

Per key: 60 calls per minute and 2000 per hour (each method in a batch request counts). Batch requests: 5 per hour with up to 20 methods each. Per IP: 120 requests per minute; after 20 authentication failures the IP is blocked for 15 minutes. Maximum body: 256 KB; maximum time per call: 10 s.
When a limit is exceeded the response is 429 with the «Retry-After» header (seconds to wait). The «X-RateLimit-Limit», «X-RateLimit-Remaining» and «X-RateLimit-Reset» headers show your hourly quota. Recommended: retry with increasing back-off and group calls into batch requests.

Batch request

Call several methods in a single request: POST /v1/batch with {"requests": [{"id": "…", "method": "…", "params": {…}}, …]}. Up to 20 methods per request and 5 batch requests per hour. Each method is resolved independently: the response returns, in the same order, {"id", "ok", "data" | "error"} for each one, and a failure in one does not affect the others.

curl -X POST https://api.spektakular.horion.cloud/v1/batch \
  -H "Authorization: Bearer spk_live_xxxxxxxxxxxx_…" \
  -H "Content-Type: application/json" \
  -d '{"requests": [
        {"id": "me", "method": "me.get"},
        {"id": "ping", "method": "system.ping"}
      ]}'

Methods

POST /v1/me.get

Who am I: user, profile and permissions of the key

Returns the user and profile you connect as, the methods you can use with this key and your limits. It is the recommended first call to check a key.

Profile types: Individual, Professional, Agent, Client, Supplier · Key required: Yes

Parameters

None.

Result (data)

FieldTypeDescription
userobjectUser who owns the key.
profileobjectProfile the key connects as.
keyobjectKey used (without the secret).
methodsarrayMethods this key can use.
limitsobjectRate limits in force.
base_urlstringBase address of the methods.

GET · POST /v1/system.ping

Check that the API is up

No key needed. Use it to check the connection and the server time.

Profile types: Public (no key) · Key required: No

Parameters

None.

Result (data)

FieldTypeDescription
pong *booleanAlways true.
time *string · date-timeServer time.
api_versionstringAPI version.

Error codes

codeHTTPDescription
invalid_request400The request is not valid (structure, identifiers…).
invalid_json400The body is not a valid JSON object.
invalid_params422Parameters are missing or not valid; «details.errors» says which.
payload_too_large413The body exceeds the maximum size.
unauthorized401The API key is missing.
invalid_key401The key is not valid.
key_revoked401The key has been revoked.
key_expired401The key has expired.
ip_not_allowed403The key cannot be used from this IP.
user_inactive403The user account is not active.
user_blocked403The user account is blocked.
user_locked403The account is temporarily locked after failed sign-in attempts.
api_access_denied403The user has no API access.
profile_not_found403The key’s profile does not exist.
profile_inactive403The key’s profile is not active.
method_not_found404The method does not exist.
method_not_allowed403This key cannot use this method.
http_method_not_allowed405HTTP verb not allowed on this address.
not_found404The address does not exist.
rate_limited429Too many requests: wait as indicated by «Retry-After».
batch_limit429The batch request limit for this hour has been reached.
too_many_failures429Too many authentication failures from this IP: it is temporarily blocked.
timeout504The request was taking too long and was stopped.
test_zone_unavailable503The test zone is not available right now.
service_unavailable503The API is temporarily unavailable (maintenance or overload): retry later.
internal_error500Internal error: it has been logged.