# onboarding API

> Operations under /api/v1/onboarding. GET /api/v1/onboarding, POST /api/v1/onboarding.

2 operations. Each needs an API key with the permission shown; see [API keys and permissions](https://staffedly.com/docs/developers/api-keys).

| Operation | Permission |
| --- | --- |
| [`GET /api/v1/onboarding`](#get-api-v1-onboarding) | `onboarding:read` |
| [`POST /api/v1/onboarding`](#post-api-v1-onboarding) | `onboarding:write` |

## GET /api/v1/onboarding

Onboarding checklists: who is onboarding, how far each has got and what each is waiting on.

- **Permission:** `onboarding:read`
- **Returns:** a page of records: `{ data, hasMore, nextCursor }`, status 200

**Query parameters** (all optional)

| Name | Description |
| --- | --- |
| `status` | in_progress (default), ready, cancelled or all. |
| `limit` | Rows per page, 1 to 200. Default 50. |
| `cursor` | The nextCursor value from the previous page. |

**Fields in each record:** `id`, `providerId`, `name`, `role`, `mode`, `status`, `template`, `done`, `total`, `waitingOnHire`, `waitingOnStaff`, `problems`, `sentAt`, `openedAt`, `readyAt`, `startDate`, `createdAt`

```bash
curl "https://app.staffedly.com/api/v1/onboarding?limit=50" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY"
```

## POST /api/v1/onboarding

Start onboarding. A new hire (name and email; they are added with status onboarding and cannot be scheduled until ready), or providerId for someone already on the roster. Their checklist is emailed to them.

- **Permission:** `onboarding:write`
- **Returns:** one record: `{ data }`, status 201
- **Safe retry:** send an `Idempotency-Key` header (8 to 128 characters); the same key with the same request returns the first answer again

**Body fields** (JSON; a field the API does not know is refused)

| Field | Description |
| --- | --- |
| `name` | New hire's full name. |
| `email` | New hire's email: their checklist goes there. |
| `phone` | Optional mobile number. |
| `role` | A role key, such as CRNA. Default: your first role. |
| `providerId` | Instead of name and email: someone already on the roster, who gets a checklist of only what they are missing. |
| `templateId` | Optional onboarding template. Default: the one for the role. |
| `startDate` | Optional, YYYY-MM-DD. |

**Fields in each record:** `id`, `providerId`, `name`, `role`, `mode`, `status`, `template`, `done`, `total`, `waitingOnHire`, `waitingOnStaff`, `problems`, `sentAt`, `openedAt`, `readyAt`, `startDate`, `createdAt`

```bash
curl -X POST "https://app.staffedly.com/api/v1/onboarding" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name":"Jordan Avery","email":"jordan.avery@example.com"}'
```

