ImportOS · Docs
API reference

POST /v1/documents/generate

Generate a document for a deal

Generate a document for a deal

Renders a contract, invoice, act, power of attorney, etc. (PDF + DOCX) from a tenant or system template. The document is created as a draft with the next sequential number; sending for signature and signing happen in Desk (the document.signed webhook reports it). Supports Idempotency-Key: always send one, otherwise a retry creates a second numbered document. Requires scope write:deals.

  • Authentication: header Authorization: Bearer rv_live_... (API keys and scopes)
  • Required scope: write:deals
Descriptions of the operation, parameters and fields come from the OpenAPI specification (openapi.json).

Parameters

FieldInTypeRequiredDescription
idempotency-keyheaderstringnoMakes a retry of this POST safe for 24 hours: the same key and body returns the stored response (Idempotent-Replay: true).

Request body

FieldTypeRequiredDescription
dealIdstring (uuid)yes
kind"contract" | "logistics_contract" | "invoice" | "act" | "power_of_attorney" | "specification" | "receipt" | "eta_notice" | "customs_package" | "custom"yes
legalEntityIdstring | null (uuid)no
paymentIdstring | null (uuid)no
templateIdstring | null (uuid)no
titlestring | nullno
overridesobjectno
overrides.poaobjectno
overrides.poa.valid_untilstringno
overrides.poa.representative_namestringno
overrides.poa.representative_tax_idstring | nullno
overrides.poa.representative_passportstring | nullno
overrides.poa.representative_addressstring | nullno
overrides.poa.broker_namestring | nullno
overrides.poa.customs_poststring | nullno
overrides.handoverobjectno
overrides.etaobjectno
overrides.paymentobjectno
overrides.extraobjectno
overrides.documentDatestringno

Responses

201

The generated draft.

application/json · Schema: DocumentGenerated

FieldTypeRequiredDescription
documentIdstring (uuid)yes
numberstringyesSequential document number of the tenant, e.g. VZ-D-2026-000123.
kindstringyes
statusstringyesdraft | sent | signed | void.
pdfFileIdstring | null (uuid)yesId of the PDF in the platform file storage (download via Desk/Track; no public URL is returned).
docxFileIdstring | null (uuid)yes
verifyUrlstring | nullyesPublic verification page (QR) of the document.
warningsstring[]yes
existingbooleanyesAlways false for API calls.

400

Invalid request parameters or body (code validation_error).

application/problem+json · Schema: Problem

401

Missing, malformed, unknown, revoked or expired API key (code unauthorized).

application/problem+json · Schema: Problem

403

The API key lacks the scope required by this endpoint (code insufficient_scope).

application/problem+json · Schema: Problem

404

Deal, payment or template not found in this tenant.

application/problem+json · Schema: Problem

409

A request with this Idempotency-Key is still being processed.

application/problem+json · Schema: Problem

422

Data required by the template is missing (code data_missing, fields in errors[]), or Idempotency-Key reused with a different request.

application/problem+json · Schema: Problem

429

Rate limit exceeded for the tenant plan (code rate_limited). Wait Retry-After seconds.

application/problem+json · Schema: Problem

502

Document renderer or storage unavailable.

application/problem+json · Schema: Problem

On this page