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

# Create an order

> **Scope:** [`write_orders`](/scopes)

Creates an order. It starts `pending`, with the payment status
`pending_payment`.

- Set each item's `price`, `shipping_cost` and `total_cost` yourself,
  or leave them out to use the store's prices and shipping.
- `coupon_codes` apply to the prices; they cannot be sent with
  `total_cost`.
- Stock moves with the order: an item over the available stock of a
  product that tracks it answers `409 insufficient_stock`.
- A blocked phone number is refused.

Send an `Idempotency-Key` to retry safely.




## OpenAPI

````yaml /openapi.json post /orders
openapi: 3.1.0
info:
  title: EasyOrders Admin API
  version: v1
  summary: Read and write a merchant's store data from your app.
  description: |
    The EasyOrders Admin API lets an installed app work with one merchant's
    store: its orders, shipping settings and shipping areas, within the
    scopes the merchant approved.

    - Every request needs an access token (`Authorization: Bearer eo_at_...`)
      from the OAuth flow. A token works on one store only.
    - Request and response bodies are JSON. Unknown fields and query
      parameters are refused.
    - Errors share one shape: `{"error": {"code", "message", "details"}}`.
    - `v1` is stable: new fields and endpoints are added to it; a breaking
      change ships as a new version.
  contact:
    name: EasyOrders developers
    url: https://easyorders.eg
servers:
  - url: https://api.easy-orders.net/api/partners-apps/v1
    description: Production
security:
  - accessToken: []
tags:
  - name: Article categories
    description: >-
      The categories of the store's blog, which articles name in their
      `category_ids`.
  - name: Articles
    description: The articles of the store's blog, with HTML content, tags and categories.
  - name: Billing
    description: >-
      Your app's plan subscription and usage wallet on the store, and debiting
      the wallet by usage.
  - name: Categories
    description: The store's product categories and subcategories.
  - name: Checkout fields
    description: >-
      The fields of the store's checkout form, their labels, order, and whether
      they show and are required.
  - name: Coupons
    description: >-
      The store's coupons, by code or automatic, and the products, variants and
      categories they apply to.
  - name: Labels
    description: >-
      Your app's short colored words on orders and products, shown in the
      merchant's orders and products tables.
  - name: Missed orders
    description: >-
      Checkouts the shopper started and did not finish, to follow up and
      recover.
  - name: Orders
    description: The store's orders, their status, payment status and notes.
  - name: Pages
    description: >-
      The store's pages, such as About us or the return policy, with HTML
      content.
  - name: Products
    description: The store's products, their options, variants and stock.
  - name: Reviews
    description: >-
      The reviews of the store's products, and which of them the product page
      shows.
  - name: Shipping
    description: The store's shipping settings and shipping areas (governorates).
  - name: Store
    description: >-
      The store the access token belongs to, its addresses, currency, language
      and plan.
paths:
  /orders:
    post:
      tags:
        - Orders
      summary: Create an order
      description: |
        **Scope:** [`write_orders`](/scopes)

        Creates an order. It starts `pending`, with the payment status
        `pending_payment`.

        - Set each item's `price`, `shipping_cost` and `total_cost` yourself,
          or leave them out to use the store's prices and shipping.
        - `coupon_codes` apply to the prices; they cannot be sent with
          `total_cost`.
        - Stock moves with the order: an item over the available stock of a
          product that tracks it answers `409 insufficient_stock`.
        - A blocked phone number is refused.

        Send an `Idempotency-Key` to retry safely.
      operationId: createOrder
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCreate'
            example:
              full_name: Mona Hassan
              phone: '+201001234567'
              country: Egypt
              city: Cairo
              address: 12 Tahrir St, Downtown
              payment_method: cod
              items:
                - product_id: 0b6f3c7e-3a1d-4a8e-9d5e-2f1b7c9a4e10
                  quantity: 2
              metadata:
                erp_ref: INV-778
      responses:
        '201':
          $ref: '#/components/responses/OrderCreated'
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/InsufficientScope'
        '409':
          description: '`insufficient_stock`, `product_gone` or `idempotency_in_progress`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: insufficient_stock
                  message: >-
                    A product or variant of the order has less in stock than its
                    items ask
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            curl -X POST
            "https://api.easy-orders.net/api/partners-apps/v1/orders" \
              -H "Authorization: Bearer $EASYORDERS_ACCESS_TOKEN" \
              -H "Idempotency-Key: INV-778" \
              -H "Content-Type: application/json" \
              -d '{
              "full_name": "Mona Hassan",
              "phone": "+201001234567",
              "country": "Egypt",
              "city": "Cairo",
              "address": "12 Tahrir St, Downtown",
              "payment_method": "cod",
              "items": [
                {
                  "product_id": "0b6f3c7e-3a1d-4a8e-9d5e-2f1b7c9a4e10",
                  "quantity": 2
                }
              ],
              "metadata": {
                "erp_ref": "INV-778"
              }
            }'
        - lang: typescript
          label: TypeScript
          source: >-
            const response = await
            fetch('https://api.easy-orders.net/api/partners-apps/v1/orders', {
              method: 'POST',
              headers: {
                Authorization: `Bearer ${process.env.EASYORDERS_ACCESS_TOKEN}`,
                'Idempotency-Key': 'INV-778',
                'Content-Type': 'application/json',
              },
              body: JSON.stringify({
                full_name: 'Mona Hassan',
                phone: '+201001234567',
                country: 'Egypt',
                city: 'Cairo',
                address: '12 Tahrir St, Downtown',
                payment_method: 'cod',
                items: [
                  {
                    product_id: '0b6f3c7e-3a1d-4a8e-9d5e-2f1b7c9a4e10',
                    quantity: 2,
                  },
                ],
                metadata: {
                  erp_ref: 'INV-778',
                },
              }),
            })


            const json = await response.json()

            if (!response.ok) {
              throw new Error(`${json.error.code}: ${json.error.message}`)
            }

            const { order } = json
        - lang: go
          label: Go
          source: "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n)\n\nfunc main() {\n\tbody := []byte(`{\n\t  \"full_name\": \"Mona Hassan\",\n\t  \"phone\": \"+201001234567\",\n\t  \"country\": \"Egypt\",\n\t  \"city\": \"Cairo\",\n\t  \"address\": \"12 Tahrir St, Downtown\",\n\t  \"payment_method\": \"cod\",\n\t  \"items\": [\n\t    {\n\t      \"product_id\": \"0b6f3c7e-3a1d-4a8e-9d5e-2f1b7c9a4e10\",\n\t      \"quantity\": 2\n\t    }\n\t  ],\n\t  \"metadata\": {\n\t    \"erp_ref\": \"INV-778\"\n\t  }\n\t}`)\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.easy-orders.net/api/partners-apps/v1/orders\", bytes.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"EASYORDERS_ACCESS_TOKEN\"))\n\treq.Header.Set(\"Idempotency-Key\", \"INV-778\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer res.Body.Close()\n\n\tvar answer map[string]any\n\tif err := json.NewDecoder(res.Body).Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\tif res.StatusCode >= 300 {\n\t\tpanic(fmt.Sprint(res.Status, answer[\"error\"]))\n\t}\n\tfmt.Println(answer[\"order\"])\n}"
        - lang: php
          label: PHP
          source: >-
            <?php


            $ch =
            curl_init('https://api.easy-orders.net/api/partners-apps/v1/orders');

            curl_setopt_array($ch, [
                CURLOPT_CUSTOMREQUEST => 'POST',
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_HTTPHEADER => [
                    'Authorization: Bearer ' . getenv('EASYORDERS_ACCESS_TOKEN'),
                    'Idempotency-Key: INV-778',
                    'Content-Type: application/json',
                ],
                CURLOPT_POSTFIELDS => json_encode([
                    'full_name' => 'Mona Hassan',
                    'phone' => '+201001234567',
                    'country' => 'Egypt',
                    'city' => 'Cairo',
                    'address' => '12 Tahrir St, Downtown',
                    'payment_method' => 'cod',
                    'items' => [
                        [
                            'product_id' => '0b6f3c7e-3a1d-4a8e-9d5e-2f1b7c9a4e10',
                            'quantity' => 2,
                        ],
                    ],
                    'metadata' => [
                        'erp_ref' => 'INV-778',
                    ],
                ]),
            ]);


            $answer = json_decode(curl_exec($ch), true);

            $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);

            curl_close($ch);


            if ($status >= 300) {
                throw new RuntimeException($answer['error']['code'] . ': ' . $answer['error']['message']);
            }

            $order = $answer['order'];
        - lang: python
          label: Python
          source: |-
            import os

            import requests

            response = requests.post(
                "https://api.easy-orders.net/api/partners-apps/v1/orders",
                headers={
                    "Authorization": f"Bearer {os.environ['EASYORDERS_ACCESS_TOKEN']}",
                    "Idempotency-Key": "INV-778",
                },
                json={
                    "full_name": "Mona Hassan",
                    "phone": "+201001234567",
                    "country": "Egypt",
                    "city": "Cairo",
                    "address": "12 Tahrir St, Downtown",
                    "payment_method": "cod",
                    "items": [
                        {
                            "product_id": "0b6f3c7e-3a1d-4a8e-9d5e-2f1b7c9a4e10",
                            "quantity": 2,
                        },
                    ],
                    "metadata": {
                        "erp_ref": "INV-778",
                    },
                },
                timeout=30,
            )
            answer = response.json()
            if not response.ok:
                raise RuntimeError(f"{answer['error']['code']}: {answer['error']['message']}")
            order = answer["order"]
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      description: |
        A unique key (up to 255 printable ASCII characters). The same key
        from your app within 24 hours answers the first result again, with
        `Idempotent-Replayed: true`, instead of creating twice.
      schema:
        type: string
        maxLength: 255
  schemas:
    OrderCreate:
      type: object
      required:
        - full_name
        - phone
        - address
        - payment_method
        - items
      additionalProperties: false
      properties:
        full_name:
          type: string
          maxLength: 255
        phone:
          type: string
          description: 7 to 15 digits.
        phone_alt:
          type: string
        email:
          type: string
          format: email
        country:
          type: string
          maxLength: 255
        city:
          type: string
          maxLength: 255
          description: The governorate.
        address:
          type: string
          maxLength: 1000
        sa_national_address:
          type: string
          maxLength: 255
        payment_method:
          type: string
          pattern: ^[a-z0-9_-]{2,50}$
          description: The payment method's key, e.g. `cod`.
        items:
          type: array
          minItems: 1
          maxItems: 100
          items:
            $ref: '#/components/schemas/ItemInput'
        shipping_cost:
          type: number
          minimum: 0
          maximum: 100000000
          description: The store's shipping cost when left out.
        total_cost:
          type: number
          minimum: 0
          maximum: 100000000
          description: The order's total. Cannot be sent with `coupon_codes`.
        coupon_codes:
          type: array
          maxItems: 10
          items:
            type: string
            maxLength: 64
        note:
          type: string
          maxLength: 2000
        ref:
          type: string
          maxLength: 255
        utm_source:
          type: string
          maxLength: 255
        utm_campaign:
          type: string
          maxLength: 255
        metadata:
          type: object
          additionalProperties: true
          description: Up to 4096 bytes. Reserved keys are refused.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: A stable, snake_case code. Branch on it, not on the message.
            message:
              type: string
              description: A human-readable explanation. It may change.
            details:
              description: More about the error, shaped per code.
    ItemInput:
      type: object
      required:
        - product_id
        - quantity
      additionalProperties: false
      properties:
        product_id:
          type: string
          format: uuid
          description: A product of the store.
        variant_id:
          type: string
          format: uuid
          description: Required when the product has variants.
        quantity:
          type: integer
          minimum: 1
          maximum: 10000
        price:
          type: number
          minimum: 0
          description: The unit price; the store's price when left out.
        metadata:
          type: object
          additionalProperties: true
          description: Up to 1024 bytes.
    Order:
      type: object
      properties:
        id:
          type: string
          format: uuid
        number:
          type: integer
          description: The store's order number, as the merchant sees it.
        status:
          type: string
          description: >-
            The order's status. Besides the values an app sets, orders the
            store's anti-spam checks hold can read `high_risk`, `moderate_risk`,
            `proxy_blacklisted` or `created`.
        payment_status:
          type:
            - string
            - 'null'
          description: >-
            One of the payment statuses; `null` for an older order that never
            had one.
        payment_method:
          type: string
          description: The payment method's key, e.g. `cod`.
        full_name:
          type: string
        email:
          type: string
        phone:
          type: string
        phone_alt:
          type: string
        country:
          type: string
        city:
          type: string
          description: The governorate (shipping area) the order ships to.
        address:
          type: string
        sa_national_address:
          type: string
          description: The Saudi national address, when the checkout asked for it.
        note:
          type: string
          description: The shopper's note at checkout.
        ref:
          type: string
        utm_source:
          type: string
        utm_campaign:
          type: string
        metadata:
          type: object
          additionalProperties: true
          description: >-
            Free key-value data, up to 4096 bytes. Orders created by an app
            carry `is_app_order` and `app_name`.
        product_cost:
          type: number
        shipping_cost:
          type: number
        coupon_code:
          type: string
        coupon_discount:
          type: number
        total_cost:
          type: number
        custom_currency:
          type: string
        is_digital:
          type: boolean
        shipping_status:
          type: string
          description: The shipping company's status, as it sent it.
        masked:
          type: boolean
          description: '`true` when the customer''s details are hidden; see `masked_reason`.'
        masked_reason:
          type:
            - string
            - 'null'
          description: >-
            `store_overdue` while the store has unpaid dues: the name keeps its
            first letters, the other customer fields and the metadata are empty.
        items:
          type: array
          description: >-
            The cart items. Present on a single order, and on lists with
            `join=items`.
          items:
            $ref: '#/components/schemas/OrderItem'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    FieldError:
      type: object
      required:
        - field
        - rule
      properties:
        field:
          type: string
          description: The JSON path of the input, e.g. `items[0].quantity`.
        rule:
          type: string
          description: The rule that failed, e.g. `required`, `between` or `in`.
        param:
          type: string
          description: The rule's parameter, e.g. `1,10000` for `between`.
    OrderItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
        product_id:
          type: string
          format: uuid
        variant_id:
          type:
            - string
            - 'null'
          format: uuid
        quantity:
          type: integer
        price:
          type: number
          description: The unit price.
        metadata:
          type: object
          additionalProperties: true
  responses:
    OrderCreated:
      description: The order created.
      headers:
        Idempotent-Replayed:
          description: >-
            `true` when this is the saved answer of an earlier request with the
            same `Idempotency-Key`.
          schema:
            type: string
      content:
        application/json:
          schema:
            type: object
            required:
              - order
            properties:
              order:
                $ref: '#/components/schemas/Order'
          example:
            order:
              id: 6f1c2a9e-8b4d-4e3a-9f7c-1d2e3f4a5b6c
              number: 1042
              status: confirmed
              payment_status: pending_payment
              payment_method: cod
              full_name: Mona Hassan
              email: ''
              phone: '+201001234567'
              phone_alt: ''
              country: Egypt
              city: Cairo
              address: 12 Tahrir St, Downtown
              sa_national_address: ''
              note: ''
              ref: ''
              utm_source: ''
              utm_campaign: ''
              metadata:
                is_app_order: true
                app_name: ERP Sync
                erp_ref: INV-778
              product_cost: 900
              shipping_cost: 60
              coupon_code: ''
              coupon_discount: 0
              total_cost: 960
              custom_currency: ''
              is_digital: false
              shipping_status: ''
              masked: false
              masked_reason: null
              items:
                - id: 2d3e4f5a-6b7c-4d8e-9f0a-1b2c3d4e5f60
                  product_id: 0b6f3c7e-3a1d-4a8e-9d5e-2f1b7c9a4e10
                  variant_id: null
                  quantity: 2
                  price: 450
                  metadata: {}
              created_at: '2026-12-04T10:15:00Z'
              updated_at: '2026-12-04T10:20:00Z'
    InvalidRequest:
      description: >-
        The body is not a JSON object, or has a field of the wrong type or an
        unknown field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: invalid_request
              message: 'Invalid JSON body: unknown field'
    Unauthenticated:
      description: The access token is missing, invalid or expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthenticated
              message: Missing or invalid access token
    PaymentRequired:
      description: Your app's subscription on this store is suspended.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: payment_required
              message: The app's subscription on this store is suspended
    InsufficientScope:
      description: The token lacks the scope this endpoint needs.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: insufficient_scope
              message: 'This request requires the scope: read_orders'
              details:
                required_scope: read_orders
    ValidationFailed:
      description: The request broke one or more rules; `details.fields` lists every one.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  error:
                    type: object
                    properties:
                      details:
                        type: object
                        properties:
                          fields:
                            type: array
                            items:
                              $ref: '#/components/schemas/FieldError'
          example:
            error:
              code: validation_failed
              message: Validation failed
              details:
                fields:
                  - field: items[0].quantity
                    rule: between
                    param: 1,10000
    RateLimited:
      description: More than 600 requests in a minute from your app on this store.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: too_many_requests
              message: Rate limit exceeded
  headers:
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  securitySchemes:
    accessToken:
      type: http
      scheme: bearer
      description: >
        An access token from the OAuth flow (`eo_at_...`). It lasts one hour;

        refresh it with the refresh token. See
        [Authentication](/authentication).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.