ImportOS · Документація
Довідник API

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.

  • Автентифікація: заголовок Authorization: Bearer rv_live_... (API-ключі та scopes)
  • Потрібний scope: write:deals
Опис операції, параметрів і полів походить зі специфікації OpenAPI (openapi.json) і подається англійською, як у самому API.

Параметри

ПолеДеТипОбов’язк.Опис
idempotency-keyheaderstringніMakes a retry of this POST safe for 24 hours: the same key and body returns the stored response (Idempotent-Replay: true).

Тіло запиту

ПолеТипОбов’язк.Опис
dealIdstring (uuid)так
kind"contract" | "logistics_contract" | "invoice" | "act" | "power_of_attorney" | "specification" | "receipt" | "eta_notice" | "customs_package" | "custom"так
legalEntityIdstring | null (uuid)ні
paymentIdstring | null (uuid)ні
templateIdstring | null (uuid)ні
titlestring | nullні
overridesobjectні
overrides.poaobjectні
overrides.poa.valid_untilstringні
overrides.poa.representative_namestringні
overrides.poa.representative_tax_idstring | nullні
overrides.poa.representative_passportstring | nullні
overrides.poa.representative_addressstring | nullні
overrides.poa.broker_namestring | nullні
overrides.poa.customs_poststring | nullні
overrides.handoverobjectні
overrides.etaobjectні
overrides.paymentobjectні
overrides.extraobjectні
overrides.documentDatestringні

Відповіді

201

The generated draft.

application/json · Схема: DocumentGenerated

ПолеТипОбов’язк.Опис
documentIdstring (uuid)так
numberstringтакSequential document number of the tenant, e.g. VZ-D-2026-000123.
kindstringтак
statusstringтакdraft | sent | signed | void.
pdfFileIdstring | null (uuid)такId of the PDF in the platform file storage (download via Desk/Track; no public URL is returned).
docxFileIdstring | null (uuid)так
verifyUrlstring | nullтакPublic verification page (QR) of the document.
warningsstring[]так
existingbooleanтакAlways false for API calls.

400

Invalid request parameters or body (code validation_error).

application/problem+json · Схема: Problem

401

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

application/problem+json · Схема: Problem

403

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

application/problem+json · Схема: Problem

404

Deal, payment or template not found in this tenant.

application/problem+json · Схема: Problem

409

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

application/problem+json · Схема: 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 · Схема: Problem

429

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

application/problem+json · Схема: Problem

502

Document renderer or storage unavailable.

application/problem+json · Схема: Problem

На цій сторінці