Skip to content

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

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)
  • Accept: application/json on every call. Without it, errors can come back as HTML.
  • Authorization: Bearer <token> for anything not public.
  • X-Guest-Token on 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.

Every endpoint answers in the same envelope — success, message, data — described on API overview. Two rules follow from it:

  1. Branch on the HTTP status, not on message. Message text is human-facing and may be reworded or translated.
  2. Ignore fields you do not recognize. Responses gain fields; a strict schema validator will break on a release that did nothing wrong.

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.

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.

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.

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.

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.

  1. Read GET /store/config on start-up and cache it briefly. Render from capabilities rather than assuming a feature exists.

  2. Authenticate with a scoped msh_ key, not a person’s login, so staff changes cannot break you.

  3. Handle 429 by honouring Retry-After, and 503 as “the public store is in maintenance” rather than as an outage.

  4. Treat 403 as a missing app, plan or scope, and surface it as such — it is almost never a bug in your code.

  5. Log the message for humans, branch on the status for code, and ignore unknown response fields.

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.