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

# Create a Document

> Create a Document by uploading your file to Petal



## OpenAPI

````yaml POST /api/document/create
openapi: 3.0.3
info:
  title: Petal API Document
  description: Reference document for Petal app
  license:
    name: MIT
  version: 1.2.5
servers:
  - url: https://cite.petal.org
security:
  - bearerAuth: []
tags:
  - name: signup
  - name: extraction
  - name: referral
  - name: site
  - name: citegen
  - name: invite
  - name: user
  - name: tag
  - name: ai
  - name: notification
  - name: organization
  - name: annotation
  - name: search
  - name: attachment
  - name: collection
  - name: discourse
  - name: main
  - name: ai-create
  - name: document
  - name: payment
  - name: comment
  - name: lambda
  - name: sauce
  - name: admin
  - name: error
  - name: opengraph
  - name: default
  - name: media
  - name: file
  - name: oauth
paths:
  /api/document/create:
    post:
      tags:
        - document
      summary: Create a document
      description: Create a Document by uploading your file to Petal
      operationId: post_/api/document/create
      parameters: []
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                organization_id:
                  description: Unique ID of Organization
                  type: integer
                doctype:
                  description: Type of file, such as pdf, txt, etc.
                  type: string
                file:
                  description: Binary representation of the file
                  type: string
                  format: binary
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
          description: OK
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
          description: Unprocessable Entity
components:
  schemas:
    Document:
      additionalProperties: false
      properties:
        annotation_ids:
          items:
            type: integer
          title: Annotation IDs
          description: Unique IDs of Annotations made on this Document
          type: array
        created_at:
          title: Created At
          description: Creation time, by UTC
          type: string
        csl:
          title: CSL
          description: Citation information
          type: object
        doctype:
          title: Doctype
          description: Extension of the Document (txt, pdf, etc.)
          type: string
        file_resource_size:
          title: File Resource Size
          description: Size of extracted information
          type: integer
        file_size:
          title: File Size
          description: Size of original file
          type: integer
        filename:
          title: Filename
          description: Name of original file
          type: string
        id:
          title: ID
          description: Unique ID of the Document
          type: integer
        is_trash:
          title: Is Trash
          description: Is the Document in Workspace trash
          type: boolean
        meta:
          title: Meta
          description: Metadata, for internal use
          type: object
        modified_at:
          title: Modified At
          description: Modification time, by UTC
          type: string
        modified_by:
          title: Modified By
          description: User ID of last modifier. May be -1 (system)
          type: integer
        organization_id:
          title: Organization ID
          description: ID of Workspace this Document belongs to
          type: integer
        pages:
          title: Pages
          description: Number of pages in Document
          type: integer
        resource_size:
          title: Resource Size
          description: Miscellaneous space used by Document
          type: integer
        status:
          additionalProperties:
            type: integer
          title: Status
          description: >-
            Document processing status. 0 = not started, 1 = in progress, 2 =
            completed, and 3 = error
          type: object
        tag_ids:
          items:
            type: integer
          title: Tag IDs
          description: IDs of Tags added to this Document
          type: array
        ui:
          title: UI
          description: For use by Petal frontend, for UI settings
          type: object
        use_ocr:
          title: Use OCR
          description: >-
            Whether or not to use OCR on this Document. Leave as False except
            for images
          type: boolean
        user:
          $ref: '#/components/schemas/UserSimple'
      required:
        - annotation_ids
        - created_at
        - modified_at
        - modified_by
        - id
        - is_trash
        - use_ocr
        - meta
        - csl
        - ui
        - status
        - organization_id
        - tag_ids
        - user
        - doctype
        - file_size
        - pages
        - resource_size
        - file_resource_size
      title: Document
      type: object
    ValidationError:
      description: Model of a validation error response.
      items:
        $ref: '#/components/schemas/ValidationError.ValidationErrorElement'
      title: ValidationError
      type: array
    UserSimple:
      additionalProperties: false
      properties:
        id:
          title: ID
          description: Unique ID of user
          type: integer
        name:
          title: Name
          description: Name of user
          type: string
      required:
        - id
      title: UserSimple
      type: object
    ValidationError.ValidationErrorElement:
      description: Model of a validation error response element.
      properties:
        ctx:
          title: Error context
          type: object
        loc:
          items:
            type: string
          title: Missing field name
          type: array
        msg:
          title: Error message
          type: string
        type:
          title: Error type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationErrorElement
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````