> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Create Order

POST https://api-b2b.bigcommerce.com/api/v3/io/orders
Content-Type: application/json

Generates an order record in B2B Edition after a Company user places an order. This occurs automatically; however, you can populate extra information on a B2B order by using a [webhook](/developer/docs/integrations/webhooks) that first listens for BigCommerce order creation and then calls the Create an Order endpoint. The request must be made within 10 seconds of an order's creation for it to be successful.

This endpoint **does not** create a new order in your store. Use the [Orders V2 API](/developer/api-reference/rest/admin/management/orders) to add new orders via the API.

Reference: https://docs.bigcommerce.com/developer/api-reference/rest/b2b/management/orders/post-orders

## Authentication

- `X-Auth-Token` header (required) — | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts). | For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-fundamentals/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).
- `X-Store-Hash` header (required) — | Header | Argument | Description | |:-------|:---------|:------------| | `X-Store-Hash` | `store_hash` | The unique store hash associated with a BigCommerce store that has B2B Edition enabled. |

## Request

### Body (application/json)

This endpoint expects a createOrder.

- `bcOrderId` (integer, required) — The BigCommerce order ID.
- `customerId` (integer, required) — The ID of a BigCommerce customer account with a corresponding Company user account.
- `poNumber` (string, optional) — The order's Purchase Order (PO), if used.
- `extraFields` (list of any, optional) — Contains extra field information associated with the order.

## Response

### 200

OK

- `code` (integer, optional, default: 200) — HTTP Response Code
- `data` (orderData_ALL, optional)
- `meta` (meta_full, optional)

## Errors

### 400 Bad Request Error

Bad Request This error occurs if the order has existed for longer than 10 seconds before making the request.

- `code` (double, required)
- `data` (OrdersPostResponsesContentApplicationJsonSchemaData, required)
- `meta` (OrdersPostResponsesContentApplicationJsonSchemaMeta, required)

## Types

### orderData_ALL

- `id` (integer, optional) — The unique identifier of the order in B2B Edition.
- `bcOrderId` (integer, optional) — The BigCommerce order ID.
- `totalIncTax` (float, optional) — The order's total value including tax.
- `poNumber` (string, optional) — The order's Purchase Order (PO), if used.
- `status` (string, optional) — The default name of the order status. See [Order Statuses](/developer/api-reference/rest/admin/management/orders/order-status) for a complete list of accepted status names. -
- `customStatus` (string, optional) — The customized name of the order status.
- `cartId` (integer, optional) — The unique identifier of the cart generated for the order.
- `items` (integer, optional) — The total quantity of products in the order.
- `usdIncTax` (float, optional) — The order's total value in USD, including tax.
- `companyId` (integer, optional) — The unique numeric ID of a Company account.
- `currencyCode` (string, optional) — The three-letter code corresponding to the order’s currency.
- `money` (list of MoneyItems, optional) — Contains detailed information regarding the order's currency.
- `statusCode` (integer, optional) — The numeric code associated with the order status. See [Order Statuses](/developer/api-reference/rest/admin/management/orders/order-status) for a complete list of accepted status names.
- `isArchived` (boolean, optional) — Indicates whether the order is archived.
- `channelId` (integer, optional) — The storefront channel ID where the order was placed.
- `channelName` (string, optional) — The name of the storefront channel where the order was placed.
- `extraInt1` (integer, optional) — A legacy integer extra field configuration that does not return data in newer stores.
- `extraInt2` (integer, optional) — A legacy integer extra field configuration that does not return data in newer stores.
- `extraInt3` (integer, optional) — A legacy integer extra field configuration that does not return data in newer stores.
- `extraInt4` (integer, optional) — A legacy integer extra field configuration that does not return data in newer stores.
- `extraInt5` (integer, optional) — A legacy integer extra field configuration that does not return data in newer stores.
- `extraStr1` (string, optional) — A legacy string extra field configuration that does not return data in newer stores.
- `extraStr2` (string, optional) — A legacy string extra field configuration that does not return data in newer stores.
- `extraStr3` (string, optional) — A legacy string extra field configuration that does not return data in newer stores.
- `extraStr4` (string, optional) — A legacy string extra field configuration that does not return data in newer stores.
- `extraStr5` (string, optional) — A legacy string extra field configuration that does not return data in newer stores.
- `extraText` (string, optional) — A legacy text extra field configuration that does not return data in newer stores.
- `extraInfo` (list of ExtraInfoItems, optional) — Contains billing and shipping address identifiers.
- `extraFields` (list of any, optional) — Contains extra field information associated with the order.
- `createdAt` (integer, optional) — The [Unix timestamp](https://www.unixtimestamp.com/) for when the order was created. This is a read-only field.
- `updatedAt` (integer, optional) — The [Unix timestamp](https://www.unixtimestamp.com/) for when the order was last updated. This is a read-only field.

### meta_full

- `pagination` (MetaFullPagination, optional)
- `message` (string, optional, default: SUCCESS)

### OrdersPostResponsesContentApplicationJsonSchemaData

### OrdersPostResponsesContentApplicationJsonSchemaMeta

- `message` (string, required, default: The order already exists.)

### MoneyItems

- `currencyLocation` (enum, optional) — Determines whether the currency symbol is added to the left or the right of order pricing.
  - Allowed values: `left`, `right`
- `currencyToken` (string, optional) — The currency symbol.
- `decimalToken` (string, optional) — The character used to separate the whole number from the decimal in order pricing.
- `decimalPlaces` (integer, optional) — The number of decimal places used in order pricing.
- `thousandsToken` (string, optional) — The character used to separate the hundredths and thousandths places in order pricing."

### ExtraInfoItems

- `billingAddressId` (integer, optional) — The unique identifier for billing address in the Company account.
- `shippingAddressId` (integer, optional) — The unique identifier for shipping address in the Company account.

### MetaFullPagination

- `totalCount` (integer, optional) — The total number of records available.
- `limit` (integer, optional) — The number of records returned per page.
- `offset` (integer, optional) — The number of records skipped before returning the first record.

## Examples

**Request**

```json
{
  "bcOrderId": 123,
  "customerId": 321
}
```

**Response**

```json
{
  "code": 200,
  "data": {
    "id": 12345,
    "bcOrderId": 123,
    "totalIncTax": 2210.47,
    "poNumber": "04152025-0002",
    "status": "Awaiting Payment",
    "customStatus": "Invoice Sent",
    "cartId": "095a15a6-8a27-4c20-b357-36b82e9d5929",
    "items": 50,
    "usdIncTax": 2210.47,
    "companyId": 12345,
    "currencyCode": "USD",
    "money": [
      {
        "currencyLocation": "left",
        "currencyToken": "$",
        "decimalToken": ".",
        "decimalPlaces": 2,
        "thousandsToken": ","
      }
    ],
    "statusCode": 7,
    "isArchived": false,
    "channelId": 1,
    "channelName": "B2B Store",
    "extraInt1": 12345,
    "extraInt2": 12345,
    "extraInt3": 12345,
    "extraInt4": 12345,
    "extraInt5": 12345,
    "extraStr1": "Great Buys Incorporated",
    "extraStr2": "Great Buys Incorporated",
    "extraStr3": "Great Buys Incorporated",
    "extraStr4": "Great Buys Incorporated",
    "extraStr5": "Great Buys Incorporated",
    "extraText": "Great Buys Incorporated",
    "extraInfo": [
      {
        "billingAddressId": 12345,
        "shippingAddressId": 12345
      }
    ],
    "extraFields": [
      {
        "fieldName": "Fintech ID",
        "fieldValue": "1234567890"
      }
    ],
    "createdAt": 1744735719,
    "updatedAt": 1744735734
  },
  "meta": {
    "pagination": {
      "totalCount": 100,
      "limit": 10,
      "offset": 0
    },
    "message": "SUCCESS"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api-b2b.bigcommerce.com/api/v3/io/orders"

payload = {
    "bcOrderId": 123,
    "customerId": 321
}
headers = {
    "X-Auth-Token": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-b2b.bigcommerce.com/api/v3/io/orders';
const options = {
  method: 'POST',
  headers: {'X-Auth-Token': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"bcOrderId":123,"customerId":321}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-b2b.bigcommerce.com/api/v3/io/orders"

	payload := strings.NewReader("{\n  \"bcOrderId\": 123,\n  \"customerId\": 321\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Auth-Token", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api-b2b.bigcommerce.com/api/v3/io/orders")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Auth-Token"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"bcOrderId\": 123,\n  \"customerId\": 321\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-b2b.bigcommerce.com/api/v3/io/orders")
  .header("X-Auth-Token", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"bcOrderId\": 123,\n  \"customerId\": 321\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-b2b.bigcommerce.com/api/v3/io/orders', [
  'body' => '{
  "bcOrderId": 123,
  "customerId": 321
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Auth-Token' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api-b2b.bigcommerce.com/api/v3/io/orders");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Auth-Token", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"bcOrderId\": 123,\n  \"customerId\": 321\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Auth-Token": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "bcOrderId": 123,
  "customerId": 321
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-b2b.bigcommerce.com/api/v3/io/orders")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```