# Files

> Give Hapti tasks the files to upload on a site, and download the documents a site gave during a task, such as invoices and certificates.

## Files the agent uploads

Give `files` when the site asks for documents, such as an identity card or a proof of address. Each file has a `name` and either its content in `base64`, or an https `url` where Hapti fetches it.

```json
{
  "url": "https://portal.example.com/apply",
  "goal": "Submit the application with the documents.",
  "files": [
    { "name": "passport.pdf", "url": "https://files.example.com/signed/abc" },
    { "name": "proof-of-address.jpg", "base64": "/9j/4AAQSkZJRg..." }
  ]
}
```

Up to 20 files, 50 MB each and 100 MB in all. Two files cannot share a name.

## Files the site gives

When the site gives a document during the task, the agent keeps it. A finished task lists them in `files`, each with a `url` you download with your key:

```bash
curl -OJ https://api.hapti.dev/v1/tasks/tsk_.../files/invoice-2026-11.pdf \
  -H "Authorization: Bearer $HAPTI_KEY"
```

Files are kept with the proof of the task, and only your organisation can download them.
