Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Ocapi Storefront 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: Storefront
description: 'The storefront''s design, as the dashboard''s store editor edits it: the look (colors, font,
corners), the announcement bar, the home (the profile page, or a brand home built from
blocks), the menu and footer, custom pages, how products are presented, and the store''s
links, collections and shoppable videos.
Changes go to the editor''s draft, the same one the dashboard editor shows, so the merchant
can review them there (`editor_url`) before Publish storefront makes them live.'
paths:
/api/v1/stores/{store_id}/storefront:
parameters:
- $ref: '#/components/parameters/StoreId'
get:
operationId: getStorefront
tags:
- Storefront
summary: Get the storefront design
description: 'The store editor''s form: the draft when there is one (`draft: true`), otherwise the published storefront. Hidden collections aren''t part of the editor and are left as they are.'
responses:
'200':
description: The storefront design
content:
application/json:
schema:
$ref: '#/components/schemas/Storefront'
'404':
$ref: '#/components/responses/NotFound'
patch:
operationId: updateStorefront
tags:
- Storefront
summary: Change the storefront design
description: 'Saves changes to the draft; the live storefront changes only on Publish storefront. Fields left
out keep their value. A list you send (`blocks`, `pages`, `links`, `collections`, `videos`,
`sections`) replaces the whole list, so send every item you want to keep; an object
(`colors`, `topbar`, `product_display`, `navigation`) changes only the keys you send.
Saved items keep their `id`. A new item has no id, or one you make up (`"new-sale"`) so that a
block''s `collection_id` or `product_display.upsell` can refer to a new collection; publishing
gives it its real id. Fields an item''s type doesn''t use are dropped, and the response shows
what was kept.
The change is refused if publishing would refuse it (a blank store name, a link without its
URL, a page with blocks but no title) or the store can''t take it (an unsafe link).'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/StorefrontInput'
responses:
'200':
description: The design with the draft
content:
application/json:
schema:
$ref: '#/components/schemas/Storefront'
'403':
$ref: '#/components/responses/Forbidden'
'422':
$ref: '#/components/responses/Invalid'
/api/v1/stores/{store_id}/storefront/publish:
parameters:
- $ref: '#/components/parameters/StoreId'
post:
operationId: publishStorefront
tags:
- Storefront
summary: Publish the storefront design
description: Makes the draft live, whoever wrote it (this API or the dashboard editor), and deletes it. Without a draft nothing changes.
responses:
'200':
description: The published design
content:
application/json:
schema:
$ref: '#/components/schemas/Storefront'
'402':
$ref: '#/components/responses/PlanLimitReached'
'403':
$ref: '#/components/responses/Forbidden'
'422':
$ref: '#/components/responses/Invalid'
/api/v1/stores/{store_id}/storefront/draft:
parameters:
- $ref: '#/components/parameters/StoreId'
delete:
operationId: discardStorefrontDraft
tags:
- Storefront
summary: Discard the storefront draft
description: Drops the unpublished changes, the dashboard editor's included. The live storefront stays as it is.
responses:
'204':
description: The draft is gone
'403':
$ref: '#/components/responses/Forbidden'
components:
responses:
Invalid:
description: Validation failed; details lists the problems by field
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: Not found, or in a store you can't reach
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Forbidden:
description: The token lacks the write scope
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
PlanLimitReached:
description: The store's plan allows no more of this; details.upgrade_url is where its owner upgrades
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
Storefront:
allOf:
- $ref: '#/components/schemas/StorefrontInput'
- type: object
required:
- draft
- draft_updated_at
- draft_error
- editor_url
- name
- description
- phone
- logo_url
- cover_url
- logo_shape
- font
- colors
- corners
- home_style
- topbar
- about_description
- about_media_url
- sections
- hidden_sections
- preview_product_ids
- product_display
- blocks
- navigation
- pages
- links
- collections
- videos
properties:
draft:
type: boolean
description: Whether there are unpublished changes; the other fields show them
draft_updated_at:
type:
- string
- 'null'
format: date-time
draft_error:
type:
- string
- 'null'
description: Why the draft can't be published as it is, if it can't
editor_url:
type: string
description: The dashboard's store editor, where the merchant sees the draft
StorefrontBlock:
type: object
required:
- type
description: 'One block of the brand home or a page. `type` decides which other fields it uses:
| type | fields |
| --- | --- |
| `hero` | `autoplay`, `items`: up to 5 slides (`image_url` required, `mobile_image_url`, `video_url`, `title`, `button_label`, `url`) |
| `products` | `title`, `source`, `collection_id` (with `source: collection`), `category` (a category name, with `source: category`), `autoplay` |
| `collections` | `title`; shows the store''s collections |
| `videos` | `title`; shows the shoppable videos |
| `tiles` | `title`, `items`: up to 6 (`image_url`, `title`, `subtitle`, `url`) |
| `banner` | `image_url`, `video_url`, `title`, `text`, `button_label`, `url`, `image_side`, `color` |
| `text` | `title`, `text` (Markdown), `image_url` |
| `logos` | `title`, `items`: up to 24 (`image_url` required, `url`) |
| `newsletter` | `title`, `text`, `button_label`: an email sign-up; List subscribers returns who signed up |
| `shelf` | `title`, `items`: up to 4 tabs (`label`, `source`, `collection_id`, `category`), each a row of products picked as a `products` block picks them |
| `split` | `items`: up to 2 pictures side by side (`image_url`, `title`, `text`, `button_label`, `url`) |
| `steps` | `title`, `text`, `items`: up to 6 numbered steps (`title`, `text`) |
| `mosaic` | `title`, `text`, `items`: up to 5 photos (`image_url` required, `url`); five make a collage, the first large |
| `cards` | `title`, `items`: up to 6 story cards (`image_url`, `title`, `text`, `button_label`, `url`) |
| `cta` | `title`, `text`, `button_label`, `url`, `color`: a colored strip without a picture |
| `table` | `title`, `text`, `unit` (`cm`, `in` or null), `rows`: up to 16 rows of up to 8 cells (strings of up to 30 characters), the first row the header; with a unit, shoppers switch between cm and inches (only the columns whose header names the unit, like `Chest (cm)`, when any does; else every column after the first). `|` is removed from cells. A size guide |
| `video_embed` | `title`, `text` (up to 240 characters), `embed_url`: a YouTube (`youtube.com/watch?v=`, `youtu.be/`, `/shorts/`, `/embed/`, `/live/`) or Vimeo video link, `image_url`: an optional cover. The storefront loads the youtube-nocookie.com or Vimeo player only when the shopper clicks the cover |
| `social_embed` | `title`, `embed_url`: an Instagram post or reel (`instagram.com/p/<code>/`, `/reel/<code>/`) or a TikTok video (`tiktok.com/@<account>/video/<id>`), `image_url`: an optional cover. The site''s embed loads only when the shopper clicks |
| `countdown` | `title`, `ends_at` (a date and time without a zone, read in the store''s time zone), `ended_text` (shown once it ends; without it the block hides then), `button_label`, `url`. Linked to a visible drop''s page (`/products/<id>`) without `ends_at`, it counts down to the drop''s `available_at` |
| `map` | `title`, `address`, `lat` and `lng`: the map shows when there''s a point; an address alone gets Google Maps and Waze directions links. With neither, the store''s first pickup location''s address |
Titles are cut at 80 characters, subtitles at 60, item texts at 240, texts at 1000 and button labels at 30.
'
properties:
type:
type: string
enum:
- hero
- products
- collections
- videos
- tiles
- banner
- text
- logos
- newsletter
- shelf
- split
- steps
- mosaic
- cards
- cta
- table
- video_embed
- social_embed
- countdown
- map
hidden:
type: boolean
description: Kept in the list but not shown
title:
type: string
text:
type: string
image_url:
type:
- string
- 'null'
description: HTTPS image URL from an upload or image import
url:
type:
- string
- 'null'
description: A storefront path (/products?category=Shirts, /pages/size-guide) or a web URL
button_label:
type: string
image_side:
type: string
enum:
- left
- right
description: Banner picture side
video_url:
type:
- string
- 'null'
description: A banner's mp4, mov or webm video, played muted on a loop over its picture
color:
type:
- string
- 'null'
description: 'Banner or call-to-action background, a hex color like #fef3c7'
source:
type: string
enum:
- featured
- newest
- sale
- collection
- category
description: Which products a products block shows
collection_id:
type:
- string
- 'null'
description: A collection's id, from `collections`
category:
type:
- string
- 'null'
description: A category name
autoplay:
type: boolean
description: Slides advance on their own
unit:
type:
- string
- 'null'
enum:
- cm
- in
- null
description: A table's unit of measure, for its cm/inch switch
rows:
type: array
description: A table's rows, each a list of cells; the first row heads the table
items:
type: array
items:
type: string
embed_url:
type:
- string
- 'null'
description: A video_embed's YouTube or Vimeo link, or a social_embed's Instagram or TikTok link, kept in its canonical form; other links are refused
ends_at:
type:
- string
- 'null'
description: A countdown's end, like 2026-12-24T18:00, in the store's time zone
ended_text:
type: string
description: A countdown's line once it ends, cut at 240 characters
address:
type: string
description: A map's address, cut at 200 characters
lat:
type:
- number
- 'null'
minimum: -90
maximum: 90
description: A map point's latitude, sent with lng
lng:
type:
- number
- 'null'
minimum: -180
maximum: 180
description: A map point's longitude, sent with lat
items:
type: array
items:
type: object
properties:
image_url:
type:
- string
- 'null'
description: HTTPS image URL from an upload or image import
mobile_image_url:
type:
- string
- 'null'
description: A hero slide's picture for phones; the image_url when left out
video_url:
type:
- string
- 'null'
description: A hero slide's mp4, mov or webm video, played muted on a loop over its picture
title:
type: string
subtitle:
type: string
text:
type: string
description: A split picture's
story card's or step's few words: null
button_label:
type: string
url:
type:
- string
- 'null'
description: A storefront path (/products?category=Shirts, /pages/size-guide) or a web URL
label:
type: string
description: A shelf tab's name; the source's name when left out
source:
type: string
enum:
- featured
- newest
- sale
- collection
- category
description: Which products a shelf tab shows
collection_id:
type:
- string
- 'null'
description: 'A shelf tab''s collection id, with `source: collection`'
category:
type:
- string
- 'null'
description: 'A shelf tab''s category name, with `source: category`'
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)'
StorefrontInput:
type: object
properties:
name:
type: string
description: Store name
description:
type: string
description: A short description shown under the name
phone:
type: string
description: WhatsApp number that receives orders, country code first
logo_url:
type:
- string
- 'null'
description: HTTPS image URL from an upload or image import
cover_url:
type:
- string
- 'null'
description: HTTPS image URL from an upload or image import
logo_shape:
type: string
enum:
- circle
- rounded
- square
font:
type: string
enum:
- condensed
- modern
- elegant
- editorial
- playful
description: 'Headings font: condensed (Fira Sans Condensed), modern (Inter), elegant (Playfair Display), editorial (DM Serif Display), playful (Fredoka)'
colors:
type: object
description: 'Hex colors like #e0520f. primary and secondary carry white text (buttons, badges), accent sits behind dark text (cards), whatsapp colors the WhatsApp buttons'
properties:
primary:
type: string
secondary:
type: string
accent:
type: string
whatsapp:
type: string
corners:
type: string
enum:
- rounded
- sharp
description: sharp squares off buttons and cards
home_style:
type: string
enum:
- profile
- brand
description: 'profile: the bio page (cover, logo, and tabs for the products, links and about). brand: a home built from `blocks` under a header with `navigation`, like an apparel brand''s own site'
topbar:
type: object
description: The announcement bar above the storefront; it shows while it has lines
properties:
lines:
type: array
maxItems: 2
items:
type: string
description: Up to 2 messages; **bold** works
background_color:
type: string
text_color:
type: string
motion_type:
type: string
enum:
- scroll
- static
speed:
type: integer
minimum: 1
maximum: 10
spacing:
type: integer
minimum: 1
maximum: 10
alignment:
type: string
enum:
- left
- center
- right
about_description:
type: string
description: The about section's text
about_media_url:
type:
- string
- 'null'
description: 'The about section''s image or video (HTTPS, from an upload: folder about)'
sections:
type: array
items:
type: string
enum:
- store
- links
- about
description: The profile home's tabs in order
hidden_sections:
type: array
items:
type: string
enum:
- store
- links
- about
description: Tabs to hide
preview_product_ids:
type: array
maxItems: 6
items:
type: string
description: Products the profile home features first
product_display:
type: object
description: How the storefront presents products
properties:
card_hover:
type: string
enum:
- zoom
- swap
description: Under the pointer, a product card's photo grows (zoom) or shows the second photo (swap)
quick_add:
type: boolean
description: Product cards get an add-to-cart button
new_days:
type: integer
enum:
- 0
- 7
- 14
- 30
description: Products this many days old or newer get a New badge; 0 never
low_stock:
type: integer
enum:
- 0
- 1
- 3
- 5
- 10
description: Products with this many units or fewer get a Last units badge; 0 never
note:
type: string
maxLength: 120
description: A line under the price on every product page, like Ships in 24 hours
size_guide:
type:
- string
- 'null'
description: The slug of the page product pages offer as a size guide; a new page's slug is its title in lowercase with hyphens
related:
type: boolean
description: Product pages end with more products from the category
recent:
type: boolean
description: Product pages end with the products the visitor saw last
upsell:
type:
- string
- 'null'
description: A collection id whose products the cart offers to complete the order
instalments:
type: integer
enum:
- 0
- 2
- 3
- 4
- 6
- 12
description: Product pages show the price split in this many instalments, as the store's payment provider offers them; 0 never
blocks:
type: array
maxItems: 20
description: The brand home, top to bottom
items:
$ref: '#/components/schemas/StorefrontBlock'
navigation:
type: object
description: The brand home's header and footer
properties:
tab_bar:
type: boolean
description: Phones get a bottom bar (home, search, menu, cart) instead of the floating cart button
floating_header:
type: boolean
description: Over a brand home that opens with a hero, the header floats as a see-through pill on the picture
popular_searches:
type: array
maxItems: 8
items:
type: string
maxLength: 30
description: 'Searches the search panel suggests before the visitor types. Empty: the store''s top categories'
menu:
type: array
maxItems: 8
description: The header menu. An entry with items opens a panel of links (beside its picture, when it has one) instead of being a link
items:
type: object
properties:
label:
type: string
maxLength: 40
url:
type:
- string
- 'null'
description: A storefront path (/products?category=Shirts, /pages/size-guide) or a web URL
image_url:
type:
- string
- 'null'
description: HTTPS image URL from an upload or image import
caption:
type:
- string
- 'null'
maxLength: 60
description: A line shown with the entry's picture
layout:
type: string
enum:
- links
- tiles
description: 'links: columns of links; tiles: the links as pictures'
items:
type: array
maxItems: 24
items:
type: object
properties:
label:
type: string
maxLength: 40
url:
type:
- string
- 'null'
description: Where it leads; a heading may lead nowhere
style:
type: string
enum:
- link
- heading
- featured
description: 'heading: starts a column under its label; featured: shown apart, in bold'
image_url:
type:
- string
- 'null'
description: The link's picture in the tiles layout
utility:
type: array
maxItems: 4
description: Small links beside the menu on large screens (help, stores, track an order) and under it on phones
items:
$ref: '#/components/schemas/StorefrontLink'
footer:
type: array
maxItems: 4
description: The footer's columns of links
items:
type: object
properties:
title:
type: string
maxLength: 40
items:
type: array
maxItems: 8
items:
$ref: '#/components/schemas/StorefrontLink'
pages:
type: array
maxItems: 20
description: 'Pages built from blocks, at /pages/<slug> on the storefront: a size guide, the store''s locations, its policies. Pages left out are deleted'
items:
type: object
properties:
id:
type:
- string
- 'null'
description: A saved page's id (pag_...)
slug:
type:
- string
- 'null'
description: 'Read only: set from the title when the page is published, then kept'
title:
type: string
maxLength: 60
hidden:
type: boolean
blocks:
type: array
items:
$ref: '#/components/schemas/StorefrontBlock'
links:
type: array
description: The profile home's links. Links left out are deleted
items:
type: object
properties:
id:
type:
- string
- 'null'
description: A saved link's id (lnk_...)
name:
type: string
url:
type: string
description: http(s), mailto, tel, sms or whatsapp URL
collections:
type: array
description: Groups of products, in order. Collections left out are deleted, except hidden ones, which the editor doesn't show
items:
type: object
properties:
id:
type:
- string
- 'null'
description: A saved collection's id (col_...), or one you make up to refer to a new collection
name:
type: string
description:
type: string
product_ids:
type: array
items:
type: string
description: Its products in order
videos:
type: array
maxItems: 5
description: Shoppable videos, in order
items:
type: object
properties:
url:
type: string
description: The video's HTTPS URL, from an upload (folder shoppable-videos)
product_ids:
type: array
maxItems: 3
items:
type: string
description: Products shown with the video
StorefrontLink:
type: object
properties:
label:
type: string
maxLength: 40
url:
type:
- string
- 'null'
description: A storefront path (/products?category=Shirts, /pages/size-guide) or a web URL
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.