Skip to content

Changelog and compatibility

The API contract lives in one file, openapi.yaml: the reference is built from it, and the server is tested against it. The current contract version is 0.2.15, stated in the info.version field.

Version in the path. All paths start with /v1. As long as the path starts with /v1, the contract only changes by addition:

  • new fields in responses and webhook bodies;
  • new enum values: statuses, reasons (reason), change kinds (kind), metrics;
  • new error codes in the code field;
  • new webhook types;
  • new operations and optional request parameters.

What counts as incompatible. Removing or renaming a field, changing its type or meaning, making something required that was optional in a request, removing an enum value, changing a response’s HTTP status. Such a change ships only in a new path version, /v2. After that the old version keeps working until all clients have moved to the new one.

What your code needs so that additions don’t break it:

  • Skip unknown fields. Don’t turn on a strict JSON parser mode that fails on extra fields.
  • Handle unknown values. In a switch on status, reason, kind and the webhook type, keep a default branch: log it and move on.
  • Answer a webhook of an unknown type with 2xx and do nothing. Otherwise we’ll keep retrying it for a day.
  • Tell errors apart by code, not by the detail text and not by type: the text may change.

Contract version number. info.version grows with every change of the contract, even if only a description changed. It’s a handy way to check which version you read.

How we announce changes. Every new version lands on this page. We announce them a week in advance in our Telegram channel and by email newsletter. The test environment runs 1–2 versions ahead of production, so you can try a new version in test before it reaches live.

Dates are when the contract version reached the main branch.

  • New test environment address: https://test-api.zirva.xyz. The old https://test-api.dnk.az still works for now, but switch to the new one. Fields and behaviour are unchanged.
  • New product name, Zirva: the contract title is now Zirva API, and descriptions mention Zirva. Fields, addresses and behaviour are unchanged.
  • Webhook address requirements: https://, a public host, all IP addresses of the name checked on every attempt, IPv6 only from 2000::/3, a certificate for the address name, no redirects followed.
  • webhook-timestamp is the moment of the particular attempt: each retry is signed anew, so it passes the “no older than 5 minutes” check. timestamp in the body is the same in all retries.
  • The exact retry schedule: 5 seconds, 1, 5 and 30 minutes, 1, 2, 4 and 8 hours, and a last attempt 24 hours after the first. At your request, our operator sends an undelivered message again, with the same webhook-id and body.
  • Webhook response: answer 2xx within 10 seconds; we give the whole attempt 15 seconds.
  • An accepted webhook may occasionally come again: drop duplicates by webhook-id.
  • scenario.completed gets a new required field completion_cap: a completion beyond the “first N” cap, without a discount or badges (R8).
  • version in scenario.completed is the completion’s version at the moment it appeared, the same in all retries; timestamp is the moment of recording.
  • Described from which moment webhooks are sent: about what was recorded after the address was set or re-enabled.
  • Users: POST /v1/users can be retried, PATCH follows JSON Merge Patch, DELETE stops using the user, and their discounts stay as they were (U5).
  • The status of a new user without events is 200 with the available scenarios in not_started.
  • Checkout: a timeout of no more than 30 seconds, two release calls after a failed reserve, a 3-second write window, 503 with Retry-After when the user is busy.
  • The reserved → expired transition: the reservation ended and the reward’s validity had already passed (R4).
  • GET /v1/events/{event_id} shows changes of completions, rewards and badges at the event that caused them, and for a rollback, the progress right after it (E9).
  • A new change kind reward_withheld: there will be no discount for the completion (no_budget or completion_cap).
  • An operator can annul a reward (R9); the cancellation reason is in the new cancel_reason field.
  • Activation of a new scenario version (W6): completed_at can be the activation moment, and a past event’s row isn’t rewritten.
  • Languages: the client enables languages from az, ru and en; the response language is chosen by Accept-Language (RFC 9110) and named in Content-Language.
  • changes of an ignored event can hold progress of versions in shadow.
  • Described current and target of progress, including for a level ladder; the applies_to format.
  • Clarifications: unknown_type is judged by this mode’s vocabulary as of the event; currency is checked only if the type describes currency; the meaning of processed_at; a deleted user’s events are no longer recalculated.
  • A new reason refunded: the event is excluded by a rollback and counts again after a rollback reversal (V2, V7).
  • Every operation with a body can answer 413 and 415.
  • The 201 answer to POST /v1/users has no Location header.
  • An applied rollback is processed with empty scenarios; one waiting for the original event is ignored with reason awaiting_original.
  • The widget token is signed with the whole secret string; kid is the secret id.
  • as_of of a user without events is the response time; the ETag follows the status.
  • A badge’s earned_at is the completion moment, not the processing time.
  • reservation is filled only while the reward is reserved.
  • The control group is set per scenario; the group field is the result over the active scenarios (U2, C2).
  • Scenarios with an object: object_ref, applies_to_ref (O1).
  • A completion has an id and a version; an available reward can return to pending (F3).
  • Linking rollbacks to original events and rollback reversals (V1–V7), the daily limit, versions in shadow.
  • New reasons missing_field and value_used, the distinct_values metric; order_id can be an integer.
  • Removed: the budget_exhausted flag. An exhausted budget now only hides the scenario (R6).
  • The first version of the contract: events, users, status, rewards, badges, widget, webhooks.