> ## Documentation Index
> Fetch the complete documentation index at: https://developers.circularo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Documents & files

Signing is what Circularo is for, but a document exists before anyone signs it. This chapter covers that life: getting content in, describing it, finding it again, adding to it, organizing it, and taking the results back out.

## Files and documents

The two are deliberately separate:

* A **file** is raw content — the bytes of a PDF, an image, a finished archive. It is uploaded on its own, identified by an opaque `id`, and takes on a role only once something references it.
* A **document** is what Circularo manages: one **main file** plus a title, structured data, attachments, a place in your folders, an evidence trail, and exactly one transaction.

That split is why the same file endpoint serves everything binary: the PDF you upload, the signed result, an image embedded into a page, an export archive. Whenever an endpoint hands you a `fileId`, the content behind it is one download away.

Around the main file, a document carries:

* **Metadata fields** — the structured values of the metadata definition it was created with, which is also what you can search on.
* **Custom fields** — your own key/value data, for identifiers that belong to your system rather than to Circularo.
* **Attachments** and **submitted files** — supporting content alongside the main file, the second kind contributed by recipients.
* **Annotations**, **images** and **signatures** — everything applied onto the pages, whether by you or by a recipient.
* **Placements** — where the document sits in the folder trees, one entry per tree.

## How the pieces come together

A typical integration works in this order:

1. **Get the content in** — upload a file, or hand its content to the call that creates the document.
2. **Create the document** and describe it, so people and searches can find it later.
3. **Do something with it** — send it for signature ([Signing & approvals](https://developers.circularo.com/guides/signing)), or add your own content and seal it.
4. **Find it again** by its attributes rather than by an identifier you stored.
5. **Collect the outcome** — the signed file, the audit trail, the certificate, or a whole archive of them.

## Worth knowing across the chapter

* **Identifiers are opaque.** Keep the ones you are given; never build one or read meaning into its shape.
* **Deleting is reversible by default.** A document goes to the trash and can be restored; removing it for good is an explicit request.
* **A read always returns the same representation.** Creating, retrieving, annotating and cloning all answer with the same document object, so one parser covers them all.
* **Documents carry a version.** Reads return it as an `ETag`, and writes can be guarded with `If-Match` — see [Guard concurrent writes](https://developers.circularo.com/guides/robust-integrations/concurrency.md).

## Where to start

Begin with [Upload and download files](https://developers.circularo.com/guides/documents-and-files/files.md) and [Create a document from a file](https://developers.circularo.com/guides/documents-and-files/create-documents.md): together they cover the path from bytes on your disk to a document Circularo manages. [Store structured data on a document](https://developers.circularo.com/guides/documents-and-files/metadata.md) then makes that document describable, and searchable.

From there, pick by task:

* Find documents again — [Search documents](https://developers.circularo.com/guides/documents-and-files/search.md).
* Add your own content and close a document off — [Annotate and seal a document](https://developers.circularo.com/guides/documents-and-files/annotate-and-seal.md).
* Reuse a document, or let somebody read it without an account — [Copy a document and share a view link](https://developers.circularo.com/guides/documents-and-files/clone-and-links.md).
* Clean up, and get something back that was thrown away — [Delete and restore a document](https://developers.circularo.com/guides/documents-and-files/trash.md).
* Prove what happened — [Collect the evidence of a signed document](https://developers.circularo.com/guides/documents-and-files/evidence.md).
* Keep everything where colleagues expect it — [Organize documents in folders](https://developers.circularo.com/guides/documents-and-files/folders.md).
* Take documents out in bulk — [Export documents as archives](https://developers.circularo.com/guides/documents-and-files/exports.md).

## Pages in this chapter

> [card] [Upload and download files](https://developers.circularo.com/guides/documents-and-files/files.md)
>
> Every document Circularo manages is built on a file, and every signed result comes back as one. This guide uploads a PDF, looks its metadata up again, and downloads its content — three calls that cover the whole file surface.

> [card] [Create a document from a file](https://developers.circularo.com/guides/documents-and-files/create-documents.md)
>
> A document is the unit Circularo manages: a main file plus a title, structured data, a place in your folders, and an evidence trail. This guide creates one from a file you uploaded, creates a second one with a category and an attachment, and reads a document back. It takes three calls.

> [card] [Store structured data on a document](https://developers.circularo.com/guides/documents-and-files/metadata.md)
>
> Documents carry more than a title. This guide finds out which structured fields a document can hold, then creates one that fills them and adds a couple of values of your own. It takes three calls.

> [card] [Search documents](https://developers.circularo.com/guides/documents-and-files/search.md)
>
> A search finds documents by what they are rather than by their identifier — their metadata definition, category, creation time, transaction status or the values of their metadata fields. This guide narrows the collection down with query parameters, searches on a metadata value, and applies a view somebody saved in the web app. It takes four calls.

> [card] [Annotate and seal a document](https://developers.circularo.com/guides/documents-and-files/annotate-and-seal.md)
>
> Before a document goes anywhere, your integration can add its own content to it — a note, a logo — and then seal it, producing cryptographic proof that it has not changed since. This guide does both, in that order, in two calls.

> [card] [Copy a document and share a view link](https://developers.circularo.com/guides/documents-and-files/clone-and-links.md)
>
> A document runs exactly one transaction, so a copy is what gives you a second run — of a finished agreement, or of a master document you keep and copy per counterparty. A view link then lets somebody read a document without a Circularo account. This guide does both in two calls.

> [card] [Delete and restore a document](https://developers.circularo.com/guides/documents-and-files/trash.md)
>
> Deleting a document does one of two things, and you choose which: it either moves the document to the trash, where it stays readable and can be brought back, or removes it outright. This guide walks both paths in four calls.

> [card] [Collect the evidence of a signed document](https://developers.circularo.com/guides/documents-and-files/evidence.md)
>
> Circularo records everything that happens to a document, and hands it back in three forms: a timeline you can read, a sealed audit trail, and the certificate that closes a finished transaction. This guide collects all three in three calls.

> [card] [Organize documents in folders](https://developers.circularo.com/guides/documents-and-files/folders.md)
>
> Folders keep documents where people expect to find them in the Circularo web app. This guide creates a folder, files a document into it, publishes the same document to the organization's tree, reads back where it ended up, and lists the folders it can see. It takes five calls.

> [card] [Export documents as archives](https://developers.circularo.com/guides/documents-and-files/exports.md)
>
> An export packs documents and the evidence around them into a ZIP archive. Which way it arrives depends on the endpoint you call: the one that exports a single document answers with the archive itself, while every other export is prepared in the background and collected once it is ready. This guide does both, in four calls.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.