# People API

> List, add and update the people you schedule. GET /api/v1/providers, POST /api/v1/providers, GET /api/v1/providers/{id}, PATCH /api/v1/providers/{id}.

4 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/providers`](#get-api-v1-providers) | `roster:read` |
| [`POST /api/v1/providers`](#post-api-v1-providers) | `roster:write` |
| [`GET /api/v1/providers/{id}`](#get-api-v1-providers-id) | `roster:read` |
| [`PATCH /api/v1/providers/{id}`](#patch-api-v1-providers-id) | `roster:write` |

## GET /api/v1/providers

Your people.

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

**Query parameters** (all optional)

| Name | Description |
| --- | --- |
| `status` | active, on_leave, inactive or offboarded. Several may be given, comma-separated. |
| `role` | A role key, such as CRNA. |
| `q` | Name contains this text. |
| `limit` | Rows per page, 1 to 200. Default 50. |
| `cursor` | The nextCursor value from the previous page. |

**Fields in each record:** `id`, `name`, `role`, `status`, `email`, `phone`, `npi`, `externalId`, `homeFacilityId`, `timezone`, `skills`, `shiftFte`, `callFte`, `homePostalCode`, `maxTravelMiles`, `onlyFacilityIds`, `neverFacilityIds`

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

## POST /api/v1/providers

Add a person.

- **Permission:** `roster: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` | Required. |
| `role` | A role key or name from your role list. Default: your first role. |
| `email` | — |
| `phone` | — |
| `npi` | 10 digits. |
| `externalId` | Your own id for this person. Must be unique. |
| `status` | active (default), on_leave, inactive or offboarded. |
| `timezone` | The person's own time zone (IANA name such as America/Chicago), used for quiet hours on texts and calls. null follows their home site. |
| `homePostalCode` | Where the person travels from: a 5-digit US ZIP code or a Canadian postal code. Only the code is kept. null clears it. |
| `maxTravelMiles` | How far from home they are scheduled or offered work, in miles (1 to 3000). null uses the organization's default. |

**Fields in each record:** `id`, `name`, `role`, `status`, `email`, `phone`, `npi`, `externalId`, `homeFacilityId`, `timezone`, `skills`, `shiftFte`, `callFte`, `homePostalCode`, `maxTravelMiles`, `onlyFacilityIds`, `neverFacilityIds`

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

## GET /api/v1/providers/{id}

One person.

- **Permission:** `roster:read`
- **Returns:** one record: `{ data }`, status 200

**Path**

| Name | Description |
| --- | --- |
| `id` | The record's id. |

**Fields in each record:** `id`, `name`, `role`, `status`, `email`, `phone`, `npi`, `externalId`, `homeFacilityId`, `timezone`, `skills`, `shiftFte`, `callFte`, `homePostalCode`, `maxTravelMiles`, `onlyFacilityIds`, `neverFacilityIds`

```bash
curl "https://app.staffedly.com/api/v1/providers/<id>" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY"
```

## PATCH /api/v1/providers/{id}

Update a person. Only the fields you send change.

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

**Path**

| Name | Description |
| --- | --- |
| `id` | The record's id. |

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

| Field | Description |
| --- | --- |
| `name` | — |
| `role` | — |
| `email` | — |
| `phone` | — |
| `npi` | — |
| `status` | — |
| `skills` | A list of skill names; replaces the current list. |
| `homeFacilityId` | — |
| `timezone` | The person's own time zone (IANA name such as America/Chicago), used for quiet hours on texts and calls. null follows their home site. |
| `shiftFte` | 0.1 to 1.5. |
| `callFte` | 0 to 2. |
| `homePostalCode` | Where the person travels from: a 5-digit US ZIP code or a Canadian postal code. Only the code is kept. null clears it. |
| `maxTravelMiles` | How far from home they are scheduled or offered work, in miles (1 to 3000). null uses the organization's default. |
| `onlyFacilityIds` | When not empty, the only sites this person works at. Replaces the current list. |
| `neverFacilityIds` | Sites this person is never placed at. Replaces the current list. |
| `confirm` | true to go ahead when the answer was 409 confirm_required. |

**Fields in each record:** `id`, `name`, `role`, `status`, `email`, `phone`, `npi`, `externalId`, `homeFacilityId`, `timezone`, `skills`, `shiftFte`, `callFte`, `homePostalCode`, `maxTravelMiles`, `onlyFacilityIds`, `neverFacilityIds`

```bash
curl -X PATCH "https://app.staffedly.com/api/v1/providers/<id>" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name":"Jordan Avery","role":"CRNA"}'
```

