Purchase Orders
Create, send, accept, and convert purchase orders to invoices.
|
Endpoints
| GET | /api/v1/purchase-orders | List purchase orders |
| POST | /api/v1/purchase-orders | Create a purchase order |
| GET | /api/v1/purchase-orders/{id} | Get a purchase order |
| PATCH | /api/v1/purchase-orders/{id} | Update a purchase order |
| DELETE | /api/v1/purchase-orders/{id} | Delete a purchase order |
| POST | /api/v1/purchase-orders/{id}/send | Mark as sent |
| POST | /api/v1/purchase-orders/{id}/accept | Accept |
| POST | /api/v1/purchase-orders/{id}/convert | Convert to invoice |
| GET | /api/v1/purchase-orders/{id}/pdf | Get PDF |
| POST | /api/v1/purchase-orders/{id}/send-email | Send by email |
GET
/api/v1/purchase-ordersList purchase orders
Authentication required— Include session cookie or Bearer token
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
status | string | Optional | Filter by status (draft / sent / accepted) |
company_id | string | Optional | Filter by company ID |
search | string | Optional | Search by purchase order number or subject |
limit | integer | Optional | Number of items to return (default: 20, max: 100) |
offset | integer | Optional | Offset for pagination (default: 0) |
Code Examples
curl "https://api.blueai.jp/api/v1/purchase-orders" \
-H "Cookie: better-auth.session_token=<token>"POST
/api/v1/purchase-ordersCreate a purchase order
Authentication required— Include session cookie or Bearer token
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
company_id | string | Required | Company ID |
issue_date | string | Required | Issue date (YYYY-MM-DD) |
due_date | string | Optional | Delivery deadline (YYYY-MM-DD) |
subject | string | Optional | Subject |
issuer_name | string | Optional | Issuer name |
issuer_detail | string | Optional | Issuer detail |
memo | string | Optional | Memo |
tax_display_mode | string | Optional | Tax display mode (inclusive / exclusive) |
tax_rounding | string | Optional | Tax rounding (round / floor / ceil) |
| object[] | Required | Line items |
Code Examples
curl -X POST "https://api.blueai.jp/api/v1/purchase-orders" \
-H "Cookie: better-auth.session_token=<token>"GET
/api/v1/purchase-orders/{id}Get a purchase order
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Optional | Purchase order ID |
Code Examples
curl "https://api.blueai.jp/api/v1/purchase-orders/po_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>"PATCH
/api/v1/purchase-orders/{id}Update a purchase order
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Optional | Purchase order ID |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
company_id | string | Optional | Company ID |
issue_date | string | Optional | Issue date (YYYY-MM-DD) |
due_date | string | Optional | Delivery deadline (YYYY-MM-DD) |
subject | string | Optional | Subject |
issuer_name | string | Optional | Issuer name |
issuer_detail | string | Optional | Issuer detail |
memo | string | Optional | Memo |
tax_display_mode | string | Optional | Tax display mode (inclusive / exclusive) |
tax_rounding | string | Optional | Tax rounding (round / floor / ceil) |
| object[] | Optional | Line items |
Code Examples
curl -X PATCH "https://api.blueai.jp/api/v1/purchase-orders/po_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>"DELETE
/api/v1/purchase-orders/{id}Delete a purchase order
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Optional | Purchase order ID |
Code Examples
curl -X DELETE "https://api.blueai.jp/api/v1/purchase-orders/po_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>"POST
/api/v1/purchase-orders/{id}/sendMark as sent
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Optional | Purchase order ID |
Code Examples
curl -X POST "https://api.blueai.jp/api/v1/purchase-orders/po_123e4567e89b12d3a456426614174000/send" \
-H "Cookie: better-auth.session_token=<token>"POST
/api/v1/purchase-orders/{id}/acceptAccept
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Optional | Purchase order ID |
Code Examples
curl -X POST "https://api.blueai.jp/api/v1/purchase-orders/po_123e4567e89b12d3a456426614174000/accept" \
-H "Cookie: better-auth.session_token=<token>"POST
/api/v1/purchase-orders/{id}/convertConvert to invoice
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Optional | Purchase order ID |
Code Examples
curl -X POST "https://api.blueai.jp/api/v1/purchase-orders/po_123e4567e89b12d3a456426614174000/convert" \
-H "Cookie: better-auth.session_token=<token>"GET
/api/v1/purchase-orders/{id}/pdfGet PDF
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Optional | Purchase order ID |
Code Examples
curl "https://api.blueai.jp/api/v1/purchase-orders/po_123e4567e89b12d3a456426614174000/pdf" \
-H "Cookie: better-auth.session_token=<token>"POST
/api/v1/purchase-orders/{id}/send-emailSend by email
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Optional | Purchase order ID |
Code Examples
curl -X POST "https://api.blueai.jp/api/v1/purchase-orders/po_123e4567e89b12d3a456426614174000/send-email" \
-H "Cookie: better-auth.session_token=<token>"