# API reference
Every Crate API resource you can use at launch, its endpoints, and the permission each one needs.
The Crate API is a JSON REST API. This page lists each resource, its endpoints, and the permission group an API key needs to use it.
## Basics
- **Base path:** `https://<crate-address>/api/v1`, where `<crate-address>` is the address you sign in at.
- **Authentication:** `Authorization: Bearer <api key>`. See [Authentication](/docs/developers/authentication).
- **Format:** JSON in and out. Each response wraps the data in a key named after the resource, such as `{ "product": {…} }` or `{ "products": […] }`.
- **Lists:** paged with `limit` and the `Link` header. See [Pagination](/docs/developers/pagination).
- **Limits:** 120 requests a minute for each key. See [Rate limits](/docs/developers/rate-limits).
- **Errors:** an `errors` key with a message. See [Errors](/docs/developers/errors).
A `GET` needs the group's **Read** permission. `POST`, `PATCH`, `PUT` and `DELETE` need **Write**.
## Account
| Endpoint | Permission | What it does |
| --- | --- | --- |
| `GET /account` | Any valid key | The store and the key's own details. |
| `GET /me` | Any valid key | The same answer as `/account`. |
## Products
| Endpoint | Permission |
| --- | --- |
| `GET /products`, `GET /products/:id` | Products: Read |
| `POST /products`, `PATCH /products/:id`, `DELETE /products/:id` | Products: Write |
| `GET /products/:product_id/variants`, `GET /products/:product_id/variants/:id` | Products: Read |
| `POST`, `PATCH`, `DELETE` on `/products/:product_id/variants` | Products: Write |
| `GET /collections`, `GET /collections/:id` | Products: Read |
| `POST /collections`, `PATCH /collections/:id`, `DELETE /collections/:id` | Products: Write |
`GET /products` accepts `status`, `product_type` and `q` (a name search). Deleting a product archives it.
## Orders
| Endpoint | Permission |
| --- | --- |
| `GET /orders`, `GET /orders/:id` | Orders: Read |
| `PATCH /orders/:id` | Orders: Write |
| `POST /orders/:id/cancel` | Orders: Write |
| `GET /abandoned_carts`, `GET /abandoned_carts/:id` | Orders: Read |
- `:id` can be the order number, such as `R123456789`, or its numeric id.
- `GET /orders` accepts `state` and `payment_state` filters.
- `PATCH /orders/:id` can change `email` and `special_instructions` only.
- `POST /orders/:id/cancel` accepts an optional `reason` and `restock` (`true` puts the items back in stock).
## Customers
| Endpoint | Permission |
| --- | --- |
| `GET /customers`, `GET /customers/:id` | Customers: Read |
| `POST /customers`, `PATCH /customers/:id`, `DELETE /customers/:id` | Customers: Write |
| `GET /customer_groups`, `GET /customer_groups/:id` | Customers: Read |
| `POST`, `PATCH`, `DELETE` on `/customer_groups` | Customers: Write |
`GET /customers` accepts an `email` filter. You can set `email`, `first_name`, `last_name` and `phone`.
## Discounts
| Endpoint | Permission |
| --- | --- |
| `GET /discounts`, `GET /discounts/:id` | Discounts: Read |
| `POST`, `PATCH`, `DELETE` on `/discounts` | Discounts: Write |
| `GET /coupons`, `GET /coupons/:id` | Discounts: Read |
| `POST`, `PATCH`, `DELETE` on `/coupons` | Discounts: Write |
Coupons are discounts that buyers unlock with a code.
## Marketing
| Endpoint | Permission |
| --- | --- |
| `GET /campaigns`, `GET /campaigns/:id` | Marketing: Read |
| `POST`, `PATCH`, `DELETE` on `/campaigns` | Marketing: Write |
| `GET /automations`, `GET /automations/:id` | Marketing: Read |
| `POST`, `PATCH`, `DELETE` on `/automations` | Marketing: Write |
## Analytics
| Endpoint | Permission | What it does |
| --- | --- | --- |
| `GET /analytics` | Analytics: Read | Sales figures for a date range, using the same numbers as the **Analytics** page. |
## Subscriptions
| Endpoint | Permission |
| --- | --- |
| `GET /subscriptions`, `GET /subscriptions/:id` | Subscriptions: Read |
| `PATCH /subscriptions/:id` | Subscriptions: Write |
| `GET /subscription_plans`, `GET /subscription_plans/:id` | Subscriptions: Read |
| `POST`, `PATCH`, `DELETE` on `/subscription_plans` | Subscriptions: Write |
`PATCH /subscriptions/:id` changes the `status` only, for example to pause, cancel or resume.
## License keys
The license keys endpoints use the **Licenses** group. [License keys API](/docs/developers/license-keys) covers each call.
## Webhooks
| Endpoint | Permission |
| --- | --- |
| `GET /webhooks`, `GET /webhooks/:id` | Apps: Read |
| `POST /webhooks`, `PATCH /webhooks/:id`, `DELETE /webhooks/:id` | Apps: Write |
You can set `url`, `active` and `topics`. Endpoints you add here also appear on the **Webhooks** page in Settings. See [Webhooks](/docs/developers/webhooks-overview).
> [!NOTE]
> The API has other endpoints for features that aren't available to every store at launch. They aren't listed here and may change.
