---
title: Create an order
slug: create-an-order
docTags: 
createdAt: 2026-04-17T07:48:39.600Z
---

{
  "id": "vku6dhFrK27IBxDGoUDkA",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.archbee.com/v2/orders",
    "servers": [
      {
        "url": "https://api.archbee.com/v2/orders",
        "description": "Production server"
      },
      {
        "url": "https://staging-api.archbee.com/v2/orders",
        "description": "Staging server"
      },
      {
        "url": "https://{region}.api.archbee.com/{version}/orders",
        "description": "Regional server with variables"
      }
    ],
    "name": "Create an order",
    "description": "<p>Creates a new order. The <code>shippingAddress</code> uses <code>anyOf</code> to accept either\na full address object or a reference to a saved address.\nThe <code>metadata</code> field demonstrates <code>additionalProperties</code> (map type).</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "CreateOrderRequest",
          "schema": [
            {
              "name": "items",
              "kind": "required",
              "type": "array",
              "description": "",
              "modelRef": "#/components/schemas/OrderItem",
              "customType": "OrderItem[]",
              "schema": [
                {
                  "name": "productId",
                  "kind": "required",
                  "type": "integer<int64>",
                  "description": "",
                  "example": 42,
                  "format": "int64",
                  "minimum": 1
                },
                {
                  "name": "quantity",
                  "kind": "required",
                  "type": "integer<int32>",
                  "description": "",
                  "example": 2,
                  "format": "int32",
                  "minimum": 1,
                  "maximum": 100
                },
                {
                  "name": "notes",
                  "kind": "optional",
                  "type": "string",
                  "description": "",
                  "example": "",
                  "maxLength": 200
                }
              ]
            },
            {
              "name": "shippingAddress",
              "kind": "required",
              "type": "object",
              "description": "",
              "complexType": "anyOf",
              "complexItems": [
                {
                  "name": "Address",
                  "description": "",
                  "modelRef": "#/components/schemas/Address",
                  "schema": [
                    {
                      "name": "street",
                      "kind": "required",
                      "type": "string",
                      "description": "",
                      "example": "123 Main St"
                    },
                    {
                      "name": "street2",
                      "kind": "optional",
                      "type": "string",
                      "description": "",
                      "example": "Apt 4B"
                    },
                    {
                      "name": "city",
                      "kind": "required",
                      "type": "string",
                      "description": "",
                      "example": "Springfield"
                    },
                    {
                      "name": "state",
                      "kind": "optional",
                      "type": "string",
                      "description": "",
                      "example": "IL"
                    },
                    {
                      "name": "zipCode",
                      "kind": "required",
                      "type": "string",
                      "description": "",
                      "example": "62701",
                      "pattern": "^\\d{5}(-\\d{4})?$"
                    },
                    {
                      "name": "country",
                      "kind": "required",
                      "type": "string",
                      "description": "ISO 3166-1 alpha-2 country code",
                      "example": "US",
                      "pattern": "^[A-Z]{2}$"
                    }
                  ]
                },
                {
                  "name": "SavedAddressRef",
                  "description": "",
                  "modelRef": "#/components/schemas/SavedAddressRef",
                  "schema": [
                    {
                      "name": "savedAddressId",
                      "kind": "required",
                      "type": "string<uuid>",
                      "description": "ID of a saved address in the user's address book",
                      "example": "770e8400-e29b-41d4-a716-446655440002",
                      "format": "uuid"
                    }
                  ]
                }
              ],
              "schema": []
            },
            {
              "name": "couponCode",
              "kind": "optional",
              "type": "string",
              "description": "",
              "example": "SAVE20",
              "pattern": "^[A-Z0-9]{4,12}$"
            },
            {
              "name": "metadata",
              "kind": "optional",
              "type": "map",
              "description": "Arbitrary key-value metadata (additionalProperties map)",
              "example": "{\"source\":\"mobile_app\",\"campaign\":\"summer_sale\",\"referrer\":\"user_123\"}",
              "customType": "map<string, string>",
              "schema": []
            }
          ],
          "modelRef": "#/components/schemas/CreateOrderRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "bearerAuth",
          "name": "bearerAuth",
          "kind": "optional",
          "type": "http",
          "description": "<p>HTTP Bearer token authentication (JWT)</p>",
          "scheme": "bearer"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Order created",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Order",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "string<uuid>",
                "readOnly": true,
                "description": "",
                "example": "880e8400-e29b-41d4-a716-446655440003",
                "format": "uuid"
              },
              {
                "name": "status",
                "kind": "optional",
                "type": "string<pending | confirmed | shipped | delivered | cancelled | refunded>",
                "readOnly": true,
                "description": "",
                "example": "pending",
                "enum": [
                  "pending",
                  "confirmed",
                  "shipped",
                  "delivered",
                  "cancelled",
                  "refunded"
                ]
              },
              {
                "name": "items",
                "kind": "optional",
                "type": "array",
                "description": "",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "subtotal",
                "kind": "optional",
                "type": "number<double>",
                "readOnly": true,
                "description": "",
                "example": 159.98,
                "format": "double"
              },
              {
                "name": "tax",
                "kind": "optional",
                "type": "number<double>",
                "readOnly": true,
                "description": "",
                "example": 12.8,
                "format": "double"
              },
              {
                "name": "total",
                "kind": "optional",
                "type": "number<double>",
                "readOnly": true,
                "description": "",
                "example": 172.78,
                "format": "double"
              },
              {
                "name": "shippingAddress",
                "kind": "optional",
                "type": "object",
                "description": "Full mailing address",
                "modelRef": "#/components/schemas/Address",
                "customType": "Address",
                "schema": [
                  {
                    "name": "street",
                    "kind": "required",
                    "type": "string",
                    "description": "",
                    "example": "123 Main St"
                  },
                  {
                    "name": "street2",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "Apt 4B"
                  },
                  {
                    "name": "city",
                    "kind": "required",
                    "type": "string",
                    "description": "",
                    "example": "Springfield"
                  },
                  {
                    "name": "state",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "IL"
                  },
                  {
                    "name": "zipCode",
                    "kind": "required",
                    "type": "string",
                    "description": "",
                    "example": "62701",
                    "pattern": "^\\d{5}(-\\d{4})?$"
                  },
                  {
                    "name": "country",
                    "kind": "required",
                    "type": "string",
                    "description": "ISO 3166-1 alpha-2 country code",
                    "example": "US",
                    "pattern": "^[A-Z]{2}$"
                  }
                ]
              },
              {
                "name": "metadata",
                "kind": "optional",
                "type": "map",
                "description": "",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "tracking",
                "kind": "optional",
                "type": "object",
                "readOnly": true,
                "description": "Nested tracking info (populated after shipping)",
                "example": "",
                "schema": [
                  {
                    "name": "carrier",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "FedEx"
                  },
                  {
                    "name": "trackingNumber",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": 794644790132
                  },
                  {
                    "name": "estimatedDelivery",
                    "kind": "optional",
                    "type": "string<date>",
                    "description": "",
                    "example": "2025-07-15",
                    "format": "date"
                  },
                  {
                    "name": "events",
                    "kind": "optional",
                    "type": "array",
                    "description": "",
                    "example": "",
                    "itemType": "object",
                    "customType": "object[]",
                    "schema": [
                      {
                        "name": "timestamp",
                        "kind": "optional",
                        "type": "string<date-time>",
                        "description": "",
                        "example": "",
                        "format": "date-time"
                      },
                      {
                        "name": "location",
                        "kind": "optional",
                        "type": "string",
                        "description": "",
                        "example": ""
                      },
                      {
                        "name": "description",
                        "kind": "optional",
                        "type": "string",
                        "description": "",
                        "example": ""
                      }
                    ]
                  }
                ]
              },
              {
                "name": "createdAt",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "",
                "example": "",
                "format": "date-time"
              },
              {
                "name": "updatedAt",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "",
                "example": "",
                "format": "date-time"
              }
            ],
            "modelRef": "#/components/schemas/Order",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad request — invalid input or missing required fields",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"code\":\"BAD_REQUEST\",\"message\":\"The request body is invalid\",\"details\":[{\"field\":\"email\",\"message\":\"must be a valid email address\",\"code\":\"INVALID_FORMAT\"}]}",
            "description": "Standard error response",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "required",
                "type": "string",
                "description": "Machine-readable error code",
                "example": "VALIDATION_ERROR"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Human-readable error message",
                "example": "The request body contains invalid fields"
              },
              {
                "name": "details",
                "kind": "optional",
                "type": "array",
                "description": "Detailed validation errors (when applicable)",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": [
                  {
                    "name": "field",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "email"
                  },
                  {
                    "name": "message",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "must be a valid email address"
                  },
                  {
                    "name": "code",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "INVALID_FORMAT"
                  }
                ]
              },
              {
                "name": "requestId",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "Correlation ID for support inquiries",
                "example": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "422",
        "description": "Unprocessable entity — validation failed",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"code\":\"VALIDATION_ERROR\",\"message\":\"The request body failed validation\",\"details\":[{\"field\":\"price\",\"message\":\"must be greater than 0\",\"code\":\"INVALID_VALUE\"},{\"field\":\"name\",\"message\":\"must be between 1 and 200 characters\",\"code\":\"INVALID_LENGTH\"}]}",
            "description": "Standard error response",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "required",
                "type": "string",
                "description": "Machine-readable error code",
                "example": "VALIDATION_ERROR"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Human-readable error message",
                "example": "The request body contains invalid fields"
              },
              {
                "name": "details",
                "kind": "optional",
                "type": "array",
                "description": "Detailed validation errors (when applicable)",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": [
                  {
                    "name": "field",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "email"
                  },
                  {
                    "name": "message",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "must be a valid email address"
                  },
                  {
                    "name": "code",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "INVALID_FORMAT"
                  }
                ]
              },
              {
                "name": "requestId",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "Correlation ID for support inquiries",
                "example": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "8a57ePv8n-AEwPrCh_J_C",
          "language": "curl",
          "code": "curl -X POST \"https://api.archbee.com/v2/orders\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"items\": [{\"productId\": 42, \"quantity\": 2}],\n    \"shippingAddress\": {\n      \"street\": \"123 Main St\",\n      \"city\": \"Springfield\",\n      \"state\": \"IL\",\n      \"zipCode\": \"62701\",\n      \"country\": \"US\"\n    }\n  }'\n"
        },
        {
          "id": "RHi303PzjzGcURetGu08W",
          "language": "python",
          "code": "import requests\n\nresponse = requests.post(\n    \"https://api.archbee.com/v2/orders\",\n    headers={\n        \"Authorization\": \"Bearer YOUR_TOKEN\",\n        \"Content-Type\": \"application/json\"\n    },\n    json={\n        \"items\": [{\"productId\": 42, \"quantity\": 2}],\n        \"shippingAddress\": {\n            \"street\": \"123 Main St\",\n            \"city\": \"Springfield\",\n            \"state\": \"IL\",\n            \"zipCode\": \"62701\",\n            \"country\": \"US\"\n        }\n    }\n)\n"
        }
      ],
      "selectedLanguageId": "8a57ePv8n-AEwPrCh_J_C"
    },
    "hasXCodeSamples": true,
    "results": {
      "languages": [
        {
          "id": "DMrAh38dXsqYPbMaWfNNo",
          "language": "201",
          "code": "// Order created\n{\n  \"id\": \"880e8400-e29b-41d4-a716-446655440003\",\n  \"status\": \"pending\",\n  \"items\": [\n    {}\n  ],\n  \"subtotal\": 159.98,\n  \"tax\": 12.8,\n  \"total\": 172.78,\n  \"shippingAddress\": {\n    \"street\": \"123 Main St\",\n    \"street2\": \"Apt 4B\",\n    \"city\": \"Springfield\",\n    \"state\": \"IL\",\n    \"zipCode\": \"62701\",\n    \"country\": \"US\"\n  },\n  \"metadata\": \"\",\n  \"tracking\": {\n    \"carrier\": \"FedEx\",\n    \"trackingNumber\": 794644790132,\n    \"estimatedDelivery\": \"2025-07-15\",\n    \"events\": [\n      {\n        \"timestamp\": \"\",\n        \"location\": \"\",\n        \"description\": \"\"\n      }\n    ]\n  },\n  \"createdAt\": \"\",\n  \"updatedAt\": \"\"\n}"
        },
        {
          "id": "MibziD_9otyRE3H83dnWQ",
          "language": "400",
          "code": "// Bad request — invalid input or missing required fields\n{\n  \"code\": \"VALIDATION_ERROR\",\n  \"message\": \"The request body contains invalid fields\",\n  \"details\": [\n    {\n      \"field\": \"email\",\n      \"message\": \"must be a valid email address\",\n      \"code\": \"INVALID_FORMAT\"\n    }\n  ],\n  \"requestId\": \"\"\n}"
        },
        {
          "id": "QLTyVyaNTOB058XBqLeuR",
          "language": "422",
          "code": "// Unprocessable entity — validation failed\n{\n  \"code\": \"VALIDATION_ERROR\",\n  \"message\": \"The request body contains invalid fields\",\n  \"details\": [\n    {\n      \"field\": \"email\",\n      \"message\": \"must be a valid email address\",\n      \"code\": \"INVALID_FORMAT\"\n    }\n  ],\n  \"requestId\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "DMrAh38dXsqYPbMaWfNNo"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}