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

# Create Knowledge Entry

> Add a new entry to the knowledge base. Entries can be scoped to org, branch, job, or script level.

Creates a new knowledge base entry. The AI interviewer uses these entries to answer candidate questions and provide accurate information during calls. `scope_id` is required for `branch`, `job` and `script` scope.

* **`job` scope:** `scope_id` is the job's `id`. For a job created with `POST /v2/jobs`, that is the `job_id` the API returned. A v1 shortcode that differs from the job's `id` is not matched.
* **`script` scope:** also send `script_id` (the script's numeric id). Interviews match script-scoped entries on `script_id`, so an entry created without it is stored but never used in an interview.

Returns the new entry's `id`. Use [List Knowledge Entries](/docs/api-reference/knowledge/list-entries.md) to read it back.

```bash cURL theme={null}
curl -X POST https://api.classet.ai/v2/knowledge \
  -H "X-API-KEY: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "entry_type": "qa",
    "question": "What is the pay range for this role?",
    "answer": "The pay range is $25-35/hour depending on experience and certifications.",
    "scope": "job",
    "scope_id": "k7Hq2xVbN"
  }'
```

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


## OpenAPI

````yaml POST /v2/knowledge
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/knowledge:
    post:
      tags:
        - Knowledge Base
      summary: Create a knowledge entry
      description: >-
        Add a new entry to the knowledge base. Entries can be scoped to org,
        branch, job, or script level.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                scope:
                  type: string
                  enum:
                    - org
                    - branch
                    - job
                    - script
                  default: org
                  description: >-
                    The scope level for this entry. One of `org`, `branch`,
                    `job`, or `script`. Defaults to `org` (organization-wide).
                scope_id:
                  type: string
                  nullable: true
                  description: >-
                    The ID of the scoped resource. Required for `branch`, `job`,
                    and `script` scopes.
                entry_type:
                  type: string
                  enum:
                    - qa
                    - context
                    - document
                  default: qa
                  description: >-
                    The type of entry. One of `qa`, `context`, or `document`.
                    Defaults to `qa`.
                question:
                  type: string
                  description: The question text. Required for `qa` type entries.
                answer:
                  type: string
                  description: The answer text. Required for `qa` type entries.
                content:
                  type: string
                  description: >-
                    Free-form content. Used for `context` and `document` type
                    entries.
                script_id:
                  type: integer
                  description: >-
                    Associate this entry with a specific script. Alternative to
                    using `scope: "script"` with `scope_id`.
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                    required:
                      - id
                required:
                  - data
        '400':
          description: Validation 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
        '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.