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

# Upload a file

> Upload one nonempty file with a supported extension: DOCX, MD/Markdown, HTML/HTM, TXT, RTF, ODT, PDF, JPEG/JPG, PNG, WebP, or GIF. Text, Markdown, and HTML must be UTF-8. Prompt targets accept only DOCX, Markdown, HTML, and text; other formats must be converted first. There is no public upload-list or original-file-download endpoint.

See [files and retention](/developer/docs/developer/docs/revise-api/files) for integration guidance.

## TypeScript

```ts theme={null}
import { ReviseClient } from "@reviseio/api";

const revise = new ReviseClient({ apiKey: process.env.REVISE_API_KEY! });
const result = await revise.files.upload(
  { filename: "report.md", data: new TextEncoder().encode("# Quarterly report") },
  { idempotencyKey: "upload-42" },
);
```


## OpenAPI

````yaml developer/docs/openapi/revise-api.json POST /v1/files
openapi: 3.1.0
info:
  title: Revise API
  version: 0.1.0
  description: >-
    Asynchronous document prompts and format conversions. Submit a job, poll its
    receipt or receive a webhook, then download its artifacts. USD amounts are
    exact decimal strings. Job content expires 24 hours after terminal
    completion. All account endpoints require a bearer API key.
servers:
  - url: https://revise.io/api
security:
  - apiKey: []
paths:
  /v1/files:
    post:
      summary: Upload a file
      description: >-
        Upload one nonempty file with a supported extension: DOCX, MD/Markdown,
        HTML/HTM, TXT, RTF, ODT, PDF, JPEG/JPG, PNG, WebP, or GIF. Text,
        Markdown, and HTML must be UTF-8. Prompt targets accept only DOCX,
        Markdown, HTML, and text; other formats must be converted first. There
        is no public upload-list or original-file-download endpoint.
      operationId: uploadFile
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 200
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    One nonempty file, at most 18 MiB. Accounts may retain up to
                    100 undeleted uploads totaling 256 MiB. Filename: at most
                    255 bytes, with no path separators or control characters.
                    DOCX/ODT expanded archives are limited to 128 MiB; DOCX
                    archives may contain at most 10,000 entries.
                lifetime:
                  type: string
                  enum:
                    - ephemeral
                    - persistent
                  default: ephemeral
                  description: >-
                    Ephemeral files can be claimed by one request and are
                    deleted immediately on success. Failed or cancelled requests
                    retain their source for 24 hours; unused uploads expire 24
                    hours after upload. Persistent templates remain until
                    explicit deletion.
              required:
                - file
              additionalProperties: false
      responses:
        '200':
          description: Idempotent upload replay
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
          headers:
            Location:
              description: Account-authenticated path to retrieve this resource.
              schema:
                type: string
            Idempotent-Replayed:
              description: Present with value true on an idempotent replay.
              schema:
                type: string
                enum:
                  - 'true'
        '201':
          description: >-
            Uploaded file metadata. Store its ID for job creation or later
            deletion.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
          headers:
            Location:
              description: Account-authenticated path to retrieve this resource.
              schema:
                type: string
            Idempotent-Replayed:
              description: Present with value true on an idempotent replay.
              schema:
                type: string
                enum:
                  - 'true'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    File:
      type: object
      properties:
        id:
          type: string
        filename:
          type: string
          description: Empty once expired or deleted.
        bytes:
          type: integer
        sha256:
          type: string
        status:
          type: string
          enum:
            - uploaded
            - expired
            - deleted
        created_at:
          type: string
          format: date-time
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
        lifetime:
          type: string
          enum:
            - ephemeral
            - persistent
      required:
        - id
        - filename
        - bytes
        - sha256
        - status
        - created_at
        - expires_at
        - lifetime
        - deleted_at
      additionalProperties: false
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: object
              additionalProperties: true
          required:
            - code
            - message
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Revise API key from https://revise.io/console/api-keys. Send
        Authorization: Bearer <key>.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.