POST /v1/order-intents

Create Order Intent

Summary

Create a new draftable order intent

Description

Creates a new OrderIntent that captures user checkout intent. OrderIntents are mutable while in draft status and can be edited before submission. Supports both board_id and dfm_run_id references for design specification.

Request Example

curl -X POST "http://127.0.0.1:8000/api/v1/order-intents" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dfm_run_id":"dfm_abc","quantity":10,"lead_time":"standard","ship_to":{"country":"US","postal_code":"94107"},"build":{"type":"bare_pcb"}}'

Response Example

{
  "order_intent_id": "oi_abc123def456",
  "org_id": "user_123",
  "user_id": "user_123",
  "status": "draft",
  "created_at": "2024-01-27T21:12:00Z",
  "updated_at": "2024-01-27T21:12:00Z",
  "board_id": null,
  "dfm_run_id": "dfm_abc",
  "quantity": 10,
  "lead_time": "standard",
  "ship_to": {
    "country": "US",
    "postal_code": "94107"
  },
  "build": {
    "type": "bare_pcb"
  },
  "policy_id": null,
  "notes": null,
  "latest_quote_id": null,
  "latest_order_id": null
}

Error Codes

This endpoint may return the following error codes:

Code Status Meaning
missing_auth 401 No Authorization header provided
invalid_api_key 403 API key is invalid or missing
invalid_quantity 400 Quantity must be between 1 and 100000
invalid_lead_time 400 Lead time must be 'standard' or 'expedite'

Authentication

This endpoint requires Bearer token authentication:

Authorization: Bearer YOUR_API_KEY