|
| 1 | +--- |
| 2 | +title: Ordering API |
| 3 | +description: Public endpoints for creating and retrieving orders through the tscircuit API |
| 4 | +sidebar_position: 3 |
| 5 | +--- |
| 6 | + |
| 7 | +## Authentication |
| 8 | + |
| 9 | +All ordering endpoints require a valid session. Include your authentication token or session cookie in every request. |
| 10 | + |
| 11 | +### Create an Order |
| 12 | + |
| 13 | +`POST /orders/create` |
| 14 | + |
| 15 | +Creates a new order for a PCB circuit. Provide either a `package_release_id` or the full `circuit_json`. Optionally specify a `customs_category`. |
| 16 | + |
| 17 | +```json |
| 18 | +{ |
| 19 | + "package_release_id": "string (uuid, optional)", |
| 20 | + "circuit_json": [ /* circuit JSON array, optional */ ], |
| 21 | + "customs_category": "string (optional)" |
| 22 | +} |
| 23 | +``` |
| 24 | + |
| 25 | +Either `package_release_id` or `circuit_json` must be supplied. |
| 26 | + |
| 27 | +**Response** |
| 28 | + |
| 29 | +```json |
| 30 | +{ |
| 31 | + "order": { |
| 32 | + "order_id": "string (uuid)", |
| 33 | + "account_id": "string (uuid)", |
| 34 | + "is_running": false, |
| 35 | + "is_started": false, |
| 36 | + "is_finished": false, |
| 37 | + "error": null, |
| 38 | + "has_error": false, |
| 39 | + "created_at": "string (ISO timestamp)", |
| 40 | + "started_at": "string (ISO timestamp or null)", |
| 41 | + "completed_at": "string (ISO timestamp or null)", |
| 42 | + "circuit_json": [ /* circuit JSON array */ ], |
| 43 | + "customs_category": "string" |
| 44 | + } |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +Example request: |
| 49 | + |
| 50 | +```bash |
| 51 | +curl -X POST https://api.tscircuit.com/orders/create \ |
| 52 | + -H "Authorization: Bearer <token>" \ |
| 53 | + -H "Content-Type: application/json" \ |
| 54 | + -d '{"package_release_id": "123e4567-e89b-12d3-a456-426614174000"}' |
| 55 | +``` |
| 56 | + |
| 57 | +### Get Order Details |
| 58 | + |
| 59 | +`GET /orders/get` or `POST /orders/get` |
| 60 | + |
| 61 | +Fetch details of a specific order. |
| 62 | + |
| 63 | +Request parameters (query or JSON body): |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "order_id": "string (uuid)" |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +**Response** |
| 72 | + |
| 73 | +```json |
| 74 | +{ |
| 75 | + "order": { |
| 76 | + "order_id": "string (uuid)", |
| 77 | + "account_id": "string (uuid)", |
| 78 | + "is_running": false, |
| 79 | + "is_started": false, |
| 80 | + "is_finished": false, |
| 81 | + "error": null, |
| 82 | + "has_error": false, |
| 83 | + "created_at": "string (ISO timestamp)", |
| 84 | + "started_at": "string (ISO timestamp or null)", |
| 85 | + "completed_at": "string (ISO timestamp or null)", |
| 86 | + "circuit_json": [ /* circuit JSON array */ ], |
| 87 | + "customs_category": "string" |
| 88 | + } |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +Example request: |
| 93 | + |
| 94 | +```bash |
| 95 | +curl -X GET "https://api.tscircuit.com/orders/get?order_id=123e4567-e89b-12d3-a456-426614174000" \ |
| 96 | + -H "Authorization: Bearer <token>" |
| 97 | +``` |
| 98 | + |
| 99 | +## Additional Notes |
| 100 | + |
| 101 | +- Timestamps are returned in ISO-8601 format. |
| 102 | +- Errors follow this structure: |
| 103 | + |
| 104 | +```json |
| 105 | +{ |
| 106 | + "error_code": "string", |
| 107 | + "message": "string" |
| 108 | +} |
| 109 | +``` |
| 110 | +- For endpoints related to order quotes, see the Order Quotes API documentation. |
| 111 | + |
| 112 | +## See Also |
| 113 | + |
| 114 | +- [Order Quotes API Documentation](#) |
| 115 | +- [Authentication Guide](#) |
0 commit comments