---
title: "Keep a PDF, Word or PowerPoint file the user shares in a chat"
method: POST
path: "/agents/documents"
tags: ["AI", "Agents"]
---

# Keep a PDF, Word or PowerPoint file the user shares in a chat

`POST /agents/documents`

## Request

- Base URL: `https://app.mammoth.io/api/v2`
- URL: `https://app.mammoth.io/api/v2/agents/documents`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-KEY` and API key in header `X-API-SECRET` and API key in header `X-WORKSPACE-ID`

One document of at most 20 MB. Kept once per workspace and content, with what the model reads made from it (a PDF's first 50 pages, a Word file as a PDF, a deck's slides, charts and theme); the returned `ref` is what a chat message's document attachment names. Nothing is imported.

## Query parameters

- `workspace_id` integer, required

## Response `201`

Document created, URL follows

- ChatDocumentResponse
  - `ref` string, required
  - `name` string, required
  - `kind` string, required
  - `pages` integer, required
  - `pages_read` integer, required
  - `byte_size` integer, required

## Other responses

- `400`: Bad request syntax or unsupported method
- `403`: Request forbidden -- authorization will not help

---

[API](https://skmtc.dev/mammoth/apis/mammoth-analytics.md) · [All operations](https://skmtc.dev/mammoth/apis/mammoth-analytics/llms.txt) · [OpenAPI document](https://skmtc.dev/mammoth/apis/mammoth-analytics/revisions/4b2c943a00dc?raw)
