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.
Sources
Section titled “Sources”| 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 |
Pipeline
Section titled “Pipeline”- Sync (
npm run sync:specs): fetch the live agent contract, remove human-only capabilities, keep only operations inspecs/allowlist.json, collect the Medusa schemas the allowed operations use, and merge the shared Sedra error model. - 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. - Lint: Redocly validates every contract (OpenAPI 3.1 structure, resolvable references, security defined on every operation).
- 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.
- Contract tests against the live development API: published operations still exist, documented errors and status codes match, tenant-scoped endpoints behave as documented.
- 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.
- Publish: the site build ships the contracts as JSON and YAML downloads and in the interactive reference.
Versioning
Section titled “Versioning”- 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: trueand a changelog entry.
What is never published
Section titled “What is never published”Platform administration (/admin), developer sign-in, backups, internal jobs, payment provider webhooks, human-only capabilities and anything not in the allowlist.