Almost every Doctavian workflow starts or ends with a file: a template to generate from, data to fill it, a document to sign, a generated contract to download. This page explains where those files live, how long they stay there, and which of the API's several identifiers you need at each step. It applies to both the Documents and the Signatures API.
Storage is Doctavian's internal file store. It is the value Storage wherever the API asks for a loadMethod (where to read a file from) or a deliveryMethod (where to write one). Files get into Storage in two ways:
deliveryMethod Storage. The output's urn is its storage id.Storage is a short-term handover area, not an archive. A file is kept for 24 hours at most, and most files are removed sooner, the first time an operation uses them. To keep a file, download it, or deliver it to OneDrive or Google Drive instead.
There is a separate upload operation for each kind of file, and the storage id it returns is meant for a particular next step:
POST /documents/template/upload): the id goes in template.urn on a generate request, or in the urn of a document template record.POST /documents/data/upload): the id goes in data.urn on a generate request, or in the urn of a data source record. Each uploaded file is its own data source; several files are not combined. See Data Sources.POST /documents/document/upload).POST /signatures/document/upload): the id goes in documents[].urn when you create or update an envelope or Envelope Template.POST /signatures/envelope/{envelopeId}/attachment/upload), usually added by a recipient during signing.Every upload is multipart/form-data with one or more file parts, and returns one id per file in result.data.files, in the order sent:
POST https://api.doctavian.com/v1/documents/template/upload
Authorization: Bearer <token>
x-api-key: <api-key>
Content-Type: multipart/form-data
file: <offer-letter.docx>
file: <contract.docx>"files": [
{ "id": "b1e6d2c9-77aa-4f3b-8c21-9d0e4a6f2b58", "fileName": "offer-letter.docx" },
{ "id": "e610ac2d-440e-40a1-b61a-315c26f1618f", "fileName": "contract.docx" }
]Accepted formats and size limits are listed in Supported File Formats.
A storage id stops resolving at the first of two events: 24 hours pass, or an operation uses the file up. In practice:
remove to something other than none.Upload again before you retry. Because a generation uses up its Storage template and data even when it fails, retrying with the same ids fails with
TEMPLATE_NOT_FOUND. The same applies to records: a document template or data source whoseloadMethodisStoragecan feed one generation only, and a later document request on it ends in statusFailed. Upload the file again and point the record at the new id first.
Once a document is in an envelope, the envelope keeps it. Envelope documents are not subject to the 24-hour window. An envelope created from an Envelope Template takes its documents from the template, so no upload is part of that flow.
The API names files and the records about them with different identifiers. Most "not found" errors in file workflows come from sending one where another was expected.
| Identifier | What it names | Where you get it | Lifetime |
|---|---|---|---|
| Storage id | One file in Storage | An upload response, or the urn of output delivered to Storage | 24 hours at most, less once used up |
urn | A file in the location named by the accompanying loadMethod or deliveryMethod: a storage id for Storage; the drive's own file id for OneDrive and GoogleDrive; the API URL for a GraphQL data source | You send it, or a response returns it alongside deliveryMethod | That of the file it points at |
Record id | Something Doctavian stores about a file or a workflow: a document template, data source, document solution, document request, document record, envelope, envelope document, Envelope Template, attachment and so on | The id on the create, get or list response | Until the record is deleted |
A record often carries a urn of its own. That urn is a reference to a file, not a copy: a document template record whose file has been used up still exists, but no longer generates.
| You hold | Send it to | Not to |
|---|---|---|
A document record's id (documentId on a completed document request) | Document get and delete | Document download |
The same record's urn (the generated file) | GET /documents/document/{documentId}/download | Document get or delete |
A document template record id | documentTemplateId on a document request, solution links | template.urn on generate |
| An uploaded template file's storage id | template.urn on generate, or urn on a document template record | documentTemplateId on a document request |
A data source record id | dataSourceId | data.urn |
| An uploaded data file's storage id | data.urn, or the urn on a data source record | dataSourceId |
An envelope document id (documents[].id on the envelope) | GET /signatures/envelope/{envelopeId}/document/{documentId}/download | GET /signatures/document/{documentId}/download |
| The storage id you uploaded the envelope document with | GET /signatures/document/{documentId}/download, before an envelope uses it | The envelope document download |
A generate, manage or merge request names its output's destination in deliveryMethod and its folder in path. With Storage, the response's urn is a storage id, subject to the 24-hour window: download it, send it for signature as an envelope document urn, or pass it to manage or merge. With OneDrive or GoogleDrive, the file stays on the drive for as long as you keep it there, and the response also carries its URL and any sharing links you asked for.
"document": {
"deliveryMethod": "Storage",
"name": "offer-letter-SO-10442",
"fileFormat": "pdf",
"urn": "5d0c7a3e-91b4-4f6e-a2d8-3c7e19f04b6a"
}A document request delivers to Storage unless the request or its configuration says otherwise. When it completes, it creates a document record: metadata about the generated file, with the file's location in urn. The record is not the file. For a Storage delivery, the file behind the urn is subject to the same 24-hour window.
Instead of uploading, a Documents operation can read a file in place from OneDrive or Google Drive, and deliver its output there. Set loadMethod or deliveryMethod to OneDrive or GoogleDrive and send the drive's own file id as urn.
CONNECTOR_REQUIRED. An account admin connects drive accounts in the portal under Self-service → Connectors; see the Connectors user guide.gdoc, gsheet and gslide templates are loaded from, and delivered to, GoogleDrive only.The Signatures API reads envelope documents from Storage only.
Download operations return the file's raw bytes, not the usual JSON response. Use the operation that matches the id you hold (see Which id goes where):
GET /documents/document/{documentId}/download for an uploaded or generated file in Storage.GET /signatures/document/{documentId}/download for a document uploaded for signing that no envelope has used yet.GET /signatures/envelope/{envelopeId}/document/{documentId}/download for a document in an envelope. After the last signature, this is the signed document. The response has no file name, so name the file from the document's name.GET /signatures/envelope/{envelopeId}/audit/download for the audit trail PDF.GET https://api.doctavian.com/v1/documents/document/5d0c7a3e-91b4-4f6e-a2d8-3c7e19f04b6a/download
Authorization: Bearer <token>
x-api-key: <api-key>Right after the last signature, envelope get and envelope document download return 409 ENVELOPE_DOCUMENTS_PROCESSING while the signed documents are processed. Retry shortly.
For every error code and for retry guidance, see Error Codes and Error Handling.