ocapi-shop Categories API
Categories group products on the storefront. Products refer to their category by name, so renaming a category renames it on its products.
Categories group products on the storefront. Products refer to their category by name, so renaming a category renames it on its products.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/ocapi-shop:ocapi-shop-categories-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Ocapi Categories API
version: '1'
description: 'Manage Ocapi stores from your own code: the catalog, categories, orders, images, the storefront''s
design and the store''s settings. It is the same API the Ocapi CLI, the iOS and Android apps and
the MCP server use.
Changes go live on the storefront as soon as a request succeeds. To prepare products before
shoppers see them, create them with `hidden: true` and publish them later. The storefront''s
design is the exception: changes to it go to a draft, which Publish storefront makes live.
## Authentication
The API uses OAuth 2.1 with the authorization code flow and PKCE. Discovery metadata is at
`/.well-known/oauth-authorization-server`, clients
register themselves at `/oauth/register`, and tokens come from `/oauth/token`.
Send the access token on every request:
```http
Authorization: Bearer
```
Access tokens last one hour; use the refresh token to get a new one. A token carries one or
both scopes:
- **`read`** allows `GET` requests.
- **`write`** allows everything else: creating, updating, reordering and deleting.
A request beyond the token''s scope gets `403 insufficient_scope`.
## Conventions
- **IDs** are prefixed by type: `str_` stores, `prd_` products, `cat_` categories, `ord_` orders,
`col_` collections, `pag_` pages, `lnk_` links, `dom_` domains, `usr_` users, `inv_` invitations, `whk_` webhooks.
- **Prices** are plain numbers in the store''s currency (`currency` on the store), not cents.
- **Timestamps** are ISO 8601 in UTC.
- **Lists** return `{ "data": [...], "next_page": 2 }`. Pass `page` and `per_page` (up to 100,
default 50); `next_page` is `null` on the last page.
- **Updates** with `PATCH` change only the fields you send.
## Errors
Every error has the same shape:
```json
{
"error": {
"code": "invalid",
"message": "Name can''t be blank",
"details": { "name": ["can''t be blank"] }
}
}
```
| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `bad_request` | The body is malformed or a required parameter is missing |
| 401 | `unauthorized` | The token is missing, invalid or expired |
| 403 | `insufficient_scope` | The token can only read |
| 402 | `plan_limit_reached` | The change would add more than the store''s plan allows (products, images per product or shoppable videos); `details` has `limit`, `plan`, `allowed`, `used`, `upgrade_plan` and `upgrade_url`, where the owner upgrades (both left out when no plan allows more) |
| 404 | `not_found` | The resource doesn''t exist or belongs to a store you can''t reach |
| 422 | `invalid` | Validation failed; `details` maps each field to its messages, with dotted keys for nested fields (`items.0.quantity`) |
| 426 | `upgrade_required` | An Ocapi app build is too old; `details` has `min_version` and `update_url` |
| 429 | `rate_limited` | Over 300 requests in a minute for one sign-in; retry after a minute |
| 503 | `unavailable` | Uploads or image imports are temporarily unavailable |
`message` is written to be shown to people as is.
Plan limits only stop additions: a store over a limit after moving to a smaller plan keeps its
products, images and videos, and can still edit or remove them. During the free trial a store has
the Pro plan''s limits.'
servers:
- url: https://dashboard.ocapi.shop
security:
- bearer: []
tags:
- name: Categories
description: 'Categories group products on the storefront. Products refer to their category by name, so
renaming a category renames it on its products.'
paths:
/api/v1/stores/{store_id}/categories:
parameters:
- $ref: '#/components/parameters/StoreId'
get:
operationId: listCategories
tags:
- Categories
summary: List categories
description: All of the store's categories in storefront order, with how many products each has.
responses:
'200':
description: The store's categories
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: array
items:
$ref: '#/components/schemas/Category'
post:
operationId: createCategory
tags:
- Categories
summary: Create a category
requestBody:
$ref: '#/components/requestBodies/CategoryInput'
responses:
'201':
description: The new category
content:
application/json:
schema:
$ref: '#/components/schemas/Category'
'422':
$ref: '#/components/responses/Invalid'
/api/v1/stores/{store_id}/categories/{category_id}:
parameters:
- $ref: '#/components/parameters/StoreId'
- name: category_id
in: path
required: true
schema:
type: string
pattern: ^cat_[0-9a-z]{26}$
description: The category's ID
example: cat_01k70000000000000000000001
patch:
operationId: updateCategory
tags:
- Categories
summary: Update a category
description: Rename or hide a category. Renaming it also renames it on its products.
requestBody:
$ref: '#/components/requestBodies/CategoryInput'
responses:
'200':
description: The updated category
content:
application/json:
schema:
$ref: '#/components/schemas/Category'
delete:
operationId: deleteCategory
tags:
- Categories
summary: Delete a category
description: Deletes the category. Its products stay in the catalog without a category.
responses:
'204':
description: The category was deleted
/api/v1/stores/{store_id}/categories/positions:
parameters:
- $ref: '#/components/parameters/StoreId'
put:
operationId: reorderCategories
tags:
- Categories
summary: Reorder categories
description: Set the order categories appear in on the storefront.
requestBody:
$ref: '#/components/requestBodies/Ids'
responses:
'204':
description: The categories were reordered
'422':
$ref: '#/components/responses/Invalid'
components:
schemas:
CategoryCampaign:
type:
- object
- 'null'
description: A campaign card shown among the category's products on its listing. Kept only with an image; an object replaces the whole card, null removes it
properties:
image_url:
type: string
description: HTTPS image URL from an upload or image import
title:
type:
- string
- 'null'
maxLength: 60
text:
type:
- string
- 'null'
maxLength: 240
url:
type:
- string
- 'null'
description: 'Where the card leads: a storefront path (/pages/sale) or a web URL'
Category:
type: object
required:
- id
- name
- hidden
- position
- parent_id
- products_count
properties:
id:
type: string
examples:
- cat_01k70000000000000000000001
name:
type: string
hidden:
type: boolean
description: Whether the category is hidden from the storefront
position:
type:
- integer
- 'null'
description: Place in the storefront order
parent_id:
type:
- string
- 'null'
description: The category this one sits inside (Women for Women › Pants); null at the top level
size_guide_page_id:
type:
- string
- 'null'
description: The page shown as the size guide on this category's product pages; null for the store's
tax_rate:
type:
- number
- 'null'
description: Tax rate in percent for its products without their own; null uses the parent's or the store's
description:
type:
- string
- 'null'
description: Shown under the category's title on its storefront listing
campaign:
$ref: '#/components/schemas/CategoryCampaign'
products_count:
type: integer
Error:
type: object
description: The body of every error response
required:
- error
properties:
error:
type: object
required:
- code
- message
properties:
code:
type: string
description: unauthorized, insufficient_scope, not_found, invalid, bad_request, rate_limited, unavailable, upgrade_required or plan_limit_reached
message:
type: string
description: Readable by people and models
details:
type: object
description: 'Field errors ({ field: [messages] }), min_version and update_url for upgrade_required, or for plan_limit_reached limit (products, images_per_product, videos or social_posts_per_day), plan (basic is Starter, plus is Pro), allowed, used, upgrade_plan and upgrade_url (both left out when no plan allows more)'
responses:
Invalid:
description: Validation failed; details lists the problems by field
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
requestBodies:
Ids:
required: true
content:
application/json:
schema:
type: object
required:
- ids
properties:
ids:
type: array
uniqueItems: true
items:
type: string
description: IDs in the order they should appear, first to last; each must belong to the store. [] clears the order
CategoryInput:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
minLength: 1
maxLength: 50
description: Category name shown on the storefront, unique in the store
hidden:
type: boolean
description: true hides the category from the storefront
parent_id:
type:
- string
- 'null'
description: Puts the category inside another (cat_...), up to three levels deep, so the storefront shows Women › Pants › Leggings and a parent's page lists its subcategories' products too; null moves it to the top level.
size_guide_page_id:
type:
- string
- 'null'
description: One of the store's pages (from the storefront's `pages`) shown as the size guide on this category's product pages and its subcategories' without their own, over the store's size guide; null removes it.
tax_rate:
type:
- number
- 'null'
minimum: 0
maximum: 100
description: The tax rate in percent for this category's products and its subcategories' without their own, over the store's (checkout settings `taxes.rate`); 0 makes them exempt, null uses the parent's or the store's.
description:
type:
- string
- 'null'
maxLength: 2000
description: Shown under the category's title on its storefront listing (folded after a few lines) and as its search snippet; null removes it
campaign:
$ref: '#/components/schemas/CategoryCampaign'
parameters:
StoreId:
name: store_id
in: path
required: true
schema:
type: string
pattern: ^str_[0-9a-z]{26}$
description: The store's ID, from List stores
example: str_01k70000000000000000000001
securitySchemes:
bearer:
type: http
scheme: bearer
description: An OAuth access token. See Authentication above for how to get one.