# Draft a purchase order

`POST /shop/purchase-orders` · Rivier · shop

Draft a purchase order.

- Scope: shop:write
- Mcp: rivier_shop_po_create
- Sdk: shop.purchaseOrder.create
- Cli: shop purchase order create
- Events: shop.purchaseOrder.drafted

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "supplierId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "variantId": {
            "type": "string",
            "format": "uuid"
          },
          "sku": {
            "type": "string",
            "maxLength": 100
          },
          "qty": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000000
          },
          "unitCost": {
            "type": "object",
            "properties": {
              "amountMinor": {
                "type": "integer",
                "minimum": 0
              },
              "currency": {
                "type": "string",
                "minLength": 3,
                "maxLength": 3
              }
            },
            "required": [
              "amountMinor",
              "currency"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "variantId",
          "qty",
          "unitCost"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 200
    },
    "expectedAt": {
      "type": "string",
      "format": "date-time"
    },
    "note": {
      "type": "string",
      "maxLength": 500
    }
  },
  "required": [
    "supplierId",
    "lines"
  ],
  "additionalProperties": false
}
```

## Responses

- `201`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/shop/purchase-orders' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "supplierId": "string",
  "lines": [
    {
      "variantId": "string",
      "qty": 0,
      "unitCost": {
        "amountMinor": 0,
        "currency": "string"
      }
    }
  ]
}'
```
