# Batch Create Code Records

POST https://fai.buildwithfern.com/code/{domain}/batch-create
Content-Type: application/json

Reference: https://buildwithfern.com/learn/docs/ai-features/ask-fern/api-reference/code/batch-create-code-records

## OpenAPI Specification

```yaml
openapi: 3.1.1
info:
  title: Batch Create Code Records
  version: endpoint_code.batch_create_code_records
paths:
  /code/{domain}/batch-create:
    post:
      operationId: batch-create-code-records
      summary: Batch Create Code Records
      tags:
        - - subpackage_code
      parameters:
        - name: domain
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: >-
            Bearer authentication of the form `Bearer <token>`, where token is
            your auth token.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CreateCodeRecordResponse'
        '422':
          description: Validation Error
          content: {}
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/CreateCodeRecordRequest'
components:
  schemas:
    CreateCodeRecordRequest:
      type: object
      properties:
        document:
          type: string
          description: >-
            The content of the code document that will be returned to Ask Fern
            during retrieval.
        chunk:
          type:
            - string
            - 'null'
          description: >-
            The textual content that should be vectorized when indexing the
            code. If not provided, the full document will be vectorized.
        title:
          type:
            - string
            - 'null'
          description: >-
            The title of the code document. This will be used with the `url`
            when Ask Fern cites this code.
        url:
          type:
            - string
            - 'null'
          description: >-
            The url of the code document. This will be used as the source when
            Ask Fern cites it.
        version:
          type:
            - string
            - 'null'
          description: >-
            The version of the code. This will be compared against when running
            Ask Fern with version filters. If null, the code will be retrievable
            by all versions.
        product:
          type:
            - string
            - 'null'
          description: >-
            The product of the code. This will be used to filter code when
            running Ask Fern with product filters. If null, the code will be
            retrievable by all products.
        keywords:
          type:
            - array
            - 'null'
          items:
            type: string
          description: The keywords of the code. Adding keywords can improve code matching.
        authed:
          type:
            - boolean
            - 'null'
          description: >-
            Whether the code is auth gated. If false, the code record will be
            retrievable by all users.
      required:
        - document
    CreateCodeRecordResponse:
      type: object
      properties:
        code_id:
          type: string
          description: The unique identifier of the created code entry
      required:
        - code_id

```