|
1
|
# Medusa API Reference |
|
2
|
|
|
3
|
The Medusa API Reference website is built with Next.js 13. You can learn more about contributing [here](https://docs.medusajs.com/resources/contribution-guidelines/docs). |
|
4
|
|
|
5
|
## Note About OpenAPI Specs |
|
6
|
|
|
7
|
The OpenAPI Specs under the directory `specs` are automatically generated by our OAS CLI tool. So, contributions should be made in the files under `packages/medusa/src/api` instead of directly making changes to the generated spec files. |
|
8
|
|
|
9
|
## URL Structure |
|
10
|
|
|
11
|
The reference uses real page paths (not hash anchors): |
|
12
|
|
|
13
|
- Area introduction: `/api/{area}` (e.g. `/api/store`) |
|
14
|
- Intro section: `/api/{area}/{section}` (e.g. `/api/store/authentication`) |
|
15
|
- Tag: `/api/{area}/{tag}` (e.g. `/api/store/carts`) |
|
16
|
- Operation: `/api/{area}/{tag}/{operation}` (e.g. `/api/store/carts/get-a-cart`) |
|
17
|
- Tag schema: `/api/{area}/{tag}/schema` |
|
18
|
|
|
19
|
Paths are computed by shared helpers in `packages/docs-utils` (`getApiRefTagSlug`, |
|
20
|
`getApiRefOperationSlug`, `getApiRefPath`) and materialized into |
|
21
|
`generated/api-ref-paths.mjs` by `scripts/prepare.mjs` (`yarn prep`). That file |
|
22
|
also holds `apiRefRedirects`, an old-hash → new-path map used by the client-side |
|
23
|
`HashRedirector` (mounted on the area index) to redirect legacy `#`-anchor links. |
|
24
|
|
|
25
|
The operation slug is derived from the operation's `x-sidebar-summary` (falling |
|
26
|
back to `summary`, then `operationId`). Because it's summary-derived, editing a |
|
27
|
summary can change the operation's URL. The redirect map is regenerated on every |
|
28
|
build to absorb such changes; set `x-sidebar-summary` on an operation to pin a |
|
29
|
stable slug. Slugs are de-duplicated within a tag (`-2`, `-3`, ...). |
|
30
|
|