Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Ocapi Domains 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: Domains
description: 'Custom domains for the storefront. Add a domain, have its owner create the DNS record in
`dns` at their domain provider, then verify it: a verified (`ready`) domain serves the
storefront.
Owners can also buy a domain through Ocapi, where it is offered: search names with
their price, then start a purchase. A person pays it in Stripe Checkout (`checkout_url`);
once paid, Ocapi registers it, points its DNS at the store, adds it to the domains and
renews it every year.'
paths:
/api/v1/stores/{store_id}/domains:
parameters:
- $ref: '#/components/parameters/StoreId'
get:
operationId: listDomains
tags:
- Domains
summary: List domains
description: The store's custom domains, the default first.
responses:
'200':
description: The domains
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: array
items:
$ref: '#/components/schemas/Domain'
post:
operationId: addDomain
tags:
- Domains
summary: Add a domain
description: Adds a domain the merchant owns, such as `tienda.com` or `shop.tienda.com`; it starts `pending`. The store's first domain becomes its default. Next, create the DNS record in `dns` and verify the domain.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- domain
properties:
domain:
type: string
examples:
- tienda.com
description: The domain; a pasted URL keeps only its host
responses:
'201':
description: The new domain
content:
application/json:
schema:
$ref: '#/components/schemas/Domain'
'403':
$ref: '#/components/responses/Forbidden'
'422':
$ref: '#/components/responses/Invalid'
/api/v1/stores/{store_id}/domains/{domain_id}:
parameters:
- $ref: '#/components/parameters/StoreId'
- $ref: '#/components/parameters/DomainId'
delete:
operationId: removeDomain
tags:
- Domains
summary: Remove a domain
description: The domain stops serving the storefront. Removing the default makes the newest ready domain the default.
responses:
'204':
description: Removed
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
/api/v1/stores/{store_id}/domains/{domain_id}/verification:
parameters:
- $ref: '#/components/parameters/StoreId'
- $ref: '#/components/parameters/DomainId'
post:
operationId: verifyDomain
tags:
- Domains
summary: Verify a domain
description: Checks the domain's DNS again. It becomes `ready` once its A record points at `dns.value`, which can take a few hours after the record is created. A ready domain becomes the default when the store has none.
responses:
'200':
description: The domain
content:
application/json:
schema:
$ref: '#/components/schemas/Domain'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
/api/v1/stores/{store_id}/domains/{domain_id}/default:
parameters:
- $ref: '#/components/parameters/StoreId'
- $ref: '#/components/parameters/DomainId'
post:
operationId: setDefaultDomain
tags:
- Domains
summary: Make a domain the default
description: The storefront's links and shares use the default domain. Only a ready domain can be the default.
responses:
'200':
description: The domain
content:
application/json:
schema:
$ref: '#/components/schemas/Domain'
'403':
$ref: '#/components/responses/Forbidden'
'422':
$ref: '#/components/responses/Invalid'
/api/v1/stores/{store_id}/domain_registrations/availability:
parameters:
- $ref: '#/components/parameters/StoreId'
get:
operationId: searchDomains
tags:
- Domains
summary: Search domains to buy
description: Owners only. Checks a name under each extension Ocapi sells (`tienda` gives tienda.com, tienda.shop…; a name with an extension is checked first) and returns whether each can be bought, with the first year's and the yearly renewal price in the store's currency (or USD when Ocapi can't charge that one). 404 where buying domains isn't offered.
parameters:
- name: query
in: query
required: true
schema:
type: string
examples:
- tienda
description: A name, or a domain like tienda.co
responses:
'200':
description: The domains checked
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: array
items:
$ref: '#/components/schemas/DomainAvailability'
'403':
$ref: '#/components/responses/OwnerOnly'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/Invalid'
'503':
$ref: '#/components/responses/Unavailable'
/api/v1/stores/{store_id}/domain_registrations:
parameters:
- $ref: '#/components/parameters/StoreId'
get:
operationId: listDomainRegistrations
tags:
- Domains
summary: List domain purchases
description: Owners only. The domains bought through Ocapi for the store, newest first, with where each purchase and its renewal stand.
responses:
'200':
description: The purchases
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: array
items:
$ref: '#/components/schemas/DomainRegistration'
'403':
$ref: '#/components/responses/OwnerOnly'
post:
operationId: startDomainRegistration
tags:
- Domains
summary: Start a domain purchase
description: Owners only. Starts buying an available domain from Search domains and returns the purchase in `checkout` with its `checkout_url`, a Stripe Checkout page where a person pays the first year. Nothing is charged until they pay there. Once paid, Ocapi registers the domain (the purchase moves to `registering`, then `active`), points it at the store and adds it to the store's domains. The registrant starts from the owner's account; send `contact` for the rest, which every registry requires.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- domain
properties:
domain:
type: string
examples:
- tienda.com
description: A domain Search domains returned as available
contact:
$ref: '#/components/schemas/DomainContactInput'
responses:
'201':
description: The purchase, waiting for payment
content:
application/json:
schema:
$ref: '#/components/schemas/DomainRegistration'
'403':
$ref: '#/components/responses/OwnerOnly'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/Invalid'
'503':
$ref: '#/components/responses/Unavailable'
/api/v1/stores/{store_id}/domain_registrations/{registration_id}:
parameters:
- $ref: '#/components/parameters/StoreId'
- $ref: '#/components/parameters/DomainRegistrationId'
get:
operationId: getDomainRegistration
tags:
- Domains
summary: Get a domain purchase
description: Owners only. Where a purchase stands, such as after its checkout was paid.
responses:
'200':
description: The purchase
content:
application/json:
schema:
$ref: '#/components/schemas/DomainRegistration'
'403':
$ref: '#/components/responses/OwnerOnly'
'404':
$ref: '#/components/responses/NotFound'
components:
parameters:
DomainId:
name: domain_id
in: path
required: true
schema:
type: string
description: The domain's ID (dom_...)
DomainRegistrationId:
name: registration_id
in: path
required: true
schema:
type: string
description: The domain purchase's ID (dreg_...)
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
responses:
OwnerOnly:
description: The token lacks the write scope, or the user isn't one of the store's owners
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
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'
Unavailable:
description: Temporarily unavailable; retry in a minute
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
DomainContactInput:
type: object
description: The domain's registrant, which every registry requires. Fields left out come from the owner's account (name, email, phone) and the store (country); the address has to be sent. It is kept out of public WHOIS where the registry allows.
properties:
first_name:
type: string
last_name:
type: string
company:
type: string
email:
type: string
format: email
phone:
type: string
examples:
- +57 300 123 4567
description: With the country code
street:
type: string
examples:
- 'Calle 10 # 5-20'
city:
type: string
state:
type: string
description: State
province or department: null
postal_code:
type: string
country:
type: string
examples:
- CO
description: Two-letter country code
DomainRegistration:
type: object
required:
- id
- domain
- status
- auto_renew
- currency
- price
- renewal_price
- checkout_url
- domain_id
- expires_at
- created_at
properties:
id:
type: string
examples:
- dreg_01k70000000000000000000001
domain:
type: string
examples:
- tienda.com
status:
type: string
enum:
- checkout
- registering
- active
- renewing
- expiring
- failed
- refunded
- expired
description: 'checkout: waiting for payment at checkout_url. registering: paid, being registered. active: registered. renewing: the yearly renewal is coming up and will be charged. expiring: auto-renew is off and the expiry is near. failed: a renewal charge was declined (it is retried daily) or Ocapi is fixing a problem. refunded: it couldn''t be registered and the payment was refunded. expired: it wasn''t renewed. May gain values.'
auto_renew:
type: boolean
description: Whether it renews each year on the saved card
currency:
type: string
examples:
- COP
price:
type: number
description: What the first year cost
renewal_price:
type: number
description: What the next year will cost
checkout_url:
type:
- string
- 'null'
format: uri
description: Where a person pays, while the status is checkout
domain_id:
type:
- string
- 'null'
description: The store's Domain (dom_...) once registered; it serves the storefront when ready
expires_at:
type:
- string
- 'null'
format: date-time
description: When the paid period ends; null until registered
created_at:
type: string
format: date-time
DomainAvailability:
type: object
required:
- domain
- available
- price
- renewal_price
- currency
properties:
domain:
type: string
examples:
- tienda.com
available:
type: boolean
description: Whether it can be bought; taken and premium names can't
price:
type:
- number
- 'null'
examples:
- 59000
description: The first year, in currency; null when unavailable
renewal_price:
type:
- number
- 'null'
description: Each following year
in currency: null
currency:
type:
- string
- 'null'
examples:
- COP
description: The store's currency, or USD when Ocapi can't charge it
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)'
Domain:
type: object
required:
- id
- domain
- status
- default
- dns
- created_at
properties:
id:
type: string
examples:
- dom_01k70000000000000000000001
domain:
type: string
examples:
- tienda.com
status:
type: string
enum:
- pending
- ready
description: ready once its DNS points at Ocapi and it serves the storefront
default:
type: boolean
description: The domain the storefront's links use
dns:
type: object
required:
- type
- host
- name
- value
description: The record to create at the domain's DNS provider
properties:
type:
type: string
enum:
- A
host:
type: string
description: 'The record''s host as DNS providers ask for it: @ for the domain itself, or the subdomain (shop)'
name:
type: string
description: The full name the record is for
value:
type:
- string
- 'null'
description: The IP address to point to; null when it isn't available, then retry later
created_at:
type: string
format: date-time
securitySchemes:
bearer:
type: http
scheme: bearer
description: An OAuth access token. See Authentication above for how to get one.