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

# RPC documents

RPC documents are the registry filings behind an entity's actos. The commercial registry files related acts together in one filing, so Syntage groups the actos by the content hash computed from that filing and exposes each group as a document, deduplicated by content hash within the entidade.

Use RPC documents when your integration needs the filing a set of actos belongs to, the document PDF, or the filing's contents as a structure-preserving tree rather than the per-acto data.

## What a document gives you

* The registry metadata of the filing: precoded form, document number, NCI, submission and registration dates, and layout.
* The actos grouped under it, each with its own identifier.
* A reference to the document PDF when it has been downloaded (`fileId`), retrieved through the Files API.
* A structure tree, when one was captured, from the document structure endpoint.

## From an acto to its document

Each acto carries an `entityId` and a `documentId`. Read the document an acto was filed in at:

```
GET /entities/{entityId}/datasources/mx/rpc/documents/{documentId}
```

and the filing's structure tree at:

```
GET /entities/{entityId}/datasources/mx/rpc/documents/{documentId}/structure
```

`documentId` is `null` when no document is linked to the acto. That can mean the acto has no document, or that the document was not linked on the latest extraction, for example when the document fetch failed and a later extraction retries it. A document linked later is stored, so a fresh read returns the `documentId`, but no `rpc_acto.updated` event fires: re-read the acto rather than relying on a webhook or a copy fetched earlier. Where `documentId` is `null`, or the structure endpoint returns `404`, the acto's `data` field is the parsed view to fall back on, so read it there, though `data` itself may be absent or cover only part of the filing.

## The structure tree

The structure endpoint returns a snapshot of the registry form, taken on the first successful structure capture and then pinned unchanged, as a tree of nodes. Each node has a `type` (the kind of field or section), a `label` as it appears on the form, and an optional `id`. A node is either a container, carrying `children`, or a leaf, carrying a `value`. The root node also carries the form `layout`.

The tree preserves the registry form, so its exact field set and nesting follow the layout of the filing and are not guaranteed to be stable across layouts or over time. The endpoint returns `404` when no tree was captured for a document, which is the case for sandbox documents and some older documents. A document can be ingested before its structure is available, so a `404` is not necessarily permanent. Check `hasStructure` on the document first; it turns `true` once a tree is stored.

## How RPC documents are collected

RPC documents are collected by the RPC extraction, alongside the entidades, actos, and socios. Each company is persisted as it is processed, so its documents become available while the extraction is still running. A finished extraction is not a guarantee of a complete set: if a document fetch fails, the extraction logs it and continues, so some documents can be missing until a later extraction retries the import. Treat `documentId` and the document list as filled in across extractions, not as final after a single run.

For implementation details, see [Extraction request examples](https://docs.syntage.com/developers/extraction-request-examples.md#rpc).


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