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

# Create Material Order

POST https://api.coperniq.io/v1/material-orders
Content-Type: application/json

Create a material order on a project.

Required fields:

* `recordId`: Project ID. Material orders can only be created on projects.
* `vendorId`: ID of the vendor the materials are ordered from
* `lineItems` and/or `sections`: at least one line

Optional fields: `title` (defaults to "Material Order"), `description`, `internalMemo`, `dueDate`.

**Line rules**

* Material orders are priced by cost: the total is `unitCost` × `quantity` across all lines. `unitCost` must be 0 or more.
* `unitPrice` is the selling price. It doesn't change the material order's total; it is copied to the project scope when the line is added there (see below).
* A `catalogItemId` may appear at most once per request.
* A line can link a project scope line item with `scopeLineItemId` (see below).
* Prices are in dollars.

**Linking scope line items**

Set `scopeLineItemId` on a line to the `id` of a scope line from `GET /projects/{project_id}/line-items`, so the material order tracks against the project's scope. Material orders always order by quantity, so lines don't take `billingMode` or `billingValue`.

* A scope line can be linked at most once per material order.
* A linked line must keep the scope line's `unitCost` and `unitPrice`.
* With Financials 2.0, a linked line that exceeds what is left on the scope line creates and approves a change order that increases the scope, instead of failing.
* New lines that are not linked are added to the scope with their `unitCost` and `unitPrice`. Removing a line from the material order later doesn't remove it from the scope.
* `PUT /projects/{project_id}/line-items` replaces scope lines, so their ids can change. Read them again before linking.

**Delivery details**

Delivery and supplier details (`deliveryMethod`, `deliveryWindow`, `pickupTime`, `deliveryRequestedFor`, `deliveryInstructions`, `supplierBranchNumber`, `supplierJobAccountNumber`, `pointOfContactUser`, `deliveryContactUser`) are read-only. They are set in the app when the vendor is a connected supplier (SRS Distribution or ABC Supply) and are returned when you read a material order.

Material orders can't be sent to a supplier through the API.

Reference: https://docs.coperniq.io/api-reference/material-orders/create-material-order

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects a MaterialOrderCreate.

- `recordId` (integer, required) — Project ID the material order belongs to
- `vendorId` (integer, required) — Vendor the materials are ordered from
- `title` (string, optional) — Title. Defaults to "Material Order".
- `description` (string, optional, nullable) — Material order description
- `internalMemo` (string, optional, nullable) — Internal-only memo, never shown to customers or on the PDF or portal. Rich text (HTML, like the app's editor stores). Only a non-empty value is stored on create.
- `dueDate` (string, optional) — Due date (ISO 8601 datetime string)
- `lineItems` (list of MaterialOrderLineItemCreate, optional) — Required when `sections` is not provided. May be combined with `sections` (ungrouped items).
- `sections` (list of MaterialOrderSection, optional) — Required when `lineItems` is not provided. Grouped line items with named sections.

## Response

### 201

Material order created successfully

- `id` (integer, required) — Material order identifier
- `status` (enum, required) — Material order status. `PENDING_SUPPLIER` is set only by a connected supplier (the order is queued and waiting for the supplier's order number). It is returned as-is and can't be set through the API.
  - Allowed values: `DRAFT`, `PENDING_SUPPLIER`, `SENT`, `SCHEDULED`, `PARTIALLY_FULFILLED`, `FULFILLED`, `CANCELED`
- `amount` (double, required) — Total amount in dollars
- `createdAt` (string, required) — Creation timestamp
- `updatedAt` (string, required) — Last update timestamp
- `materialOrderNumber` (integer, optional, nullable) — Unique material order number
- `title` (string, optional) — Material order title
- `description` (string, optional, nullable) — Material order description
- `internalMemo` (string, optional, nullable) — Internal-only memo, never shown to customers or on the PDF or portal. Rich text (HTML, like the app's editor stores). On update, send null or "" to clear it; responses return null when empty.
- `vendor` (MaterialOrderVendor, optional, nullable) — The vendor the materials are ordered from
- `record` (MaterialOrderRecord, optional, nullable) — The project the material order belongs to
- `issueDate` (string, optional, nullable) — Issue date
- `dueDate` (string, optional, nullable) — Due date
- `subtotal` (double, optional) — Subtotal in dollars
- `isArchived` (boolean, optional) — Whether the material order is archived
- `deliveryMethod` (enum, optional) — How the material is delivered. Read-only: set in the app when the vendor is a connected supplier. Each supplier uses its own subset of these values. - ABC Supply: `OUR_TRUCK_ROOF`, `OUR_TRUCK_GROUND`, `OUR_TRUCK_WINDOW`, `COMMON_CARRIER`, `CUSTOMER_PICKUP`, `EXPRESS_PICKUP`, `THIRD_PARTY_CARRIER` - SRS Distribution: `GROUND_DROP`, `ROOF_LOAD`, `ROOF_EDGE`, `WILL_CALL` (a branch pickup, which carries a `pickupTime` instead of a delivery window)
  - Allowed values: `OUR_TRUCK_ROOF`, `OUR_TRUCK_GROUND`, `OUR_TRUCK_WINDOW`, `COMMON_CARRIER`, `CUSTOMER_PICKUP`, `EXPRESS_PICKUP`, `THIRD_PARTY_CARRIER`, `GROUND_DROP`, `ROOF_LOAD`, `ROOF_EDGE`, `WILL_CALL`
- `deliveryWindow` (enum, optional) — Named delivery window. The branch sets the actual times. Pickups carry a `pickupTime` instead.
  - Allowed values: `ANYTIME`, `FIRST_STOP`, `MORNING`, `AFTERNOON`
- `pickupTime` (string, optional, nullable) — Pickup time (`HH:mm`, 24-hour) for an SRS `WILL_CALL` order
- `deliveryRequestedFor` (string, optional, nullable) — Requested delivery date (`YYYY-MM-DD`)
- `deliveryInstructions` (string, optional, nullable) — Delivery instructions (up to 255 characters)
- `supplierBranchNumber` (string, optional, nullable) — Supplier branch the material is ordered from
- `supplierJobAccountNumber` (integer, optional, nullable) — Supplier job account the order bills to
- `pointOfContactUser` (MaterialOrderPointOfContactUser, optional, nullable) — Team member the supplier should contact. `null` means the client.
- `deliveryContactUser` (MaterialOrderDeliveryContactUser, optional, nullable) — Team member who receives the delivery. `null` means the point of contact.
- `lineItems` (list of MaterialOrderLineItem, optional)

## Errors

### 400 Bad Request Error

Invalid request

- `message` (string, optional)
- `code` (enum, optional)
  - Allowed values: `UNAUTHORIZED`
- `field` (string, optional) — Field that caused the validation error (if applicable)

### 401 Unauthorized Error

Authentication failed

- `message` (string, optional)
- `code` (enum, optional)
  - Allowed values: `UNAUTHORIZED`

## Types

### MaterialOrderLineItemCreate

- `catalogItemId` (integer, required) — Catalog item identifier
- `quantity` (integer, required) — Quantity
- `unitCost` (double, required) — Cost per unit. The material order's total is the sum of `unitCost` × `quantity`.
- `unitPrice` (double, required) — Selling price per unit. It doesn't affect the material order's total; it is copied to the project scope when an unlinked line is added there.
- `id` (integer, optional) — Existing line item ID, to keep that line on update. Omit for new lines.
- `description` (string, optional, nullable) — Line item description
- `scopeLineItemId` (integer, optional) — ID of a project scope line item (from `GET /projects/{project_id}/line-items`) to link this line to, so billing tracks against the project's scope. * A scope line can be linked at most once per document. * A linked `QUANTITY` line must keep the scope line's `unitCost` and `unitPrice`. * With Financials 2.0, a linked `QUANTITY` line that exceeds what is left on the scope line creates and approves a change order that increases the scope, instead of failing. * Invoices on milestone-billed projects can't link scope lines. * `PUT /projects/{project_id}/line-items` replaces scope lines, so their ids can change. Read them again before linking. * On update, a kept line (sent with its `id`) keeps its scope link even if this field is omitted.

### MaterialOrderSection

A named section grouping one or more material order line items.

- `lineItems` (list of MaterialOrderLineItemCreate, required) — Line items within this section (at least one required)
- `id` (integer, optional) — Existing section ID (omit for new sections)
- `name` (string, optional, nullable) — Section name (1–500 chars). Omit or pass null for an unnamed section.

### MaterialOrderVendor

The vendor the materials are ordered from

- `id` (integer, optional)
- `name` (string, optional, nullable)

### MaterialOrderRecord

The project the material order belongs to

- `id` (integer, optional)
- `title` (string, optional)
- `type` (string, optional)

### MaterialOrderPointOfContactUser

Team member the supplier should contact. `null` means the client.

- `id` (integer, optional)

### MaterialOrderDeliveryContactUser

Team member who receives the delivery. `null` means the point of contact.

- `id` (integer, optional)

### MaterialOrderLineItem

- `id` (integer, required) — Line item identifier
- `quantity` (integer, required) — Quantity
- `unitCost` (double, required) — Cost per unit. The material order's total is the sum of `unitCost` × `quantity`.
- `unitPrice` (double, required) — Selling price per unit, as carried on the project scope. It doesn't affect the material order's total.
- `totalCost` (double, optional) — Total cost
- `totalPrice` (double, optional) — Total price
- `description` (string, optional, nullable) — Line item description
- `sectionName` (string, optional, nullable) — Name of the section the line belongs to (`null` when ungrouped)
- `catalogItem` (MaterialOrderLineItemCatalogItem, optional, nullable)
- `scopeLineItemId` (integer, optional, nullable) — ID of the project scope line item (from `GET /projects/{project_id}/line-items`) this line is linked to. `null` when unlinked.

### MaterialOrderLineItemCatalogItem

- `id` (integer, optional)
- `name` (string, optional)
- `manufacturer` (string, optional, nullable)
- `sku` (string, optional, nullable)
- `type` (enum, optional)
  - Allowed values: `PRODUCT`, `SERVICE`

## Examples

**Request**

```json
{
  "recordId": 789225,
  "vendorId": 3302,
  "title": "Roofing materials",
  "lineItems": [
    {
      "catalogItemId": 10379,
      "quantity": 12,
      "unitCost": 38.5,
      "unitPrice": 38.5,
      "scopeLineItemId": 9876
    }
  ]
}
```

**Response**

```json
{
  "id": 5521,
  "status": "DRAFT",
  "amount": 462,
  "createdAt": "2026-11-23T15:02:11.000Z",
  "updatedAt": "2026-11-23T15:02:11.000Z",
  "materialOrderNumber": 31,
  "title": "Roofing materials",
  "description": null,
  "internalMemo": null,
  "vendor": {
    "id": 3302,
    "name": "ABC Supply"
  },
  "record": {
    "id": 789225,
    "title": "12 Oak Street",
    "type": "Project"
  },
  "issueDate": null,
  "dueDate": null,
  "subtotal": 462,
  "isArchived": false,
  "deliveryMethod": null,
  "deliveryWindow": null,
  "pickupTime": null,
  "deliveryRequestedFor": null,
  "deliveryInstructions": null,
  "supplierBranchNumber": null,
  "supplierJobAccountNumber": null,
  "pointOfContactUser": null,
  "deliveryContactUser": null,
  "lineItems": [
    {
      "id": 88014,
      "quantity": 12,
      "unitCost": 38.5,
      "unitPrice": 38.5,
      "totalCost": 462,
      "totalPrice": 462,
      "description": null,
      "sectionName": null,
      "catalogItem": {
        "id": 10379,
        "name": "Architectural shingles",
        "manufacturer": "GAF",
        "sku": "GAF-TL-30",
        "type": "PRODUCT"
      },
      "scopeLineItemId": 9876
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.coperniq.io/v1/material-orders"

payload = {
    "recordId": 789225,
    "vendorId": 3302,
    "title": "Roofing materials",
    "lineItems": [
        {
            "catalogItemId": 10379,
            "quantity": 12,
            "unitCost": 38.5,
            "unitPrice": 38.5,
            "scopeLineItemId": 9876
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.coperniq.io/v1/material-orders';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"recordId":789225,"vendorId":3302,"title":"Roofing materials","lineItems":[{"catalogItemId":10379,"quantity":12,"unitCost":38.5,"unitPrice":38.5,"scopeLineItemId":9876}]}'
};

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.coperniq.io/v1/material-orders"

	payload := strings.NewReader("{\n  \"recordId\": 789225,\n  \"vendorId\": 3302,\n  \"title\": \"Roofing materials\",\n  \"lineItems\": [\n    {\n      \"catalogItemId\": 10379,\n      \"quantity\": 12,\n      \"unitCost\": 38.5,\n      \"unitPrice\": 38.5,\n      \"scopeLineItemId\": 9876\n    }\n  ]\n}")

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

	req.Header.Add("x-api-key", "<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.coperniq.io/v1/material-orders")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"recordId\": 789225,\n  \"vendorId\": 3302,\n  \"title\": \"Roofing materials\",\n  \"lineItems\": [\n    {\n      \"catalogItemId\": 10379,\n      \"quantity\": 12,\n      \"unitCost\": 38.5,\n      \"unitPrice\": 38.5,\n      \"scopeLineItemId\": 9876\n    }\n  ]\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.coperniq.io/v1/material-orders")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"recordId\": 789225,\n  \"vendorId\": 3302,\n  \"title\": \"Roofing materials\",\n  \"lineItems\": [\n    {\n      \"catalogItemId\": 10379,\n      \"quantity\": 12,\n      \"unitCost\": 38.5,\n      \"unitPrice\": 38.5,\n      \"scopeLineItemId\": 9876\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.coperniq.io/v1/material-orders', [
  'body' => '{
  "recordId": 789225,
  "vendorId": 3302,
  "title": "Roofing materials",
  "lineItems": [
    {
      "catalogItemId": 10379,
      "quantity": 12,
      "unitCost": 38.5,
      "unitPrice": 38.5,
      "scopeLineItemId": 9876
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.coperniq.io/v1/material-orders");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"recordId\": 789225,\n  \"vendorId\": 3302,\n  \"title\": \"Roofing materials\",\n  \"lineItems\": [\n    {\n      \"catalogItemId\": 10379,\n      \"quantity\": 12,\n      \"unitCost\": 38.5,\n      \"unitPrice\": 38.5,\n      \"scopeLineItemId\": 9876\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "recordId": 789225,
  "vendorId": 3302,
  "title": "Roofing materials",
  "lineItems": [
    [
      "catalogItemId": 10379,
      "quantity": 12,
      "unitCost": 38.5,
      "unitPrice": 38.5,
      "scopeLineItemId": 9876
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.coperniq.io/v1/material-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()
```