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

# Create Script

> Create a script from a template. Pass questions keyed by task name or short_name.

Creates a new interview script from Classet's Basic Interview template. The new script gets a copy of the template's five tasks, in order:

| Order | Task `name` | `short_name` | Takes `questions` |
| - | - | - | - |
| 1 | `Introduction` | `Intro` | No |
| 2 | `AI Introduction` | `AI Intro` | No |
| 3 | `Sell The Position` | `The Sell` | No |
| 4 | `Learn the Basics about the Candidate` | `Basics` | Yes |
| 5 | `Establish Next Steps` | `Next Steps` | Yes |

`questions` is an object keyed by a task's `name` or `short_name`. Each value replaces that task's default questions. A task you don't name keeps the template's default questions. A key that matches no task is ignored without an error, so check the spelling. Only tasks whose `needed_variables` include `task.questions` ask the questions you set.

You can customize individual tasks afterward using the [Update Task](/docs/api-reference/scripts/update-task.md) endpoint.

Returns the new `script_id`. Fetch [Get Script](/docs/api-reference/scripts/get-script.md) when you need the generated task list.

```bash cURL theme={null}
curl -X POST https://api.classet.ai/v2/scripts \
  -H "X-API-KEY: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Electrician Screen",
    "description": "Screening script for electrician roles",
    "default": false,
    "questions": {
      "Basics": [
        "How many years of electrical experience do you have?",
        "Are you a journeyman or master electrician?"
      ],
      "Next Steps": [
        "Are you available to start within two weeks?",
        "Do you have reliable transportation?"
      ]
    }
  }'
```

```json 201 theme={null}
{
  "data": {
    "script_id": 3
  }
}
```


## OpenAPI

````yaml POST /v2/scripts
openapi: 3.1.0
info:
  title: Classet API
  version: 2.0.3
  description: >-
    AI-powered recruiting and phone screening API.


    **API key scopes.** `read` covers every GET; any other method needs `write`
    (403 `insufficient_scope`); starting or stopping an interview also needs
    `interviews:send`. A branch-limited key sees and writes only jobs in its
    branches (not jobs with no branch) and their candidates, applications and
    calls; anything outside is a 404. An organization-group key is read-only
    across every organization in its group. Branch-limited and group keys cannot
    use organization configuration (scripts, knowledge, webhooks, message
    automations, agent settings, AI generation, organization): 403
    `restricted_key_unsupported`. `GET /v2/me` reports what the calling key can
    do.
servers:
  - url: https://api.classet.ai
    description: Production
  - url: http://localhost:8081
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /v2/scripts:
    post:
      tags:
        - Scripts
      summary: Create a new interview script
      description: >-
        Create a script from a template. Pass questions keyed by task name or
        short_name.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  example: Technical Screen
                  description: The name of the script.
                description:
                  type: string
                  description: A description of the script's purpose.
                default:
                  type: boolean
                  description: Set to `true` to make this the default script for new jobs.
                questions:
                  type: object
                  additionalProperties:
                    nullable: true
                  description: >-
                    Questions for the script's tasks, as a map from task key to
                    an array of question strings. A new script copies its tasks
                    from the default interview template; each key must match a
                    task's `name` or `short_name` in that template (see GET
                    /v2/scripts/{scriptId} for a script's tasks). Unknown keys
                    are ignored, and a task with no matching key keeps the
                    template's questions.
              required:
                - name
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      script_id:
                        type: integer
                    required:
                      - script_id
                required:
                  - data
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Resource not found
                  code:
                    type: string
                    enum:
                      - not_found
                      - validation_error
                      - unauthorized
                      - forbidden
                      - insufficient_scope
                      - restricted_key_unsupported
                      - branch_out_of_scope
                      - key_misconfigured
                      - quota_exceeded
                      - rate_limited
                      - rate_limit_unavailable
                      - conflict
                      - idempotency_key_reuse
                      - candidate_opted_out
                      - recently_contacted
                      - request_in_progress
                      - unprocessable
                      - bad_request
                      - payload_too_large
                      - internal_error
                      - service_unavailable
                    example: not_found
                    description: Stable machine-readable error code.
                  request_id:
                    type: string
                    example: 9f2c1d7e-4a3b-4c8d-9e0f-1a2b3c4d5e6f
                    description: >-
                      Request ID, also echoed in the X-Request-Id response
                      header. Include it when reporting issues.
                required:
                  - error
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Resource not found
                  code:
                    type: string
                    enum:
                      - not_found
                      - validation_error
                      - unauthorized
                      - forbidden
                      - insufficient_scope
                      - restricted_key_unsupported
                      - branch_out_of_scope
                      - key_misconfigured
                      - quota_exceeded
                      - rate_limited
                      - rate_limit_unavailable
                      - conflict
                      - idempotency_key_reuse
                      - candidate_opted_out
                      - recently_contacted
                      - request_in_progress
                      - unprocessable
                      - bad_request
                      - payload_too_large
                      - internal_error
                      - service_unavailable
                    example: not_found
                    description: Stable machine-readable error code.
                  request_id:
                    type: string
                    example: 9f2c1d7e-4a3b-4c8d-9e0f-1a2b3c4d5e6f
                    description: >-
                      Request ID, also echoed in the X-Request-Id response
                      header. Include it when reporting issues.
                required:
                  - error
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: Your Classet API key. Create and rotate keys in Settings → API.

````

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