Introduction
The Medusa API is a RESTful API that provides programmatic access to your commerce backend. It consists of two main sections:- Admin API: For managing your store’s products, orders, customers, and other resources
- Store API: For building storefronts and customer-facing applications
Base URLs
The API is accessible through the following base URLs:Replace
localhost:9000 with your Medusa backend URL in production.Request Format
All API requests should include the following headers:Request Body
For POST, PUT, and PATCH requests, the request body should be formatted as JSON:Query Parameters
Most list endpoints support the following query parameters:Comma-separated list of fields to include in the response. Use dot notation for nested fields (e.g.,
id,title,variants.sku).Maximum number of items to return.
Number of items to skip before starting to return results.
Sort order for results (e.g.,
created_at or -created_at for descending).Response Format
All API responses are returned in JSON format with a consistent structure.Successful Response
Single resource responses:Total number of items matching the query.
Number of items skipped.
Maximum number of items returned.
Error Response
When an error occurs, the API returns an error response:The error type. Common types include:
not_found- Resource not foundinvalid_data- Invalid request datanot_allowed- Operation not permittedunauthorized- Authentication required
Human-readable error message.
HTTP Status Codes
The API uses standard HTTP status codes:| Status Code | Description |
|---|---|
| 200 | Success |
| 201 | Resource created |
| 400 | Bad request - Invalid parameters |
| 401 | Unauthorized - Authentication required |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not found - Resource doesn’t exist |
| 409 | Conflict - Resource already exists |
| 500 | Internal server error |
Filtering and Search
Many list endpoints support filtering using query parameters:Field Selection
Use thefields parameter to optimize responses by requesting only needed fields:
Rate Limiting
Rate limits may apply depending on your Medusa deployment configuration. When rate limited, the API returns a429 Too Many Requests status code.
Next Steps
Authentication
Learn how to authenticate API requests
Admin API
Explore the Admin API endpoints
Store API
Explore the Store API endpoints