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

# Upload a file

## 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 openapi/revise-api.json POST /v1/files
openapi: 3.1.0
info:
  title: Revise API
  version: 0.1.0
  description: >-
    Queued document prompting and file conversion. Conversion supports the same
    formats as revise.io/converter, including semantic PDF/image scanning. USD
    responses are exact decimal strings. Same-origin downloads require Bearer
    auth. Account provider keys (BYOK) are pinned at admission. Request content
    expires 24 hours after terminal completion; encrypted artifacts use compact
    JWE RSA-OAEP-256/A256GCM.
servers:
  - url: https://revise.io/api
security:
  - apiKey: []
paths:
  /v1/files:
    post:
      summary: >-
        Upload one immutable source (PDF, DOCX, MD, HTML, TXT, RTF, ODT, PNG,
        JPEG, WebP or GIF)
      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 file with a supported filename. Maximum 18 MiB; 100
                    files/256 MiB per local account.
                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'
        '201':
          description: Upload one immutable target file (DOCX, UTF-8 TXT, MD or HTML)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        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
      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>.

````