Skip to content

API contracts

The contracts on this site are the source of truth for what Sedra supports publicly. They are built by a pipeline, never edited by hand after generation, and nothing is published automatically.

API Source
Merchant Agent API Generated by the backend from its capability registry (/foulad/openapi), then filtered
Storefront API The official Medusa 2.23.1 Store OpenAPI, reduced to a reviewed list of operations, plus Sedra store extensions
Sedra App API, Device API Written by hand from the backend routes, then contract-tested against the live API
  1. Sync (npm run sync:specs): fetch the live agent contract, remove human-only capabilities, keep only operations in specs/allowlist.json, collect the Medusa schemas the allowed operations use, and merge the shared Sedra error model.
  2. Hold back: any new backend operation that is not in the allowlist is excluded and listed in specs/sync-report.json. A person adds it to the allowlist in a reviewed pull request.
  3. Lint: Redocly validates every contract (OpenAPI 3.1 structure, resolvable references, security defined on every operation).
  4. Safety tests: no admin, developer-login, backup or internal paths; no human-only capabilities; no credential-like strings; every operation declares security; every write requires an idempotency key.
  5. Contract tests against the live development API: published operations still exist, documented errors and status codes match, tenant-scoped endpoints behave as documented.
  6. Breaking-change check: oasdiff compares each contract with the last published version. Breaking changes fail CI unless the pull request is labelled as an intentional breaking change and the changelog explains it.
  7. Publish: the site build ships the contracts as JSON and YAML downloads and in the interactive reference.
  • Each contract has its own info.version. The Storefront version follows the Medusa release it is based on.
  • Additive changes (new optional fields, new operations) are minor. Removals, new required inputs and changed types are breaking.
  • Deprecated operations stay for at least 90 days with deprecated: true and a changelog entry.

Platform administration (/admin), developer sign-in, backups, internal jobs, payment provider webhooks, human-only capabilities and anything not in the allowlist.