> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Migration from v1

> Move a v1 integration to the v2 API, endpoint by endpoint

v2 runs alongside v1. Your v1 integration keeps working while you migrate, and you can move one endpoint at a time: the same API key works on both, and v2 requests count against a separate rate-limit bucket, so testing v2 never throttles live v1 traffic.

Most changes are mechanical: a new base URL, a `{ data }` envelope on every response, and one error shape. A handful change behaviour, and those are the ones that break integrations silently. They are marked **Behaviour change** below.

## Use the migration skill (recommended)

The `classet-v2-migration` skill lets a coding agent (Claude Code, Codex, Cursor and others) do this migration for you. It finds every v1 call in your codebase, rewrites each one using the sections below, flags the behaviour changes for you to decide, and checks its work against the v2 API.

Install the skill:

```bash Terminal theme={null}
npx skills add https://docs.classet.ai --skill classet-v2-migration
```

Then give your agent this prompt:

```text theme={null}
Migrate this codebase from the Classet v1 API to v2 using the classet-v2-migration skill.
```

The agent checks in before any change that alters behaviour, such as a new status code your code branches on or a field whose value now comes from a different source.

## Or migrate by hand

1. [Confirm v2 is enabled](#before-you-start) for your organization.
2. Change the [base URL](#base-url) and unwrap the [response envelope](#response-envelope).
3. Switch error handling to the [v2 error shape](#errors).
4. Work through the [endpoint sections](#jobs) for each endpoint you call, starting with the **Behaviour change** items.
5. Add an [`Idempotency-Key`](#idempotency-new) to every `POST` that creates something.
6. Run your integration against v2 next to v1, compare the results, then cut over.

The full [endpoint mapping](#endpoint-mapping) is at the end.

## Before you start

v2 is enabled per organization. Until it is enabled for yours, every v2 route returns `404 Not found`, even with a valid key. Check with:

```bash theme={null}
curl -i https://api.classet.ai/v2/organization -H "X-API-KEY: $CLASSET_API_KEY"
```

A `200` means you're enabled. A `404` means v2 isn't enabled yet; contact your Classet team.

Sending interviews through v2 is enabled separately. Until it is on for your organization, requests that start outreach or attach a resume return `503 service_unavailable` with `External API mutations are not enabled for this organization`. This isn't a transient error, so don't retry it; ask your Classet team to enable v2 sends before you cut over.

## Base URL

```diff theme={null}
- https://recruiter.classet.org/v1
+ https://api.classet.ai/v2
```

Authentication is unchanged: send your key in the `X-API-KEY` header. A missing key is `401` and an invalid key is `403` on both versions. v2 also rejects an expired key with `403`.

## Response envelope

Every JSON response is wrapped in `data`. Lists put their items in `data` and paging info in `meta`, replacing the per-resource keys v1 used (`jobs`, `candidates`, `messages`).

```ts theme={null}
// Before (v1)
const res = await fetch(`${V1}/jobs?page=1&limit=20`, { headers });
const { jobs, total } = await res.json();

// After (v2)
const res = await fetch(`${V2}/jobs?page=1&limit=20`, { headers });
const { data: jobs, meta } = await res.json(); // meta: { page, limit, total }
```

Two exceptions return no envelope: `DELETE /v2/jobs/{jobId}` returns `{ "message": "Job archived" }`, and `GET /v2/calls/{callId}/recording` streams audio.

`meta.total` is an estimate on large lists. To walk every page, stop when a page returns fewer items than `limit`; don't count to `total`. See [Pagination and delta sync](/docs/guides/pagination-and-delta-sync.md).

### Empty lists return 200

**Behaviour change.** v1 returned `404` when a list had no results (candidates, a job's candidates, scripts). v2 returns `200` with `data: []`. Code that treats a 404 as "no results" must check for an empty array instead.

```ts theme={null}
// Before (v1)
if (res.status === 404) return [];

// After (v2)
const { data } = await res.json();
return data; // [] when there are none
```

## Errors

v1 used several error shapes, depending on the route: `{ error }`, `{ errors: [...] }`, `{ fieldErrors, formErrors }` and `{ success: false, error }`. v2 has one:

```json theme={null}
{
  "error": "Job not found",
  "code": "not_found",
  "request_id": "req_..."
}
```

Branch on `code`, not on the `error` text, and log `request_id` so support can find the request. The codes are `validation_error`, `bad_request`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `unprocessable`, `rate_limited`, `rate_limit_unavailable`, `quota_exceeded`, `service_unavailable` and `internal_error`. See [Error handling](/docs/guides/error-handling.md).

```ts theme={null}
// Before (v1)
const body = await res.json();
const message = body.error ?? body.errors?.[0]?.msg ?? body.formErrors?.[0];

// After (v2)
const { error, code, request_id, ...rest } = await res.json();
if (code === 'rate_limited') {
  // An invite cap carries exceeded_window. A daily or monthly cap won't clear in seconds.
  if (rest.exceeded_window) return pauseSendsUntil(rest.retry_at);
  return retryAfter(res.headers.get('Retry-After'));
}
```

### Validation is stricter

**Behaviour change.** v2 rejects input that v1 accepted or silently fixed:

* An invalid `page` or `limit` is a `400`. v1 replaced it with the default. `limit` is capped at 50 on lists and 100 on messages, the same caps as v1.
* `updated_since` (candidates, jobs, applications) and the message date filters must be full ISO 8601 timestamps, such as `2026-10-01T00:00:00Z`. v1 also accepted `YYYY-MM-DD`. The `created_after`/`created_before` filters on jobs and applications still take `YYYY-MM-DD`, so leave those as they are.
* Phone numbers must be E.164 with a non-zero country code (`+14155550100`).
* `resume_url` must be a public HTTPS URL.

## Jobs

`POST`, `GET` and `PATCH` on `/jobs` keep their paths and request bodies. v2 adds optional fields (`external_id`, `state`, `branch_id` and more) and adds `updated_since`, `external_id`, `state` and `branch_id` filters to the list. List results are sorted by `updated_at`, newest first.

```diff theme={null}
- { "job_id": "job_8f2k1x9q" }
+ { "data": { "job_id": "job_8f2k1x9q" } }
```

v2 no longer requires city, region and country for onsite jobs.

v1 ignored `offset` on `GET /jobs` and `preview` on `POST /jobs`, and v2 ignores them too. Page with `page` and `limit`. A `POST` always creates the job.

### Job candidates are now applications

**Behaviour change.** `GET /v1/jobs/:id/candidates` becomes `GET /v2/jobs/{jobId}/applications`, and two things change at once:

1. **The items are application objects, not candidates.** They carry the application's stage and outcome, not the candidate's calls, transcript or `phone_number`, and `custom_data` is now `candidate_custom_data`. Fetch the candidate with `GET /v2/candidates/{candidateId}` when you need its profile or interview. If your sync reads calls or transcripts from this list, plan for that extra request. The org-wide sync below finds which candidates changed but doesn't carry calls either, so fetch `GET /v2/candidates/{candidateId}?include=calls` or `/interview` for each changed one.
2. **No results is `200` with `data: []`**, not `404`.

`{jobId}` accepts the v2 job ID or the v1 job shortcode, so the shortcodes you already store keep working.

```ts theme={null}
// Before (v1)
const { candidates } = await get(`/v1/jobs/${shortcode}/candidates`);

// After (v2)
const { data: applications } = await get(`/v2/jobs/${jobId}/applications`);
```

To sync applications across every job, use `GET /v2/applications` with `updated_since` and `cursor` instead of one request per job. See [Reporting](/docs/guides/reporting.md).

## Candidates

### List candidates

**Behaviour change.** The list returns lighter objects. It no longer embeds `calls`, the nested `interview` object or `experience`. Fetch a candidate's detail or interview when you need them.

* `updated_after` becomes `updated_since`. v1 compared with `>`, v2 compares with `>=`, so dedupe on the boundary. v1 accepted a bare date (`2026-10-01`); v2 requires a full timestamp and returns `400` for a date.
* `updated_since` compares against `changed_at`, which also moves when an interview result lands. See [Candidates: `changed_at`, not `updated_at`](/docs/guides/pagination-and-delta-sync#candidates-changed_at-not-updated_at).
* New filters: `email`, `phone`, `search`, `job_id` (ID or shortcode), `stage`, `source`, `disqualified` and `cursor`.

```diff theme={null}
- GET /v1/candidates?updated_after=2026-10-01T00:00:00Z
+ GET /v2/candidates?updated_since=2026-10-01T00:00:00Z
```

### Create a candidate

`POST /v2/candidates` takes the same body as v1 (`phone`, `experience_entries`).

**Behaviour change.**

* **It always returns `201`**, with `data: { candidate_id, webcall_url, interview_panel_url, call_id }`, where `call_id` is `null` when no outreach was sent. v1 returned `200`, or `201` when outreach failed: `error: "candidate_unreachable"` when the candidate's phone number cannot receive SMS or their email address does not accept mail, and no other channel reached them (`POST /v1/candidates/{id}/interview` returns `422` with the same `error`).
* **An unreachable channel is a `422`, returned before the candidate is created.** For example, `send_sms: true` with no phone. v1 created the candidate and reported the failure afterwards.
* **Duplicate detection checks email or phone, within the same job.** v1 checked email only, so re-adding someone to a job with a new email but the same phone now returns `409`, with `code: "conflict"`. Adding the same person to a different job still works.
* **A free-trial organization that has used its interview allowance gets `402 quota_exceeded`** when a request would start outreach.
* **Outreach counts against your [send caps](#send-caps)**, which v1 didn't enforce.

`location` takes `city`, `region`, `country`, `zip_code`, `region_code`, `country_code` and `location_str`, and v2 stores all of them. `POST /v1/candidates` dropped `region_code` and `country_code` without an error, so if you send them they now take effect; send ISO codes such as `OH` and `US`, since the dashboard shows the region code next to the city. A `PATCH` that includes `location` replaces the whole object, as in v1, so send every location field, not only the one that changed.

### Get a candidate

**Behaviour change.**

* `calls` is `null` unless you pass `?include=calls`.
* Each embedded call uses `questionAnswers` (v1: `questions`) and no longer carries `job_id`, `job_title` or `call_details`.
* The nested `interview` object is flattened into top-level `interview_*` fields.
* `interview_summary` now comes from the interview's screen summary, not from the candidate's notes, so the text differs from v1.

```diff theme={null}
- GET /v1/candidates/{id}
+ GET /v2/candidates/{id}?include=calls
```

For the full transcript, recording and scores, use `GET /v2/candidates/{candidateId}/interview`.

### Update a candidate

`PATCH /v2/candidates/{candidateId}` keeps its path. `job_id` accepts a job ID or a shortcode.

**Behaviour change.** v1 skipped empty values, so sending `""` left a field as it was. v2 writes every field you send. Omit a field to leave it unchanged.

```diff theme={null}
- { "success": true, "data": { "candidate_id": "..." } }
+ { "data": { "id": "..." } }
```

### Messages

The path and `page`/`limit` stay the same (default 50, max 100). Each message's `message` field is renamed `text`, and v2 adds `id`, `sender_type`, `automated` and `delivery_status`. A new `order` parameter defaults to `asc`.

```diff theme={null}
- const { messages } = body;  messages[0].message
+ const { data: messages } = body;  messages[0].text
```

### Send and stop an interview

`POST /v2/candidates/{candidateId}/interview` returns `data: { candidate_id, webcall_url, interview_panel_url }` and counts against your [send caps](#send-caps). A request with no channel is a `422 unprocessable`; v1 returned `400`.

`POST /v2/candidates/{candidateId}/stop-interview` returns snake\_case fields:

```diff theme={null}
- { "success": true, "message": "Interview stopped successfully", "smsSentSuccess": true, "emailSentSuccess": null }
+ { "data": { "candidate_id": "...", "stopped": true, "sms_sent_success": true, "email_sent_success": null } }
```

Errors move from v1 slugs such as `error: "candidate_not_found"` to `code: "not_found"` and `code: "conflict"`.

Stopping an interview that is already stopped returns `200` with `already_stopped: true`. A `409 conflict` means there is nothing to stop right now. When the body carries `interview_outcome`, the interview has finished and the `409` is final. Otherwise the interview was never sent. If you sent it seconds ago, retry once after a short delay; otherwise stop. Never retry a `409` in a loop: it won't change, and each attempt counts against your rate limit.

```ts theme={null}
const res = await post(`/v2/candidates/${id}/stop-interview`, {});
if (res.status === 409) return; // nothing to stop; don't loop on it
```

### Waiting for the interview result

Many v1 integrations send an interview and then poll `GET /candidates/:id` until the result appears, often dozens of times per candidate. That still works on v2, but each poll counts against your rate limit. Two better options:

* **Webhooks.** Subscribe to the interview events and stop polling. See [Webhooks](/docs/guides/webhooks.md).
* **Delta sync.** Poll the list once per interval with `GET /v2/candidates?updated_since=...` instead of fetching each candidate. `updated_since` moves when an interview result lands. See [Pagination and delta sync](/docs/guides/pagination-and-delta-sync.md).

## Calls

### Replace v1 calls with candidates

`POST /v2/calls` exists as a compatibility alias and accepts the v1 body, but it is deprecated. For new code, use `POST /v2/candidates`. Check two things before you switch:

1. **Channels.** v1 `/calls` sent on your organization's default channels. `POST /v2/candidates` sends only on the channels you name, so set both `send_sms` and `send_email` if your default includes email. Setting only `send_sms` silently drops email invites.
2. **Identifiers.** `POST /v2/candidates` accepts your ATS ID as `external_id`, like `POST /v2/calls`. It is stored, not deduplicated on, so use an `Idempotency-Key` to make a retry safe. When outreach is sent it also returns the `call_id` to poll with `GET /v2/calls/{callId}`; otherwise `call_id` is `null`. You can also read the interview with `GET /v2/candidates/{candidateId}/interview` or list attempts with `GET /v2/candidates/{candidateId}/calls`.

```ts theme={null}
// Before (v1)
await post('/v1/calls', { job_id: shortcode, first_name, last_name, phone_number });

// After (v2)
await post('/v2/candidates', {
  job_id: jobId,
  first_name,
  last_name,
  phone: phoneNumber,
  send_sms: true,
  send_email: true, // match your v1 default channels
}, { headers: { 'Idempotency-Key': crypto.randomUUID() } });
```

The two behave differently:

| | `POST /v2/calls` (alias) | `POST /v2/candidates` |
| - | - | - |
| Outreach | On the channels you set, or your default channels when you set neither | Only on the channels you set |
| Existing candidate for the same job | Reuses one whose interview is in progress, matched on phone (`force_create` overrides) | `409 conflict` for any match on email or phone |
| Candidate id from `POST /calls` | Derived from the phone number and job, so the same pair always gives the same id | Random. Do not compute it; read `candidate_id` from the response |
| `force_create` repeated within 12 hours | `POST /v1/candidates` returns the candidate the first request created, matched on email and job. `POST /v1/calls` has no such rule | Both create routes return the candidate the first request created, with `replayed: true`, matched on phone, email and name. See [Repeats without a key](/docs/guides/idempotency.md#repeats-without-a-key) |
| Person already contacted on this job in the last 12 hours | No rule: a new candidate can be created and contacted | `409 recently_contacted`, with `retry_at`. Your own repeat of the same request gets the `200` replay instead |
| Accepts `external_id` | Yes | Yes |
| Returns | `200`, with `candidate_id` and `call_id` | `201`, with `candidate_id`, and `call_id` when outreach is sent |
| Interview start | Queued | Queued |

The two versions do not recognise each other's repeats the same way. v1 replays only candidates v1 created; v2 replays candidates either version created. If you send the same person through both versions during a migration, v1 can create a second candidate that v2 would have replayed, so move one integration at a time and do not run both against the same job.

v1 started the interview before responding. v2 queues it, so the response arrives first. Poll the candidate or use [webhooks](/docs/guides/webhooks.md) to learn when the interview completes.

### Get a call

`GET /v2/calls/{callId}` accepts the `call_id` returned when you registered the call (the same ID v1 returned), the numeric `id`, or the provider's call ID. It doesn't accept the `external_id` you sent at registration. It returns the full `call_details` object (v1 returned a subset) and adds `id`, `provider_call_id`, `call_type`, `created_at`, `evaluations` and `latest_task_completion`.

**Behaviour change.** A call that belongs to another organization is `404`. v1 returned `403`.

## Scripts and script tasks

Paths and request bodies are the same. v2 accepts more fields on `PATCH /v2/scripts/{scriptId}` and `PATCH /v2/script-tasks/{taskId}`. On a script task, `questions` is a list of strings and `qualifying_questions` is a list of `{ "question", "disqualifyIf" }` objects, as in v1.

**Behaviour change.** `GET /v2/scripts` no longer includes tasks by default. Pass `include_tasks=true` to get them. An empty list is `200` with `data: []`, not `404`.

```diff theme={null}
- GET /v1/scripts
+ GET /v2/scripts?include_tasks=true
```

## Send caps

**Behaviour change.** v1 placed no limit on interview invites. In v2, every send (`POST /v2/candidates` with a channel, `POST /v2/candidates/{candidateId}/interview` and `POST /v2/calls`) shares your organization's invite budget with dashboard and campaign sends.

* An exhausted cap returns `429 rate_limited`, before any candidate or call is created. Unlike the request rate limit, the body carries `exceeded_window`, `limit` and `retry_at`, and `Retry-After` is set only when a reset time is known. A daily or monthly cap doesn't clear in seconds, so pause sends until `retry_at` instead of retrying.
* A free-trial organization past its interview allowance gets `402 quota_exceeded`.
* If the limiter is briefly unavailable, sends fail closed with `503 rate_limit_unavailable`. Retry with backoff.

See [Rate limits](/docs/guides/rate-limits.md).

## Idempotency (new)

v1 had no general protection against a retried `POST` creating a second candidate. Its only guard is on `POST /v1/candidates` with `force_create: true`: a re-post for the same email and job (the same phone number and job when the post has no email) within 12 hours of the newest matching candidate, when an earlier `POST /v1/candidates` created it, returns that candidate with `replayed: true` instead of creating another. Its status is derived, not stored: `200` when the request asks for no outreach or the candidate was sent an interview, `201` when outreach was asked for and nothing was sent. v2 accepts an `Idempotency-Key` header on every `POST`. A retry with the same key returns the original response, status code included, with `Idempotency-Replayed: true`, instead of creating a duplicate.

```ts theme={null}
const key = crypto.randomUUID(); // generate once per logical operation, reuse on retry
await post('/v2/candidates', body, { headers: { 'Idempotency-Key': key } });
```

The key is matched by value, not by request body, so don't reuse a key for a different request. See [Idempotency](/docs/guides/idempotency.md).

## Webhooks

The results webhook you configured for v1 keeps firing unchanged, including for candidates you create through v2. Manage its URL with `GET` and `PUT /v2/webhooks`, and send a test delivery with `POST /v2/webhooks/test`.

v2 adds signed event webhooks with a typed envelope, and a delivery log at `GET /v2/webhooks/events`. See [Webhooks](/docs/guides/webhooks.md) for the payloads and how to verify signatures.

## Rate limits

Limits, headers (`X-RateLimit-Limit`, `-Remaining`, `-Reset`, `-Used`, `-Window`) and `Retry-After` work as in v1. v2 counts requests in its own bucket, adds `code: "rate_limited"` to the `429` body, and sends `X-RateLimit-Degraded: true` when the limiter was briefly unavailable and your request was let through.

## Endpoint mapping

| v1 | v2 | Change |
| - | - | - |
| `POST /v1/calls` | `POST /v2/candidates` | [Set channels explicitly](#replace-v1-calls-with-candidates). `POST /v2/calls` remains as a deprecated alias. |
| `GET /v1/calls/:id` | `GET /v2/calls/{callId}` | [Full `call_details`; cross-org is 404](#get-a-call) |
| `GET /v1/candidates` | `GET /v2/candidates` | [Lighter objects; `updated_since`](#list-candidates) |
| `POST /v1/candidates` | `POST /v2/candidates` | [201; 422 before insert; send caps](#create-a-candidate) |
| `GET /v1/candidates/:id` | `GET /v2/candidates/{candidateId}` | [`include=calls`; flattened interview](#get-a-candidate) |
| `PATCH /v1/candidates/:id` | `PATCH /v2/candidates/{candidateId}` | [Empty values are written](#update-a-candidate) |
| `GET /v1/candidates/:id/messages` | `GET /v2/candidates/{candidateId}/messages` | [`message` → `text`](#messages) |
| `POST /v1/candidates/:id/interview` | `POST /v2/candidates/{candidateId}/interview` | [422; send caps](#send-and-stop-an-interview) |
| `POST /v1/candidates/:id/stop-interview` | `POST /v2/candidates/{candidateId}/stop-interview` | [snake\_case response; don't retry a 409](#send-and-stop-an-interview) |
| `GET /v1/jobs` | `GET /v2/jobs` | [Envelope; strict paging](#jobs) |
| `POST /v1/jobs` | `POST /v2/jobs` | [Envelope](#jobs) |
| `GET /v1/jobs/:id` | `GET /v2/jobs/{jobId}` | Envelope |
| `PATCH /v1/jobs/:id` | `PATCH /v2/jobs/{jobId}` | Envelope |
| `GET /v1/jobs/:id/candidates` | `GET /v2/jobs/{jobId}/applications` | [Application objects, no calls](#job-candidates-are-now-applications) |
| `GET /v1/scripts` | `GET /v2/scripts` | [`include_tasks=true`](#scripts-and-script-tasks) |
| `POST /v1/scripts` | `POST /v2/scripts` | Envelope |
| `GET /v1/scripts/:id` | `GET /v2/scripts/{scriptId}` | Envelope |
| `PATCH /v1/scripts/:id` | `PATCH /v2/scripts/{scriptId}` | Envelope; more fields |
| `POST /v1/scripts/:id/duplicate` | `POST /v2/scripts/{scriptId}/duplicate` | Envelope |
| `PATCH /v1/script-tasks/:id` | `PATCH /v2/script-tasks/{taskId}` | Envelope; more fields |
| `GET /v1/health-check` | `GET /v2/health` | Different body |

No v1 endpoint changed from `PATCH` to `PUT`. The `PUT` endpoints in v2 are all new.

## New in v2

These have no v1 equivalent:

* **Organization:** `GET /v2/organization`, `/branches`, `/users`, `/tags`
* **Jobs:** `DELETE /v2/jobs/{jobId}` (archives the job), `GET /v2/jobs/{jobId}/stages`, `POST /v2/jobs/generate`
* **Applications:** `GET /v2/applications`, `GET` and `PATCH /v2/applications/{applicationId}`, `PUT .../stage`, `POST .../disqualify`
* **Candidates:** `GET /v2/candidates/{candidateId}/interview`, `/calls`, `/activity`, `/notes`, `/attachments`
* **Calls:** `GET /v2/calls/{callId}/recording`
* **Scripts:** `DELETE /v2/scripts/{scriptId}`, `POST .../tasks`, `PUT .../reorder-tasks`, `POST .../link-automation`, `POST /v2/scripts/generate`
* **Messaging and agent:** `/v2/message-automations`, `GET` and `PATCH /v2/agent-settings`
* **Knowledge and onboarding:** `/v2/knowledge`, `POST /v2/onboard`
* **Webhooks:** `GET` and `PUT /v2/webhooks`, `POST /v2/webhooks/test`, `GET /v2/webhooks/events`

## Removed

`POST /v1/parse-resume` has no v2 equivalent. It was never available to customer API keys.

## v1 support

v1 keeps working while you migrate, and no shutdown date is set. Any date will be announced in the [changelog](/docs/changelog.md) well ahead of time, and v1 and v2 will run side by side until then.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.