Back

    Buyamia Directory API

    v1.1.0

    Webhooks

    Subscribe a URL to an event type and the Directory will POST to it when that event fires. All three routes require webhooks.manage; subscriptions are scoped to the API key that created them.

    POST
    /v1/webhooks

    Create a subscription. Body: `{ "event_type": "rfq.quote_submitted", "target_url": "https://…" }`. Both fields required (400 otherwise). Returns 201.

    webhooks.manage

    The signing secret is returned only in the creation response. Store it immediately — it is never shown again. To rotate, delete the subscription and create a new one.

    201 responsejson
    {
      "data": {
        "id": "1c9d…",
        "event_type": "rfq.quote_submitted",
        "target_url": "https://sourcing.example.com/hooks/directory",
        "is_active": true,
        "created_at": "2026-09-02T02:39:00Z",
        "secret": "a3f1…64 hex chars…"
      }
    }
    GET
    /v1/webhooks

    List your key's subscriptions. Secrets are not included.

    webhooks.manage
    DELETE
    /v1/webhooks/:id

    Delete a subscription owned by your key. Returns `{ "success": true }`.

    webhooks.manage

    Complete event list

    The API fires exactly these eight events. One subscription listens to one event_type; create several to cover several events.

    EventFires whenPayload `data`
    business.createdA business is created via the APIbusiness_id, name, slug
    business.updatedA business is updated via the APIbusiness_id, name, updated_fields
    product.createdA product is created via the APIproduct_id, business_id, name
    product.updatedA product is updated via the APIproduct_id, business_id, updated_fields
    supplier.performance_updatedSupplier performance is upsertedbusiness_id
    rfq.createdAn RFQ is created via /v1/rfq/inboundrfq_id, external_rfq_id, rfq_number
    rfq.status_changedAn RFQ update includes a new statusrfq_id, status, external_rfq_id
    rfq.quote_submittedA supplier quote is recordedrfq_id, external_rfq_id, supplier_id, quoted_price

    Delivery format

    POST body sent to your URLjson
    {
      "event": "rfq.quote_submitted",
      "timestamp": "2026-09-02T02:40:12.483Z",
      "data": {
        "rfq_id": "9f31…",
        "external_rfq_id": "PROC-2026-0042",
        "supplier_id": "c3a1…",
        "quoted_price": 56000000
      }
    }
    • Delivery is fire-and-forget: a failed POST does not fail or retry the originating API call.
    • quoted_price in the payload is a bare number — read the authoritative amount and currency from GET /v1/rfq/:id/quotes.
    • Treat the webhook as a nudge, not as the source of truth. Fetch the resource after receiving it.
    • Respond quickly with 2xx and process asynchronously.
    Current as of API 1.1.0 — released 7 September 2026