> ## Documentation Index
> Fetch the complete documentation index at: https://docs.textyess.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Order

> Send new order data to TextYess to unlock analytics and automations

## Overview

The v2 new-order webhook lets TextYess receive your orders so it can attribute them to the WhatsApp
conversations, campaigns, and automations that drove them, and power analytics. It is CMS-agnostic:
map your store's order to the contract below once, whatever platform you use.

<Note>
  **Automations only fire for recent orders.** Flows with a new-order trigger run only when the
  order's `created_at` is within the last 24 hours. Older orders are still ingested for analytics
  and attribution, so backfilling historical orders is safe — it will never message your customers.
</Note>

## Authentication

Send your organization token in the `x-auth-token` header. You can find both your token and your
organization id in the [Developers section](https://ai.textyess.com/developers):

```bash theme={null}
x-auth-token: your_token
```

### Path Parameters

<ParamField path="organizationId" type="string" required initialValue="68dd9a79dd6e8f8774733bd7" placeholder="68dd9a79dd6e8f8774733bd7">
  Your organization id, from [https://ai.textyess.com/developers](https://ai.textyess.com/developers)
</ParamField>

### Body Parameters

<ParamField body="id" type="string" required initialValue="100000123" placeholder="100000123">
  Your source order id. Used for idempotency — re-sending the same id for an organization is a no-op, so retries are safe.
</ParamField>

<ParamField body="created_at" type="string" required initialValue="2026-01-15T10:30:00Z" placeholder="2026-01-15T10:30:00Z">
  The order timestamp (ISO 8601). A value without a timezone is treated as UTC. Send the real order date so historical orders attribute correctly — it also gates automations: flows run only when `created_at` is within the last 24 hours.
</ParamField>

<ParamField body="status" type="string" required initialValue="paid" placeholder="paid">
  Free-text payment/order status.

  <Expandable title="Recognized values">
    `paid` / `complete` / `completed` / `processing` / `captured` / `success` count as paid; `refunded` / `partially_refunded` / `closed` as refunded; `canceled` / `voided` / `failed` as voided; any other value counts as pending.
  </Expandable>
</ParamField>

<ParamField body="total" type="number" required initialValue={99.9} placeholder="99.90">
  The grand total in currency units. A numeric string ("99.90") is also accepted.
</ParamField>

<ParamField body="payment_methods" type="array" required initialValue={["stripe"]} placeholder="['stripe']">
  The payment methods used for the order.
</ParamField>

<ParamField body="line_items" type="array" required initialValue={[{ title: "Lipstick", variant_title: "Rosso", quantity: 2, price: 49.95, sku: "LIP-1" }]} placeholder="[{ title: 'Lipstick', quantity: 2, price: 49.95 }]">
  The items in the order.

  <Expandable title="Show array item properties">
    <ParamField body="title" type="string" required initialValue="Lipstick" placeholder="Lipstick">
      Item title
    </ParamField>

    <ParamField body="quantity" type="number" required initialValue={2} placeholder="2">
      Quantity
    </ParamField>

    <ParamField body="price" type="number" required initialValue={49.95} placeholder="49.95">
      Unit price
    </ParamField>

    <ParamField body="sku" type="string" initialValue="LIP-1" placeholder="LIP-1">
      SKU
    </ParamField>

    <ParamField body="variant_title" type="string" initialValue="Rosso" placeholder="Rosso">
      Variant title
    </ParamField>

    <ParamField body="product_id" type="string" initialValue="prod_1" placeholder="prod_1">
      Product id
    </ParamField>
  </Expandable>
</ParamField>

<ParamField
  body="customer"
  type="object"
  required
  initialValue={{
first_name: "Mario",
last_name: "Rossi",
email: "mario.rossi@example.com",
phone: "3517978283",
country_code: "IT"
}}
  placeholder="{ email: 'mario.rossi@example.com', phone: '3517978283', country_code: 'IT' }"
>
  Customer identity. For anonymous orders, supply placeholder values you control.

  <Expandable title="Show object properties">
    <ParamField body="email" type="string" required initialValue="mario.rossi@example.com" placeholder="mario.rossi@example.com">
      Customer email
    </ParamField>

    <ParamField body="phone" type="string" required initialValue="3517978283" placeholder="3517978283">
      Customer phone (paired with country\_code)
    </ParamField>

    <ParamField body="country_code" type="string" required initialValue="IT" placeholder="IT">
      ISO country code for the phone
    </ParamField>

    <ParamField body="id" type="string" initialValue="cust-42" placeholder="cust-42">
      Source customer id
    </ParamField>

    <ParamField body="first_name" type="string" initialValue="Mario" placeholder="Mario">
      First name
    </ParamField>

    <ParamField body="last_name" type="string" initialValue="Rossi" placeholder="Rossi">
      Last name
    </ParamField>

    <ParamField body="locale" type="string" initialValue="it" placeholder="it">
      Locale
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="currency" type="string" initialValue="EUR" placeholder="EUR">
  ISO currency code. Defaults to EUR when omitted.
</ParamField>

<ParamField body="order_number" type="string" initialValue="000000123" placeholder="000000123">
  Human-facing order number / increment id.
</ParamField>

<ParamField body="fulfillment_status" type="string" initialValue="fulfilled" placeholder="fulfilled">
  Free-text fulfillment status.
</ParamField>

<ParamField body="tracking_url" type="string" initialValue="https://track.example/abc" placeholder="https://track.example/abc">
  Tracking URL for the shipment.
</ParamField>

<ParamField
  body="shipping_address"
  type="object"
  initialValue={{
first_name: "Mario",
last_name: "Rossi",
address1: "Via Roma 1",
city: "Milano",
province: "MI",
country: "Italy",
country_code: "IT",
zip: "20100",
phone: "3517978283"
}}
  placeholder="{ address1: 'Via Roma 1', city: 'Milano', country_code: 'IT' }"
>
  Shipping address (all fields optional).

  <Expandable title="Show object properties">
    <ParamField body="first_name" type="string" initialValue="Mario" placeholder="Mario">First name</ParamField>
    <ParamField body="last_name" type="string" initialValue="Rossi" placeholder="Rossi">Last name</ParamField>
    <ParamField body="company" type="string" placeholder="Acme Inc">Company</ParamField>
    <ParamField body="address1" type="string" initialValue="Via Roma 1" placeholder="Via Roma 1">Address line 1</ParamField>
    <ParamField body="address2" type="string" placeholder="Interno 4">Address line 2</ParamField>
    <ParamField body="city" type="string" initialValue="Milano" placeholder="Milano">City</ParamField>
    <ParamField body="province" type="string" initialValue="MI" placeholder="MI">Province / state</ParamField>
    <ParamField body="province_code" type="string" placeholder="MI">Province code</ParamField>
    <ParamField body="country" type="string" initialValue="Italy" placeholder="Italy">Country</ParamField>
    <ParamField body="country_code" type="string" initialValue="IT" placeholder="IT">Country code</ParamField>
    <ParamField body="zip" type="string" initialValue="20100" placeholder="20100">ZIP / postal code</ParamField>
    <ParamField body="phone" type="string" initialValue="3517978283" placeholder="3517978283">Phone</ParamField>
  </Expandable>
</ParamField>

<ParamField body="billing_address" type="object" placeholder="{ address1: 'Via Roma 1', city: 'Milano', country_code: 'IT' }">
  Billing address — same shape as `shipping_address` (all fields optional).
</ParamField>

<ParamField body="discount_codes" type="array" initialValue={[{ code: "WELCOME10", amount: 5 }]} placeholder="[{ code: 'WELCOME10', amount: 5 }]">
  Discount codes applied to the order.

  <Expandable title="Show array item properties">
    <ParamField body="code" type="string" required initialValue="WELCOME10" placeholder="WELCOME10">Code</ParamField>
    <ParamField body="amount" type="number" initialValue={5} placeholder="5">Discount amount</ParamField>
    <ParamField body="type" type="string" placeholder="percentage">Discount type</ParamField>
  </Expandable>
</ParamField>

<ParamField body="cart_id" type="string" placeholder="cart-xyz">
  Cart identifier (enables onsite-chat attribution).
</ParamField>

<ParamField body="subtotal" type="number" placeholder="90.00">
  Subtotal.
</ParamField>

<ParamField body="total_tax" type="number" placeholder="9.90">
  Total tax.
</ParamField>

<ParamField body="total_discount" type="number" placeholder="5.00">
  Total discount.
</ParamField>

<ParamField body="total_shipping" type="number" placeholder="0.00">
  Total shipping.
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Whether the webhook was processed.
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  { "success": true }
  ```

  ```json 400 theme={null}
  {
    "code": 400,
    "message": "Validation failed"
  }
  ```

  ```json 401 theme={null}
  {
    "code": 401,
    "message": "Unauthorized"
  }
  ```
</ResponseExample>
