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

# Create Purchase Order

> This endpoint creates a new purchase order

### Body

<ParamField body="id" type="string">
  This is the id of the purchase order.
</ParamField>

<ParamField body="createdat" type="string">
  This is the date the purchase order was created.
</ParamField>

<ParamField body="delivery_date" type="string">
  This is the date the purchase order was delivered.
</ParamField>

<ParamField body="description" type="string">
  This is the description of the purchase order.
</ParamField>

<ParamField body="external_id" type="string">
  This is the external id of the purchase order.
</ParamField>

<ParamField body="financer" type="string">
  This is the financer of the purchase order.
</ParamField>

<ParamField body="fulfiller" type="string">
  This is the fulfiller of the purchase order.
</ParamField>

<ParamField body="lastupdated" type="string">
  This is the date the purchase order was last updated.
</ParamField>

<ParamField body="purchase_date" type="string">
  This is the date the purchase order was purchased.
</ParamField>

<ParamField body="purchase_order_hash" type="string">
  This is the hash of the purchase order.
</ParamField>

<ParamField body="purchase_order_name" type="string">
  This is the name of the purchase order.
</ParamField>

<ParamField body="purchase_order_number" type="string">
  This is the number of the purchase order.
</ParamField>

<ParamField body="purchase_order_status" type="string">
  This is the status of the purchase order.
</ParamField>

<ParamField body="purchaser" type="string">
  This is the purchaser of the purchase order.
</ParamField>

<ParamField body="subtotal" type="string">
  This is the subtotal of the purchase order.
</ParamField>

<ParamField body="total" type="string">
  This is the total of the purchase order.
</ParamField>

<ParamField body="vendor" type="string">
  This is the vendor of the purchase order.
</ParamField>

<ParamField body="transaction_id" type="string">
  This is the transaction id of the purchase order.
</ParamField>

### Response

<ResponseField name="id" type="string">
  This is the id of the purchase order.
</ResponseField>

<ResponseField name="createdat" type="string">
  This is the date the purchase order was created.
</ResponseField>

<ResponseField name="delivery_date" type="string">
  This is the date the purchase order was delivered.
</ResponseField>

<ResponseField name="description" type="string">
  This is the description of the purchase order.
</ResponseField>

<ResponseField name="external_id" type="string">
  This is the external id of the purchase order.
</ResponseField>

<ResponseField name="financer" type="string">
  This is the financer of the purchase order.
</ResponseField>

<ResponseField name="fulfiller" type="string">
  This is the fulfiller of the purchase order.
</ResponseField>

<ResponseField name="lastupdated" type="string">
  This is the date the purchase order was last updated.
</ResponseField>

<ResponseField name="purchase_date" type="string">
  This is the date the purchase order was purchased.
</ResponseField>

<ResponseField name="purchase_order_hash" type="string">
  This is the hash of the purchase order.
</ResponseField>

<ResponseField name="purchase_order_name" type="string">
  This is the name of the purchase order.
</ResponseField>

<ResponseField name="purchase_order_number" type="string">
  This is the number of the purchase order.
</ResponseField>

<ResponseField name="purchase_order_status" type="string">
  This is the status of the purchase order.
</ResponseField>

<ResponseField name="purchaser" type="string">
  This is the purchaser of the purchase order.
</ResponseField>

<ResponseField name="subtotal" type="string">
  This is the subtotal of the purchase order.
</ResponseField>

<ResponseField name="total" type="string">
  This is the total of the purchase order.
</ResponseField>

<ResponseField name="vendor" type="string">
  This is the vendor of the purchase order.
</ResponseField>

<ResponseField name="transaction_id" type="string">
  This is the transaction id of the purchase order.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.stateset.com/v1/purchaseorders \
    -H "Authorization: Bearer ${STATESET_API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{
      "purchase_order_number": "PO-2026-001234",
      "description": "Q1 inventory restock — blue t-shirts",
      "vendor": "Acme Textiles Inc.",
      "total": "4500.00",
      "subtotal": "4200.00",
      "purchase_date": "2026-01-15T00:00:00.000Z",
      "delivery_date": "2026-02-01T00:00:00.000Z"
    }'
  ```

  ```graphQL GraphQL theme={null}
  mutation InsertNewPurchaseOrder(
    $po: purchaseorders_insert_input!
  ) {
    insert_purchaseorders(objects: [$po]) {
      returning {
        id
        purchase_order_number
        description
        vendor
        total
        subtotal
        purchase_order_status
        purchase_date
        delivery_date
      }
    }
  }
  ```

  ```js Node.js theme={null}
  const purchaseOrder = await stateset.purchaseOrders.create({
    purchase_order_number: 'PO-2026-001234',
    description: 'Q1 inventory restock — blue t-shirts',
    vendor: 'Acme Textiles Inc.',
    total: '4500.00',
    subtotal: '4200.00',
    purchase_date: '2026-01-15T00:00:00.000Z',
    delivery_date: '2026-02-01T00:00:00.000Z',
  });
  ```

  ```python Python theme={null}
  purchase_order = stateset.purchase_orders.create(
      purchase_order_number="PO-2026-001234",
      description="Q1 inventory restock — blue t-shirts",
      vendor="Acme Textiles Inc.",
      total="4500.00",
      subtotal="4200.00",
      purchase_date="2026-01-15T00:00:00.000Z",
      delivery_date="2026-02-01T00:00:00.000Z",
  )
  ```

  ```ruby Ruby theme={null}
  purchase_order = Stateset::PurchaseOrder.create({
    purchase_order_number: 'PO-2026-001234',
    description: 'Q1 inventory restock — blue t-shirts',
    vendor: 'Acme Textiles Inc.',
    total: '4500.00',
    subtotal: '4200.00',
    purchase_date: '2026-01-15T00:00:00.000Z',
    delivery_date: '2026-02-01T00:00:00.000Z',
  })
  ```

  ```go Go theme={null}
  purchaseOrder, err := stateset.PurchaseOrders.Create(&stateset.PurchaseOrderParams{
    PurchaseOrderNumber: "PO-2026-001234",
    Description:         "Q1 inventory restock — blue t-shirts",
    Vendor:              "Acme Textiles Inc.",
    Total:               "4500.00",
    Subtotal:            "4200.00",
    PurchaseDate:        "2026-01-15T00:00:00.000Z",
    DeliveryDate:        "2026-02-01T00:00:00.000Z",
  })
  ```

  ```java Java theme={null}
  Map<String, Object> params = new HashMap<>();
  params.put("purchase_order_number", "PO-2026-001234");
  params.put("description", "Q1 inventory restock — blue t-shirts");
  params.put("vendor", "Acme Textiles Inc.");
  params.put("total", "4500.00");
  params.put("subtotal", "4200.00");
  params.put("purchase_date", "2026-01-15T00:00:00.000Z");
  params.put("delivery_date", "2026-02-01T00:00:00.000Z");

  PurchaseOrder purchaseOrder = stateset.purchaseOrders().create(params);
  ```

  ```php PHP theme={null}
  $purchaseOrder = $stateset->purchaseOrders->create([
    'purchase_order_number' => 'PO-2026-001234',
    'description' => 'Q1 inventory restock — blue t-shirts',
    'vendor' => 'Acme Textiles Inc.',
    'total' => '4500.00',
    'subtotal' => '4200.00',
    'purchase_date' => '2026-01-15T00:00:00.000Z',
    'delivery_date' => '2026-02-01T00:00:00.000Z',
  ]);
  ```

  ```csharp C# theme={null}
  var purchaseOrder = await stateset.PurchaseOrders.CreateAsync(
      new PurchaseOrderCreateParams
      {
          PurchaseOrderNumber = "PO-2026-001234",
          Description = "Q1 inventory restock — blue t-shirts",
          Vendor = "Acme Textiles Inc.",
          Total = "4500.00",
          Subtotal = "4200.00",
          PurchaseDate = "2026-01-15T00:00:00.000Z",
          DeliveryDate = "2026-02-01T00:00:00.000Z"
      }
  );
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "id": "po_1a2b3c4d5e6f",
      "createdat": "2026-01-15T12:00:00.000Z",
      "delivery_date": "2026-02-01T00:00:00.000Z",
      "description": "Q1 inventory restock — blue t-shirts",
      "external_id": "ext_po_98765",
      "financer": "fin_abc123",
      "fulfiller": "ful_def456",
      "lastupdated": "2026-01-15T12:00:00.000Z",
      "purchase_date": "2026-01-15T00:00:00.000Z",
      "purchase_order_hash": "a1b2c3d4e5f6",
      "purchase_order_name": "Q1 Blue T-Shirt Restock",
      "purchase_order_number": "PO-2026-001234",
      "purchase_order_status": "created",
      "purchaser": "usr_abc123",
      "subtotal": "4200.00",
      "total": "4500.00",
      "vendor": "Acme Textiles Inc.",
      "transaction_id": "txn_789xyz"
  }
  ```
</ResponseExample>
