---
title: "Upload a file"
method: POST
path: "/files"
---

# Upload a file

`POST /files`

## Request

- Base URL: `https://marqpdf.com/v1`
- URL: `https://marqpdf.com/v1/files`
- Auth: HTTP bearer

multipart/form-data with a `file` field (and optional `name`); the raw bytes as the body with `?name=`; or JSON `{"url": …}` to have MarqPDF fetch it (http/https, public addresses only). Up to 100 MB. Files are deleted after 24 hours.

## Query parameters

- `name` string

## Request body

- object
  - `url` string, uri, required
  - `name` string

## Response `201`

The stored file

- File
  - `object` 'file', required
  - `id` string, required
  - `name` string, required
  - `size` integer, required
  - `content_type` string, required
  - `pages` integer
  - `created_at` string, date-time, required
  - `expires_at` string, date-time, required
  - `source` 'upload' | 'url' | 'job', required
  - `job` string
  - `download_url` string, uri, required: Works without a key for an hour.

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid API key
- `413`: Too large
- `415`: Unsupported type
- `429`: Rate limit or job queue full (see Retry-After)

---

[API](https://skmtc.dev/marqpdf/apis/marqpdf-api.md) · [All operations](https://skmtc.dev/marqpdf/apis/marqpdf-api/llms.txt) · [OpenAPI document](https://skmtc.dev/marqpdf/apis/marqpdf-api/revisions/9f614f17df46?raw)
