# Create work orders (https://docs.pulsarml.com/v1/api-reference/simple-work-orders/post-simple-work-orders)

Create one or many work orders. The body is a JSON **array**, even for a single record.

Creation is idempotent by name: names are trimmed and de-duplicated, a work order that already
exists is returned as-is, and one that was deleted is restored rather than duplicated.

## `POST /v1/simple-work-orders`

Base URLs:
- `https://draco.prod.pulsarml.com` — Production
- `https://draco.dev.pulsarml.com` — Development (sandbox)

Authentication: send your API key in the `x-api-key` header.

### Request body (`application/json`, required)

Type: array of object

- `name` (string, required, min length 1, e.g. `"WO-2024-001"`) — The name of the work order.

### Responses

#### 200 — The requested work orders, whether created, restored or already existing

Type: array of object

- `id` (string (uuid4), required, e.g. `"36f7b519-d93e-4ec8-8245-7f4b8c123456"`) — The unique identifier for the work order.
- `company` (object, required) — The company associated with the work order.
  - `id` (integer, required, e.g. `1`) — The unique identifier for the company.
  - `name` (string, required, e.g. `"company 1"`) — The name of the company.
- `name` (string, required, e.g. `"WO-2024-001"`) — The name of the work order, unique within the company.
- `createdAt` (string (date-time), required, e.g. `"2024-01-01T00:00:00.000Z"`) — The timestamp when the work order was created.
- `updatedAt` (string (date-time), required, e.g. `"2024-01-01T00:00:00.000Z"`) — The timestamp when the work order was last updated.

#### 422 — Validation Error

Type: object (`HTTPValidationError`)

- `detail` (array of object, optional)
  - `loc` (array of string | integer, required)
  - `msg` (string, required)
  - `type` (string, required)

### Example request

```bash
curl -X POST 'https://draco.prod.pulsarml.com/v1/simple-work-orders' \
  -H 'x-api-key: <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '[
    {
      "name": "WO-2024-001"
    }
  ]'
```