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

# AI Endpoints

> Generate jobs, scripts, and onboard companies with AI

Classet's AI endpoints use large language models to generate structured recruiting content. They have no limiter of their own: each call counts against your organization's ordinary [request rate limit](/docs/guides/rate-limits.md), like any other request.

Two of the three endpoints only generate. `POST /v2/jobs/generate` and `POST /v2/scripts/generate` save nothing — you review the output and create the job or script yourself. `POST /v2/onboard` is the one that writes to your account.

## Generate a job posting

Create a complete job description from just a title and optional context.

```bash theme={null}
curl -X POST https://api.classet.ai/v2/jobs/generate \
  -H "X-API-KEY: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Senior Registered Nurse",
    "location": "Houston, TX",
    "brief_description": "Night shift, ICU department",
    "company_name": "Memorial Hospital"
  }'
```

The response includes an HTML job description, benefits, suggested FAQs and screening questions, shaped for `POST /v2/jobs`. Two things to fill in before you create the job:

* **Location.** The output's `location` is `null` unless you sent a `location`. When you did, it comes back as `{ "location_str": "...", "workplace_type": "onsite" }`. `POST /v2/jobs` requires a `location` with a `workplace_type` (`remote`, `onsite` or `hybrid`), so set one yourself when the output has none, and correct `onsite` if it's wrong.
* **Script.** The output carries no `script_id`. Without one, `POST /v2/jobs` uses your organization's default script.

## Generate an interview script

Create a structured interview script with screening questions tailored to a role.

```bash theme={null}
curl -X POST https://api.classet.ai/v2/scripts/generate \
  -H "X-API-KEY: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "job_title": "CDL Truck Driver",
    "job_description": "Class A CDL, 2+ years experience, clean driving record",
    "focus_areas": ["driving experience", "safety record", "availability"]
  }'
```

`job_title` is required; `job_description` and `focus_areas` are optional. Returns a script name, description, and ordered tasks with the questions the AI interviewer will ask. Nothing is saved. To use the script:

1. Create the script with `POST /v2/scripts` and `{ "name": <name>, "description": <description> }`. It returns `script_id`. `POST /v2/scripts` doesn't accept the generated `tasks` array: the new script starts with Classet's standard phone-screen tasks, and a `tasks` field in the body is ignored.
2. Add each generated task with `POST /v2/scripts/{scriptId}/tasks`, passing its `name`, `description`, `questions` and `qualifying_questions`. Leave out `order`, and the API appends the task after the last one. Don't pass the generated `order`: generated tasks are numbered from 1, the standard tasks already use those numbers, and the API stores whatever `order` it's given, so generated questions end up mixed in with the standard Introduction. Skip any generated task that only greets the candidate or wraps up the call, such as "Introduction" or "Closing". The standard Introduction and Next Steps tasks already do that, and adding them would make the call repeat itself.
3. Appended tasks land after the standard Next Steps task. Read the script with `GET /v2/scripts/{scriptId}` and send `PUT /v2/scripts/{scriptId}/reorder-tasks` with every task in the order you want, Next Steps last. Pass each task's `id` as `task_id`; the `task_id` field on a task is not its id.
4. For each standard task you don't want, send `PATCH /v2/script-tasks/{taskId}` with the task's `id` and `{ "removed": true }`. Keep Introduction and Next Steps: they open and close the call.
5. Attach the script to a job with `PATCH /v2/jobs/{jobId}` and `{ "script_id": <script_id> }`.

If you skip step 2, the script has only the standard tasks and none of the generated questions or knockouts.

## Onboard a company

Set up an organization from a single description. Onboarding creates jobs and knowledge base entries.

```bash theme={null}
curl -X POST https://api.classet.ai/v2/onboard \
  -H "X-API-KEY: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "company_name": "Sunrise Home Health",
    "company_description": "Home health agency hiring CNAs and RNs across Texas. We need phone screens for basic qualifications, availability, and certifications.",
    "roles_to_hire": ["Registered Nurse", "Certified Nursing Assistant"],
    "industry": "Healthcare"
  }'
```

Returns `201` with the jobs it created and the number of knowledge entries it added. What it does and doesn't do:

* **It generates no scripts.** Every job it creates uses your organization's default script, so the organization must have one; without it the call returns `400`. `jobs_created[].script_id` is that default script's id. To give a job its own script, generate one and attach it as above.
* **It creates at most five jobs.** With no `roles_to_hire`, it suggests roles from the description.
* **The jobs are published at once,** with a generated description and no location. Each job's candidate-facing title is the role followed by ` - Remote` (for example `Registered Nurse - Remote`). Review them in the dashboard before candidates reach them.
* **A failed call can leave partial resources.** Onboarding removes what it created when a write fails or the AI returns nothing, but not when the AI provider errors or times out partway. The cleanup is also best-effort. Before you retry a failed call, list your jobs (`GET /v2/jobs`) and knowledge entries (`GET /v2/knowledge`) and delete anything it left behind, or a retry creates duplicates.

## Best practices

* Provide as much context as possible (`brief_description`, `job_description`, `company_description`) for better results
* AI-generated content is a starting point — review and customize before going live
* Use the knowledge base to give the AI interviewer company-specific context (benefits, culture, logistics)


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