---
title: "Add a document"
method: POST
path: "/api/trips/{id}/documents"
tags: ["Documents"]
---

# Add a document

`POST /api/trips/{id}/documents`

## Request

- Base URL: `https://trvlrr.app`
- URL: `https://trvlrr.app/api/trips/{id}/documents`
- Auth: HTTP bearer

Raw bytes in the body: a PDF, an Apple Wallet pass, or a JPEG/PNG image (sniffed, not trusted from the header). Up to 10 MB a file and 200 MB of documents an account.

## Path parameters

- `id` string, required: The trip id.

## Query parameters

- `filename` string: The name to show; defaults to document.<ext>.
- `segment_id` string: Attach to this transport leg of the trip.
- `stay_id` string: Attach to this stay of the trip.

## Response `201`

Stored.

- Document
  - `id` string, required
  - `filename` string, required
  - `content_type` string, required
  - `size_bytes` integer, nullable, required
  - `segment_id` string, nullable, required
  - `stay_id` string, nullable, required
  - `created_at` string, required

## Other responses

- `400`: The request is malformed or fails validation.
- `401`: No usable credential: a Clerk session token, a device token or an OAuth access token is required.
- `403`: The caller may not do this to this account or trip.
- `404`: No such thing, or not one the caller can see.
- `413`: The upload is too large.
- `415`: The bytes are not a supported type.

---

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