> ## 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.

# Update Purchase Order

> This endpoint updates an existing 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 PUT https://api.stateset.com/v1/purchaseorders/po_1a2b3c4d5e6f \
    -H "Authorization: Bearer ${STATESET_API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{
      "purchase_order_status": "received",
      "delivery_date": "2026-01-28T00:00:00.000Z"
    }'
  ```

  ```graphQL GraphQL theme={null}
  mutation UpdatePurchaseOrder(
    $purchaseorder_id: String!
    $purchaseorder_x: purchaseorders_set_input!
  ) {
    update_purchaseorders(
      where: { id: { _eq: $purchaseorder_id } }
      _set: $purchaseorder_x
    ) {
      returning {
        id
        purchase_order_number
        purchase_order_status
        description
        vendor
        total
        subtotal
        delivery_date
        lastupdated
      }
    }
  }
  ```

  ```js Node.js theme={null}
  const purchaseOrder = await stateset.purchaseOrders.update(
    'po_1a2b3c4d5e6f',
    {
      purchase_order_status: 'received',
      delivery_date: '2026-01-28T00:00:00.000Z',
    }
  );
  ```

  ```python Python theme={null}
  purchase_order = stateset.purchase_orders.update(
      "po_1a2b3c4d5e6f",
      purchase_order_status="received",
      delivery_date="2026-01-28T00:00:00.000Z",
  )
  ```

  ```ruby Ruby theme={null}
  purchase_order = Stateset::PurchaseOrder.update(
    'po_1a2b3c4d5e6f',
    {
      purchase_order_status: 'received',
      delivery_date: '2026-01-28T00:00:00.000Z',
    }
  )
  ```

  ```go Go theme={null}
  purchaseOrder, err := stateset.PurchaseOrders.Update(
    "po_1a2b3c4d5e6f",
    &stateset.PurchaseOrderUpdateParams{
      PurchaseOrderStatus: "received",
      DeliveryDate:        "2026-01-28T00:00:00.000Z",
    },
  )
  ```

  ```java Java theme={null}
  Map<String, Object> params = new HashMap<>();
  params.put("purchase_order_status", "received");
  params.put("delivery_date", "2026-01-28T00:00:00.000Z");

  PurchaseOrder purchaseOrder = stateset.purchaseOrders().update(
      "po_1a2b3c4d5e6f", params
  );
  ```

  ```php PHP theme={null}
  $purchaseOrder = $stateset->purchaseOrders->update(
    'po_1a2b3c4d5e6f',
    [
      'purchase_order_status' => 'received',
      'delivery_date' => '2026-01-28T00:00:00.000Z',
    ]
  );
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "id": "po_1a2b3c4d5e6f",
      "createdat": "2026-01-15T12:00:00.000Z",
      "delivery_date": "2026-01-28T00:00:00.000Z",
      "description": "Q1 inventory restock — blue t-shirts",
      "external_id": "ext_po_98765",
      "financer": "fin_abc123",
      "fulfiller": "ful_def456",
      "lastupdated": "2026-01-28T09:30: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": "received",
      "purchaser": "usr_abc123",
      "subtotal": "4200.00",
      "total": "4500.00",
      "vendor": "Acme Textiles Inc.",
      "transaction_id": "txn_789xyz"
  }
  ```
</ResponseExample>
