---
title: "Files and dictation"
description: "Upload health documents and images, attach files, and transcribe audio."
canonical_url: "https://scholarxiv.com/developers/docs/health-api/files"
markdown_url: "https://scholarxiv.com/developers/docs/health-api/files.md"
---

> For the complete documentation index, see [llms.txt](/llms.txt).

# Files and dictation
URL: /developers/docs/health-api/files
LLM index: /llms.txt
Description: Upload health documents and images, attach files, and transcribe audio.
Related: health-api, health-api/quickstart

# Files and dictation

## Upload a file and ask about it

This JavaScript example uses a server-side API key and Node's file API. The signed upload URL expires after 60 seconds; upload immediately, then complete before attaching the file to a message.

```javascript
import { readFile } from 'node:fs/promises';

const base = 'https://scholarxiv.com';
async function api(path, body) {
	const response = await fetch(`${base}/api/v1/${path}`, {
		method: 'POST',
		headers: {
			Authorization: `Bearer ${process.env.SCHOLARXIV_API_KEY}`,
			'Content-Type': 'application/json'
		},
		body: JSON.stringify(body)
	});
	if (!response.ok) throw new Error(await response.text());
	return response.json();
}

const bytes = await readFile('./lab-report.pdf');
const { attachment, uploadUrl } = await api('uploads/presign', {
	filename: 'lab-report.pdf',
	mime: 'application/pdf',
	size: bytes.length,
	scope: 'health'
});
const upload = await fetch(uploadUrl, {
	method: 'PUT',
	headers: { 'Content-Type': 'application/pdf' },
	body: bytes
});
if (!upload.ok) throw new Error(`Upload failed: ${upload.status}`);
await api('uploads/complete', { id: attachment.id });
const answer = await api('health/chat', {
	message: 'Explain this report and suggest questions for my clinician.',
	attachment_ids: [attachment.id]
});
console.log(answer.text);
```

Files are limited to 20 MiB each and five attachments per chat turn, subject to account storage and per-chat limits. Supported document types include PDF, DOCX, plain text, Markdown and CSV, plus supported images such as JPEG and PNG. See [Files and dictation](/developers/docs/agent-api/files). Only ready files owned by the caller can be attached. `GET /api/v1/uploads?scope=health` lists files; `GET /api/v1/uploads/{id}` returns a download URL valid for 300 seconds. Do not send your API key to the signed storage URL.

## Dictation

Send multipart `audio` and `provider` (`addis` or `elevenlabs`) to `POST /api/v1/transcribe`, then send the transcript as `message` to `POST /api/v1/health/chat`. See the shared [Files and dictation guide](/developers/docs/agent-api/files) for the transcription contract.

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
