Dine-in ordering for cafés and restaurants: each table (or area, like a bar or terrace) has a QR code with a signed link. Scanning it opens the storefront for that table, with no shipping or address, and the order reaches the kitchen tagged with the table: its `table` and `table_session`. Orders from the same table, from one phone or several, share its sitting until the staff close the table on the dashboard, which records what was left to pay. Turn it on, and choose how guests pay, with updateDineIn.
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API 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.
openapi: 3.2.0
info:
title: Ocapi Tables 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: Tables
description: 'Dine-in ordering for cafés and restaurants: each table (or area, like a bar or terrace) has a QR code with a
signed link. Scanning it opens the storefront for that table, with no shipping or address, and the order reaches
the kitchen tagged with the table: its `table` and `table_session`. Orders from the same table, from one phone or
several, share its sitting until the staff close the table on the dashboard, which records what was left to pay.
Turn it on, and choose how guests pay, with updateDineIn.'
paths:
/api/v1/stores/{store_id}/dine_in:
parameters:
- $ref: '#/components/parameters/StoreId'
get:
operationId: getDineIn
tags:
- Tables
summary: Get the dine-in settings
description: Whether guests can order from their table by QR code, how they pay, and whether they can order right now.
responses:
'200':
description: The dine-in settings
content:
application/json:
schema:
$ref: '#/components/schemas/DineIn'
patch:
operationId: updateDineIn
tags:
- Tables
summary: Change the dine-in settings
description: 'Changes only the fields you send; nothing is saved when any field is refused. A service charge for dine-in
orders only is the checkout''s service charge with `only: dine_in` (updateCheckout).'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DineInInput'
responses:
'200':
description: The updated settings
content:
application/json:
schema:
$ref: '#/components/schemas/DineIn'
'422':
$ref: '#/components/responses/Invalid'
/api/v1/stores/{store_id}/tables:
parameters:
- $ref: '#/components/parameters/StoreId'
get:
operationId: listTables
tags:
- Tables
summary: List tables
description: The store's tables in their order, each with the link its QR code holds and its open sitting.
responses:
'200':
description: The store's tables
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: array
items:
$ref: '#/components/schemas/Table'
post:
operationId: createTable
tags:
- Tables
summary: Add a table
description: Adds a table or area by name, last in the list, with its QR link. Names are unique in the store, ignoring case.
requestBody:
required: true
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/TableInput'
required:
- name
responses:
'201':
description: The new table
content:
application/json:
schema:
$ref: '#/components/schemas/Table'
'422':
$ref: '#/components/responses/Invalid'
/api/v1/stores/{store_id}/tables/{table_id}:
parameters:
- $ref: '#/components/parameters/StoreId'
- name: table_id
in: path
required: true
schema:
type: string
pattern: ^tbl_[0-9a-z]{26}$
description: The table's ID
example: tbl_01k70000000000000000000001
get:
operationId: getTable
tags:
- Tables
summary: Get a table
description: One table, with its QR link and open sitting.
responses:
'200':
description: The table
content:
application/json:
schema:
$ref: '#/components/schemas/Table'
patch:
operationId: updateTable
tags:
- Tables
summary: Update a table
description: Renames the table or moves it in the list. Its QR code stays the same; orders keep the name they were placed with.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TableInput'
responses:
'200':
description: The updated table
content:
application/json:
schema:
$ref: '#/components/schemas/Table'
'422':
$ref: '#/components/responses/Invalid'
delete:
operationId: deleteTable
tags:
- Tables
summary: Remove a table
description: Removes the table and its QR code stops working. Its orders keep the table's name. A table whose open sitting has orders can't be removed until the staff close it.
responses:
'204':
description: The table was removed
'409':
description: 'The table''s open sitting has orders (code table_open): close the table first'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/v1/stores/{store_id}/tables/{table_id}/link:
parameters:
- $ref: '#/components/parameters/StoreId'
- name: table_id
in: path
required: true
schema:
type: string
pattern: ^tbl_[0-9a-z]{26}$
description: The table's ID
post:
operationId: rotateTableLink
tags:
- Tables
summary: Make a new table QR link
description: Replaces the table's QR link, say when someone copied the code. The printed code stops working at once, so print it again.
responses:
'200':
description: The table with the new link
content:
application/json:
schema:
$ref: '#/components/schemas/Table'
components:
schemas:
DineInInput:
type: object
properties:
enabled:
type: boolean
description: Whether guests can order from their table by scanning its QR code
payment:
type: string
enum:
- online
- table
- both
description: 'online: they pay with the store''s online payment methods when ordering (at the table when it has none); table: they pay at the table or the counter when done, recorded when the staff close the table; both: they choose'
require_phone:
type: boolean
description: Whether guests must give a phone number; the name is always optional
open_hours_only:
type: boolean
description: Take table orders only during the store's opening hours (getSchedule). A temporary closure stops them either way
DineIn:
type: object
required:
- enabled
- payment
- require_phone
- open_hours_only
- accepting_orders
properties:
enabled:
type: boolean
payment:
type: string
enum:
- online
- table
- both
require_phone:
type: boolean
open_hours_only:
type: boolean
accepting_orders:
type: boolean
description: Whether guests can order from their table right now
TableInput:
type: object
properties:
name:
type: string
maxLength: 40
description: The table or area, as the kitchen and the guests see it
examples:
- Mesa 4
- Barra
position:
type: integer
minimum: 0
description: Its place in the list; lower comes first
Table:
type: object
required:
- id
- name
- position
- link
- open_session
- created_at
- updated_at
properties:
id:
type: string
examples:
- tbl_01k70000000000000000000001
description: The table's ID
name:
type: string
position:
type: integer
link:
type: string
format: uri
description: 'What the table''s QR code holds: a signed link that opens the storefront for this table. rotateTableLink replaces it'
open_session:
type:
- object
- 'null'
description: The sitting under way at the table, from the first scan until the staff close it; null while it's free
required:
- id
- opened_at
- orders_count
- total
- unpaid_total
properties:
id:
type: string
examples:
- tbs_01k70000000000000000000001
opened_at:
type: string
format: date-time
orders_count:
type: integer
description: Its orders, without cancelled ones and failed payments
total:
type: number
description: What those orders add up to
unpaid_total:
type: number
description: What's left to pay at the table
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
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'
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.