A Data Source tells Doctavian where a document's data comes from at generation time. Every Data Source has a load method that determines how that data is retrieved, and a urn that says where it is. The same Data Source can be attached to several Document Solutions — useful when several pipelines draw on the same underlying data.
The same definition appears in two places in the API: saved as a Data Source record (POST /documents/datasource/create) for use with Document Solutions and Document Requests, and inline in the data of a one-call POST /documents/document/generate. The fields mean the same in both. Either way, a generation reads one data source: a Document Request names one Data Source record, and a one-call generate takes one data object.
For step-by-step setup, see How to: Set up Data Sources (Storage, OneDrive and Google Drive) and GraphQL Data Sources.
Whatever the load method, the data the template receives has one shape: a JSON object whose data property holds named lists of records.
{
"data": {
"customer": [ { "Name": "Acme Logistics Group", "AccountId": "0001008213" } ],
"payments": [ { "Amount": "123.45" } ]
}
}data is an array — a single record still goes in a list of one."EffectiveDate": "Jun 30, 2025", "UnitPrice": "4,800").LineItems) is also a list.data at the root are ignored — nothing outside data is available at generation time.The object and field names are what your template's merge fields and elements refer to. To see exactly what a Data Source returns, call POST /documents/datasource/{dataSourceId}/data/load — it loads the data the way generation would, without generating anything.
| Load method | urn is… | Description |
|---|---|---|
| Storage | The storage id returned by POST /documents/data/upload | The simplest method. You upload a JSON file to Doctavian Storage, already structured as your template expects, and it is used as-is |
| OneDrive | The OneDrive file id | Like Storage, but the JSON file stays on OneDrive and is read through the caller's connected Microsoft account |
| GoogleDrive | The Google Drive file id | The same, for a file on Google Drive |
| GraphQL | The URL of an external API | Doctavian calls the API at generation time — with query and variables — and uses the result as the data. The endpoint can also be plain REST, called with PUT |
query is read only for GraphQL, and ignored for the other three methods.
For most integrations, Storage is the right choice. You prepare your data as JSON — structured to match the fields and collections your template uses — and upload it to Doctavian Storage. Each uploaded file is one data source with its own storage id: put it in the data of a one-call generate, or save it as the urn of a Data Source record. Uploading several files in one request does not combine them.
Because there's no transformation step, the shape of your uploaded data needs to match what the template expects: there is no way to filter, rename or transform it after upload. If your data comes from a system with different field names or structure, prepare it in your own integration code before uploading — or use the GraphQL load method to fetch it from an API that returns the right shape.
The upload checks only the outer shape — a root data object whose members are lists — and rejects it with 400 if that is wrong. The values inside records are validated at generation time.
Uploaded data files are disposable. Each is held for 24 hours, and removed sooner by the first generation that reads it — whether that generation succeeds or fails. A Data Source therefore doesn't hold a permanent copy of your data: upload a fresh file and update the Data Source's
urnbefore each run. Loading data withdata/loaddoes not consume the file. See Storage and File IDs.
These load methods work like Storage, but instead of uploading a file to Doctavian, you reference a JSON file already on OneDrive or Google Drive by its file id. The file is read through the caller's connected account for that drive, so it must be accessible to that account. Drive accounts are connected by an account admin in the Doctavian Portal under Self-service → Connectors; see the Connectors user guide. Drive files are not consumed by generation.
GraphQL is for cases where your data lives in a live external system rather than a static file. Instead of uploading data ahead of time, the Data Source's urn points at an API endpoint, and Doctavian calls it whenever generation runs, combining urn, query (a JSON-serialized GraphQL request body) and variables to build the request. The endpoint does not have to be a true GraphQL endpoint — a plain REST endpoint is called with a PUT request instead.
See GraphQL Data Sources for a walkthrough.
variables are optional named values injected into the data before it is merged, each { "name", "value", "type" }. Omit the array when you don't need extra or computed values. The same shape is accepted on a Data Source record and inline on a one-call generate in data.variables.
type | How it is applied | name | value |
|---|---|---|---|
global | Added as a top-level property on the data object | The variable's own name | A literal, a function expression such as {!$now()}, a reference to other variables, or a combination |
fieldExpression | Placed at the location its name gives | Path.Name form, e.g. Account.CreatedDate | As for global |
graphql | Supplies a value for a variable the query references — GraphQL Data Sources only | The variable's own name | A fixed literal |
See the Expressions Reference for the functions you can use in a value.
See the full set of Data Source endpoints in the API Reference, and How to: Set up Data Sources for the steps.