OpenAPI & conventions
This page is the contract. It covers what a machine-readable spec does and does not exist for today, and the conventions every MyShopie endpoint follows — so an integration can be written once and survive releases rather than being rebuilt each time something ships.
Plans: All plans
The state of the spec
Section titled “The state of the spec”An OpenAPI document is generated inside the application and served at the tenant’s /api/documentation. It
is internal: it covers the endpoints as annotated, it moves with the code, and it is not published as a
stable artifact you should generate a client from.
What that means in practice:
| You want | Do this today |
|---|---|
| An endpoint list | Storefront API and Admin API |
| Auth details | Authentication |
| Limits, errors, gating | API overview |
| A typed client | Hand-write the handful of calls you need |
| An agent that drives the store | The hosted MCP endpoint — see AI agents (MCP) |
Conventions
Section titled “Conventions”Requests
Section titled “Requests”Accept: application/jsonon every call. Without it, errors can come back as HTML.Authorization: Bearer <token>for anything not public.X-Guest-Tokenon cart and checkout calls for a shopper with no account.- Bodies may be form-encoded or JSON. JSON is clearer for nested payloads.
- HTTPS only.
Responses
Section titled “Responses”Every endpoint answers in the same envelope — success, message, data — described on
API overview. Two rules follow from it:
- Branch on the HTTP status, not on
message. Message text is human-facing and may be reworded or translated. - Ignore fields you do not recognize. Responses gain fields; a strict schema validator will break on a release that did nothing wrong.
Pagination
Section titled “Pagination”List endpoints return the collection together with Laravel’s pagination metadata — current page, per page,
total, and links. Follow the links rather than building page URLs, and do not assume a default page size.
Filtering and sorting
Section titled “Filtering and sorting”List endpoints accept query parameters for the filters the equivalent admin screen offers — status, date range, search term, category, location. An unrecognized parameter is ignored rather than erroring, so a typo silently returns the unfiltered list. Check a result count you did not expect before trusting a filter.
Validation errors
Section titled “Validation errors”A 422 carries errors keyed by field name, in Laravel’s standard shape:
{ "success": false, "message": "The given data was invalid.", "errors": { "price": ["The price field is required."] }}Surface these per field. The keys are stable; the sentences are not.
Idempotency
Section titled “Idempotency”Some writes are guarded so a retry cannot double-apply — POS refunds and exchanges most importantly. Elsewhere, treat a timeout as unknown, not failed: read the record back before retrying, or you risk a second order, a second refund or a duplicated stock movement.
Dates, money and locale
Section titled “Dates, money and locale”| Thing | Convention |
|---|---|
| Timestamps | ISO 8601, UTC. Convert for display using the store’s timezone from GET /store/config |
| Money | Minor units — cents — as integers wherever a value is stored. Never parse a formatted string |
| Currency | From store config, and per market under GET /markets |
| Translated content | Per-locale; the store’s locales come from store config |
Reading currency, locale and timezone from store config rather than hard-coding them is what lets one integration serve several stores.
Keeping an integration working
Section titled “Keeping an integration working”-
Read
GET /store/configon start-up and cache it briefly. Render fromcapabilitiesrather than assuming a feature exists. -
Authenticate with a scoped
msh_key, not a person’s login, so staff changes cannot break you. -
Handle 429 by honouring
Retry-After, and 503 as “the public store is in maintenance” rather than as an outage. -
Treat 403 as a missing app, plan or scope, and surface it as such — it is almost never a bug in your code.
-
Log the
messagefor humans, branch on the status for code, and ignore unknown response fields.
Common problems
Section titled “Common problems”My generated client 404s on half its methods. It was generated from the internal spec, which includes endpoints gated off for your store or still in motion. Call only what these pages document.
A strict JSON schema check started failing. A response gained a field. Loosen the validator.
A filter returns everything. The parameter name was wrong and was ignored. Compare the count against an unfiltered call.
Prices are out by a factor of a hundred. Money is in minor units. Divide once, at the display edge.
Times are hours off. Timestamps are UTC. Convert with the store’s timezone from store config.
A retried write created a duplicate. Only some endpoints are idempotent. Read back before retrying.
Is there a public OpenAPI file I can generate a client from?
Not yet. An L5-Swagger spec is generated inside the application and served at the tenant’s
/api/documentation for internal use, but it is not published as a stable public artifact. Until it is,
these guides are the contract summary — generating a client from an unpublished spec risks baking in
endpoints that are still moving.
How is pagination represented?
List endpoints return the collection with Laravel’s standard pagination metadata — current page, per page,
total and links — inside the data object. Follow the supplied links rather than constructing page URLs
yourself.
How do I make a write safe to retry? Some endpoints, notably POS refunds and exchanges, carry an idempotency guard so a retry after a dropped connection cannot double-apply. For everything else, read back before retrying a write, and treat a timeout as unknown rather than failed.
How will I know when the API changes? Additions are made without breaking existing behaviour: new fields appear on responses and new flags appear in the store capabilities list. Removals and renames would be announced in advance. So write clients that ignore unknown fields rather than validating strictly against today’s shape.
