ocapi-shop Webhooks API

Webhooks push the store's events to a URL of yours as they happen, instead of you polling for them. Owners only. A store has up to 10 endpoints (IDs `whk_`), each listening for some of these events: | Event | When | | --- | --- | | `order.created` | An order is placed or recorded | | `order.updated` | An order's `order_status`, `payment_status` or tracking changes | | `order.paid` | An order's payment becomes `paid` (it also sends `order.updated` when it changes) | | `product.created`, `product.updated`, `product.deleted` | A product is created, edited (reordering doesn't count) or deleted | Creating an endpoint subscribes it and deleting it unsubscribes it, which is how Zapier's REST hooks work. Each event is a `POST` with a JSON body: ```json { "id": "evt_...", "type": "order.created", "created_at": "2026-01-01T12:00:00.000Z", "store_id": "str_...", "data": { ...the order, exactly as Get an order returns it } } ``` `data` is the resource as this API returns it (an Order or a Product; a deleted product as it was). The `webhooks` section of this spec documents each event. Requests also carry the headers `Ocapi-Event-Id`, `Ocapi-Event-Type` and `Ocapi-Delivery-Id`. ## Verifying signatures Every request has an `Ocapi-Signature` header like `t=1767268800,v1=5257a869...`: 1. Split it on `,` and take `t` (a Unix timestamp) and `v1` (a hex digest). 2. Compute HMAC-SHA256 of `.`, keyed with the endpoint's `secret` (`whsec_...`), as lowercase hex. 3. Compare it with `v1` in constant time, and reject a `t` more than 5 minutes from now so an old request can't be replayed. ```ruby t, v1 = header.split(",").map { it.split("=", 2) }.to_h.values_at("t", "v1") expected = OpenSSL::HMAC.hexdigest("SHA256", secret, "#{t}.#{raw_body}") valid = ActiveSupport::SecurityUtils.secure_compare(expected, v1) && (Time.now.to_i - t.to_i).abs <= 300 ``` Use the raw body as received; parsing and re-serializing the JSON changes it. ## Delivery and retries Answer with any 2xx status within 10 seconds. Anything else (an error, a timeout, a redirect) is retried with growing waits (1 minute, 5 minutes, 25 minutes, then hours) for up to 8 attempts over about 12 hours. Events can arrive more than once or out of order: use the event `id` to skip duplicates and the resource's `updated_at` to keep the newest. After 15 failed attempts in a row Ocapi turns the endpoint off (`active: false`, with `disabled_at`) and emails the store's owner; turn it back on with Update a webhook. URLs must be HTTPS and reach a public address.

GitHub OpenAPI

Operations 8

GET /api/v1/stores/{store_id}/webhooks List webhooks #
POST /api/v1/stores/{store_id}/webhooks Create a webhook #
GET /api/v1/stores/{store_id}/webhooks/{webhook_id} Get a webhook #
PATCH /api/v1/stores/{store_id}/webhooks/{webhook_id} Update a webhook #
DELETE /api/v1/stores/{store_id}/webhooks/{webhook_id} Delete a webhook #
GET /api/v1/stores/{store_id}/webhooks/{webhook_id}/deliveries List webhook deliveries #
POST /api/v1/stores/{store_id}/webhooks/{webhook_id}/test Send a test event #
POST /api/v1/stores/{store_id}/webhooks/{webhook_id}/secret Rotate a webhook's secret #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • 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.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/ocapi-shop:ocapi-shop-webhooks-api"
All apis
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.

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.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

ocapi-shop-webhooks-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Ocapi Webhooks 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:


# --- truncated at 32 KB (74 KB total) ---
# Full source: https://artifacts.apis.io/ocapi-shop/openapi/ocapi-shop-webhooks-api-openapi.yml