# Make your first API call

> Go from a new key to reading your people and posting an open shift, with curl commands you can paste.

This page takes about five minutes. You need an admin login on a Pro, Agency, Enterprise or trial organization.

## 1. Make a key

In the app, open **Settings → API**, name a key, give it **Read** on People and sites and **Read and write** on Schedule, and copy it. See [API keys and permissions](https://staffedly.com/docs/developers/api-keys).

```bash
export STAFFEDLY_API_KEY="sfk_your_key_here"
```

## 2. Check the key

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

```json
{
  "data": {
    "organization": { "id": "cmwwzj8f40000qrmrky4ouqvg", "name": "Demo Anesthesia Group" },
    "key": { "name": "Docs example", "prefix": "sfk_4Glzz1rK", "scopes": ["roster:read", "schedule:read", "schedule:write"] },
    "rateLimitPerMinute": 120,
    "version": "v1"
  }
}
```

## 3. Read your people

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

```json
{
  "data": [
    { "id": "cmwwzj98r0007qr03wmj173ky", "name": "Maya Rodriguez", "role": "ANESTHESIOLOGIST", "status": "active",
      "email": "maya@example.test", "phone": "+16145551000", "npi": null, "externalId": null,
      "homeFacilityId": null, "skills": [], "shiftFte": 1, "callFte": 1 }
  ],
  "hasMore": true,
  "nextCursor": "cmwwzj98r0007qr03wmj173ky"
}
```

Pass `nextCursor` back as `cursor` to read the next page. See [Pagination](https://staffedly.com/docs/developers/pagination).

## 4. Read the schedule

```bash
curl "https://app.staffedly.com/api/v1/assignments?from=2027-01-11&to=2027-01-18" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY"
```

Only published shifts and call are returned. Drafts are never included.

## 5. Post an open shift

Find a site id with `GET /api/v1/facilities`, then:

```bash
curl -X POST "https://app.staffedly.com/api/v1/open-shifts" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"facilityId":"<facilityId>","start":"2027-01-12T07:00:00-05:00","end":"2027-01-12T15:00:00-05:00","role":"CRNA"}'
```

The shift appears on the **Open shifts** screen. Offers go out according to your [Automation settings](https://staffedly.com/docs/run/automation-settings), the same as for a shift posted by your team. See [Open shifts](https://staffedly.com/docs/fill/open-shifts).

## Next

- [API reference](https://staffedly.com/docs/api/overview) for every operation.
- [Webhooks](https://staffedly.com/docs/developers/webhooks) to be told when the shift is filled.
- [Errors](https://staffedly.com/docs/developers/errors) for what each refusal means.
