API Reference

API Documentation

Integrate OrderConfirm's AI confirmation calls into your store with a simple REST API.

Overview

The OrderConfirm API lets you submit e-commerce orders and have an AI voice agent call your customers to confirm them — in Bangla or English. Send an order, trigger a confirmation call, and receive the outcome (confirmed, cancelled, or needing human follow-up) along with a recording and transcript. Delivery-address replacements are persisted on the order.

All endpoints are relative to the base URL:

https://api.orderconfirm.io/api/v1

The typical lifecycle is: create an ordertrigger a callthe agent dials your customeryou receive the result via webhook or by polling the call.

Authentication

Create an API key in the dashboard at /app/tokens and send it as the X-API-Key header on every ingestion request.

X-API-Key: ocb_live_your_key_here

Step-by-step integration

  1. 01

    Get an API key

    Create a key in the dashboard and store it securely — it is shown only once.

  2. 02

    Create an order

    POST the order with customer phone and items to /ingest/orders.

  3. 03

    Trigger a confirmation call

    Queue a call with POST /ingest/orders/:id/calls, optionally choosing an agent.

  4. 04

    Receive results

    Poll GET /ingest/calls/:id or receive a webhook when the call completes.

Create order — request body

POST https://api.orderconfirm.io/api/v1/ingest/orders

FieldTypeDescription
order_idstringYour store's order reference.
customer_namestringFull name of the customer.
customer_phonestringE.164 phone number, e.g. +8801712345678.
customer_addressstringDelivery address read back during the call; the customer may replace it.
countrystringISO country code, e.g. BD.
languagestringSpoken language: bn or en.
itemsarrayLine items: product_name, product_price, product_quantity, and optional metadata attributes.

Trigger a call — available agents

POST https://api.orderconfirm.io/api/v1/ingest/orders/:id/calls — pass an optional agent_id to pick a voice.

Agentagent_idDescription
Asifa51f0000-0000-4000-8000-000000000001Default Bangla order-confirmation agent.
Alexa1e70000-0000-4000-8000-000000000002English agent with the same flow and personality as Asif.

Omit agent_id to use the default agent selected in the agent registry.

How a confirmation flows

This sequence shows the full lifecycle from creating an order to receiving the result.

Loading diagram…

Examples

Each request needs the X-API-Key header. Values below use realistic Bangladesh data.

curl
curl -X POST https://api.orderconfirm.io/api/v1/ingest/orders \
  -H "X-API-Key: ocb_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "order_id": "ORD-10231",
    "customer_name": "Rahim Uddin",
    "customer_phone": "+8801712345678",
    "customer_address": "House 12, Road 5, Dhanmondi, Dhaka",
    "country": "BD",
    "language": "bn",
    "items": [
      { "product_name": "Cotton Panjabi", "product_price": 1450, "product_quantity": 2,
        "metadata": { "color": "black", "size": "L" } },
      { "product_name": "Leather Sandals", "product_price": 990, "product_quantity": 1,
        "metadata": { "size": "42" } }
    ]
  }'
Request — application/json
{
  "order_id": "ORD-10231",
  "customer_name": "Rahim Uddin",
  "customer_phone": "+8801712345678",
  "customer_address": "House 12, Road 5, Dhanmondi, Dhaka",
  "country": "BD",
  "language": "bn",
  "items": [
    { "product_name": "Cotton Panjabi", "product_price": 1450, "product_quantity": 2,
      "metadata": { "color": "black", "size": "L" } },
    { "product_name": "Leather Sandals", "product_price": 990, "product_quantity": 1,
      "metadata": { "size": "42" } }
  ]
}
Response — 201 Created
{
  "data": {
    "id": "o1b2c3d4-0000-4000-8000-000000000abc",
    "order_id": "ORD-10231",
    "customer_name": "Rahim Uddin",
    "customer_phone": "+8801712345678",
    "customer_address": "House 12, Road 5, Dhanmondi, Dhaka",
    "country": "BD",
    "language": "bn",
    "items": [
      { "product_name": "Cotton Panjabi", "product_price": 1450, "product_quantity": 2,
        "metadata": { "color": "black", "size": "L" } },
      { "product_name": "Leather Sandals", "product_price": 990, "product_quantity": 1,
        "metadata": { "size": "42" } }
    ],
    "created_at": "2026-06-24T09:30:00Z"
  }
}

Webhooks

Instead of polling, configure a webhook URL at /app/webhook to receive call lifecycle, conversation outcome, order state, and address-change events as they happen. OrderConfirm POSTs each event independently to your endpoint. In every payload, order_id is the value you supplied when creating the order, not the internal OrderConfirm UUID.

EventDescription
call.placedThe customer answered and the confirmation call is in progress.
call.completedThe call finished. Carries the business result, duration, and recording.
call.failedThe call never connected (no answer, busy, declined, or undialable).
call.status_changedThe call lifecycle moved between pending, scheduled, in progress, redial, or a terminal state.
call.outcome_recordedThe precise managed conversation outcome and privacy-safe summary counts were recorded.
call.note_addedA structured note code was recorded; customer note text and values are not sent.
order.status_changedThe order moved to a managed status such as callback, modification, verification, or review.
order.modification_requestedA typed order change was applied or requested; customer-supplied values are not sent.
order.callback_requestedThe customer requested a callback; only whether a time was supplied is sent.
order.do_not_call_requestedThe customer asked not to receive another call.
address.changedThe customer changed the delivery address during the call. Carries the old and new addresses.

Terminal call event payload

The call.placed, call.completed, and call.failed events carry all fields below, using null where a field does not apply.

FieldTypeDescription
call_idstringThe call this event belongs to.
order_idstringThe client-supplied order reference from the create-order request.
statusstringCall lifecycle: pending | scheduled | in_progress | in_redial | completed | failed | cancelled.
resultstringBusiness outcome: pending | confirmed | rejected | failed | human_intervention_needed.
outcomestringPrecise conversation path, for example callback_requested or modification_requested.
reasonstring | nullWhy the result needs attention, e.g. the agent's note on a human_intervention_needed call, not_answered, not_dialable, or max_duration_exceeded. Null when nothing needs explaining.
dispositionstring | nullPhone response: received | rejected | busy | no_answer | unreachable.
duration_secondsnumber | nullTalk time of the finished call.
recording_urlstring | nullRecording of the finished call, when available.

Managed state payloads

State events use the common identifiers below plus event-specific typed fields. Raw customer notes, callback times, preferred-language values, and requested order values stay in authenticated API responses and dashboards.

FieldTypeDescription
event_idstringStable idempotency suffix for this state signal within the call.
call_idstringThe call this state event belongs to.
order_idstringYour client-supplied order reference.
previous_status / statusstringPrevious and current lifecycle or order status on state-transition events.
result / outcomestringCoarse result and exact conversation path where applicable.
codestringStable note code on call.note_added; note content remains private.
change_type / change_statusstringTyped modification and whether it was applied, requested, or needs review.
sequencenumberZero-based ordering when a call records multiple notes or changes.
notes_count / changes_countnumberStructured issue counts on call.outcome_recorded.
presence flagsbooleanPrivacy-safe flags such as has_note, has_value, has_requested_time, or has_requested_value.

Address change payload

address.changed delivery starts after the replacement address is persisted. Every webhook runs independently from call settlement and from other webhook deliveries, so a bad endpoint cannot block the saved call result or recording, and event arrival order is not guaranteed.

FieldTypeDescription
call_idstringThe call during which the address was changed.
order_idstringThe client-supplied order reference from the create-order request.
old_addressstringThe delivery address stored before the change.
new_addressstringThe replacement delivery address supplied by the customer.
Example call.completed delivery
POST https://your-store.com/webhooks/orderconfirm
Authorization: Bearer <your_webhook_auth_token>
Content-Type: application/json

{
  "event": "call.completed",
  "payload": {
    "call_id": "c9f8e7d6-0000-4000-8000-000000000def",
    "order_id": "ORD-10231",
    "status": "completed",
    "result": "confirmed",
    "outcome": "confirmed",
    "reason": null,
    "disposition": "received",
    "duration_seconds": 74,
    "recording_url": "https://recordings.orderconfirm.io/c9f8e7d6.mp3"
  }
}

// Terminal call events carry these exact fields; values that do not apply are null.
// A human_intervention_needed result always explains itself, e.g.
//   "result": "human_intervention_needed",
//   "reason": "customer wants to change item quantity"
Example address.changed delivery
POST https://your-store.com/webhooks/orderconfirm
Authorization: Bearer <your_webhook_auth_token>
Content-Type: application/json

{
  "event": "address.changed",
  "payload": {
    "call_id": "c9f8e7d6-0000-4000-8000-000000000def",
    "order_id": "ORD-10231",
    "old_address": "House 12, Road 5, Dhanmondi, Dhaka",
    "new_address": "House 7, Road 11, Uttara, Dhaka"
  }
}