@classet/api-client is a typed, dependency-light wrapper around the Classet v2 API. It’s just fetch under the hood — it handles X-API-KEY auth, the /v2 path prefix, the { data } / { data, meta } response envelope, per-request timeouts, typed errors, automatic retries that honor Retry-After, Idempotency-Key propagation, and X-RateLimit-* header parsing.
Every example below shows the SDK call and the equivalent raw curl, so you can use whichever fits your stack.
Pilot installation
The SDK is currently available from an authorized Classet monorepo checkout and is not published to npm yet. External package installation will be documented at general availability.@types/* needed.
Initialise the client
ClassetClient takes a single options object:
Generate an API key from the Developer Settings page. The same key works on both v1 and v2. Keep it server-side — store it in an environment variable or secrets manager, never in client code.
Per-request options
Every write method (create / update / remove / sendInterview / …) accepts an optional trailing options object; timeoutMs and maxRetries also work on the raw transport:
Typed errors
Every method returns the parsed envelope and throws a typed error on a non-2xx response:ClassetApiError— carriesstatus, the machine-readablecode, andrequestIdfrom the standard{ error, code, request_id }envelope (messageis theerrorstring).ClassetRateLimitError— thrown on429(extendsClassetApiError); addsretryAfter(parsedRetry-Afterheader, in seconds) andrateLimit(parsedX-RateLimit-*headers).
err.code (stable) rather than the message text — see Error handling for the full code table.
Automatic retries
Transient failures (429, 500, 502, 503, 504, and network errors) are retried with exponential backoff, honoring the server’s Retry-After header when present:
- GETs are retried by default (up to
maxRetries, default 2). - Writes are retried only when you pass
{ idempotencyKey }— without a key the SDK can’t know a retry is safe, so it makes exactly one attempt. - Timeouts and caller aborts are surfaced immediately, never retried.
- A
429whoseRetry-AfterexceedsmaxRetryAfterMs, or whose body saysexceeded_window: "daily"or"monthly", throwsClassetRateLimitErrorat once. Checkerr.retryAfterand schedule the retry yourself. - A
503is retried only when itscodeisrate_limit_unavailable(or the body has no code).service_unavailablemeans the feature is off for your organization, so it is thrown at once.
Rate-limit visibility
client.lastRateLimit exposes the parsed X-RateLimit-* headers from the most recent response that carried them, so you can pace proactively:
Iterate whole collections with listAll
Paginated resources expose async iterators that walk every page for you:
candidates.listAll()andapplications.listOrgAll()followmeta.next_cursoruntil it isnull. Cursor pages do not shift when rows are written mid-walk.jobs.listAll()andapplications.listAll(jobId)page by offset and stop on a short page, because those routes take no cursor.
Create a job
classet.jobs.create() posts to POST /v2/jobs and returns { data: { job_id } } — the new job’s id, not the job itself. Call classet.jobs.get(job_id) when you need the full JobDetail. title, description, and location are required; everything else is optional.
data is a JobRef ({ job_id }) — that job_id is what you pass to the candidate, application, and interview calls below. Fetch the rest of the job with classet.jobs.get(job.job_id).
Create a candidate and send an interview
There are two ways to start an interview. Pick based on whether the candidate already exists.One step: create + send
classet.candidates.create() posts to POST /v2/candidates. Set send_sms and/or send_email to dispatch the interview invite as part of the same call. first_name, last_name, and job_id are required; phone and email are optional. The call returns 422 only when send_sms or send_email asks for a channel the candidate has no contact for (send_sms without a phone, send_email without an email).
Two steps: create now, send later
Create the candidate withoutsend_sms/send_email, then trigger the invite when you’re ready with classet.candidates.sendInterview() (POST /v2/candidates/:id/interview).
classet.candidates.stopInterview(candidateId, { only_stop_outreach }).
Fetch the aggregated interview
classet.candidates.getInterview() (GET /v2/candidates/:id/interview) returns one rolled-up InterviewDetail — status, outcome, AI summary, extracted custom data, and the recording/transcript — rather than raw per-attempt call rows. This is the call you’ll poll (or react to from a webhook) to read results.
InterviewDetail looks like:
Need the raw per-attempt rows (one per call) for debugging? Use
classet.candidates.calls(candidateId) or classet.calls.get(callId). For everything else, prefer getInterview — it’s the aggregated view that matches the dashboard.Configure a webhook
The dark-launch acceptance path uses polling. Any organization with a webhook URL receives interview events (candidate.interview.updated); they need no beta admission. v2 events are a separate limited beta, enabled per organization. classet.webhooks.update() stores the URL, and classet.webhooks.test() verifies reachability; neither action opts your organization into v2 events.
classet.webhooks.get(). For the event payload shape, signature verification, and retry behaviour, see the Webhooks guide.
Putting it together
A complete create-job → invite-candidate → read-result flow:Other resource groups
The client covers most of the v2 API. Each group returns the same{ data } / { data, meta } envelope:
Org-wide applications and stage moves:
X-API-KEY header:
See the API reference for the full request and response schema of every endpoint, and Migration from v1 if you’re upgrading an existing integration.