> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiJjOGQ0ZGQ1Zi03NWYxLTRjMTEtYTdmOS02MzQyNzFhMTYyM2MiLCJleHAiOjE3NzgyODc2MjgsImlhdCI6MTc3ODI4NzMyOH0.dovGmkGPjYrwk5shOkAzTzOz8kszzdA1GUPAGI3cfO8
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# 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.0
info:
  title: fai
  version: 1.0.0
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
          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:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDocumentRequest'
servers:
  - url: https://fai.buildwithfern.com
  - url: https://fai-dev.buildwithfern.com
  - url: http://localhost:8080
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
      title: CreateDocumentRequest
    CreateDocumentResponse:
      type: object
      properties:
        document_id:
          type: string
          description: The unique identifier of the created document
      required:
        - document_id
      title: CreateDocumentResponse
    ValidationErrorLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorLocItems
    ValidationError:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorLocItems'
        msg:
          type: string
        type:
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      title: HTTPValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```