# Job offers API

> Read job offers and ask for a drafted one to be sent. GET /api/v1/offers, GET /api/v1/offers/{id}, POST /api/v1/offers/{id}/send.

3 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/offers`](#get-api-v1-offers) | `offers:read` |
| [`GET /api/v1/offers/{id}`](#get-api-v1-offers-id) | `offers:read` |
| [`POST /api/v1/offers/{id}/send`](#post-api-v1-offers-id-send) | `offers:write` |

## GET /api/v1/offers

Job offers and where each stands. The candidate's private link is never returned.

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

**Query parameters** (all optional)

| Name | Description |
| --- | --- |
| `status` | draft, sent, accepted, declined, expired or withdrawn. |
| `applicationId` | Offers to one applicant. |
| `limit` | Rows per page, 1 to 200. Default 50. |
| `cursor` | The nextCursor value from the previous page. |

**Fields in each record:** `id`, `applicationId`, `status`, `role`, `payRate`, `engagement`, `engagementLabel`, `startDate`, `guaranteedHours`, `expiresOn`, `hasLetter`, `signRequestId`, `sentAt`, `viewedAt`, `respondedAt`, `respondedVia`, `declineReason`, `withdrawnAt`, `expiredAt`, `providerId`, `createdAt`

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

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

One job offer.

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

**Path**

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

**Fields in each record:** `id`, `applicationId`, `status`, `role`, `payRate`, `engagement`, `engagementLabel`, `startDate`, `guaranteedHours`, `expiresOn`, `hasLetter`, `signRequestId`, `sentAt`, `viewedAt`, `respondedAt`, `respondedVia`, `declineReason`, `withdrawnAt`, `expiredAt`, `providerId`, `createdAt`

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

## POST /api/v1/offers/{id}/send

Ask for a drafted offer to be sent. Nothing is sent by the key: it waits on the Approvals page for someone with hiring access, whose approval sends it in their name. Answers 202 with the approval's id; watch offer.* webhook events for the answer.

- **Permission:** `offers:write`
- **Returns:** one record: `{ data }`, status 202
- **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 |
| --- | --- |

**Fields in each record:** `status`, `approvalId`, `offerId`

```bash
curl -X POST "https://app.staffedly.com/api/v1/offers/<id>/send" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
```

