# Create Document

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

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

## OpenAPI Specification

```yaml
openapi: 3.1.1
info:
  title: Create Document
  version: endpoint_document.create_document
paths:
  /document/{domain}/create:
    post:
      operationId: create-document
      summary: Create Document
      tags:
        - - subpackage_document
      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/CreateDocumentResponse'
        '422':
          description: Validation Error
          content: {}
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDocumentRequest'
components:
  schemas:
    CreateDocumentRequest:
      type: object
      properties:
        document:
          type: string
          description: >-
            The content of the document that will be returned to Ask Fern during
            document retrieval.
        chunk:
          type:
            - string
            - 'null'
          description: >-
            The textual content that should be vectorized when indexing the
            document. If not provided, the full document will be vectorized.
        title:
          type:
            - string
            - 'null'
          description: >-
            The title of the document. This will be used with the `url` when Ask
            Fern cites this document.
        url:
          type:
            - string
            - 'null'
          description: >-
            The url of the document. This will be used as the source of the
            document when Ask Fern cites it.
        version:
          type:
            - string
            - 'null'
          description: >-
            The version of the document. This will be compared against when
            running Ask Fern with version filters. If null, the document will be
            retrievable by all versions.
        product:
          type:
            - string
            - 'null'
          description: >-
            The product of the document. This will be used to filter documents
            when running Ask Fern with product filters. If null, the document
            will be retrievable by all products.
        keywords:
          type:
            - array
            - 'null'
          items:
            type: string
          description: >-
            The keywords of the document. Adding keywords can improve document
            matching.
        authed:
          type:
            - boolean
            - 'null'
          description: >-
            Whether the document is auth gated. If false, the document will be
            retrievable by all users.
      required:
        - document
    CreateDocumentResponse:
      type: object
      properties:
        document_id:
          type: string
          description: The unique identifier of the created document
      required:
        - document_id

```