Create Document Async
Create Document Async
Section titled “Create Document Async”Unlike the synchronous method, this endpoint accepts massive batches in a single call and responds immediately with a 202 Accepted status and an ingest_token. The envelope is assembled in the background by downloading files in parallel.
curl -X POST https://api.firmeasy.legal/api/v1/documents/envelopes/async \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Service Agreement",
"documents": [{
"ref_id": "main",
"source_type": "url",
"file_format": "pdf",
"role": "sign",
"source_payload": { "url": "https://files.example.com/contract.pdf" }
}],
"signers": [{
"name": "John Doe",
"email": "[email protected]",
"country_code": "+51",
"phone": "900000001"
}]
}'Async Ingestion Limits
Section titled “Async Ingestion Limits”| Limit | Value |
|---|---|
| Maximum documents per envelope | 100 |
| Maximum weight per document | ~100 MB |
| Maximum total envelope weight | 1 GB |
| Supported source (V1) | URL Only |
Optional Header (Idempotency)
Section titled “Optional Header (Idempotency)”To avoid duplicates in case of network failures, you can send an idempotency key. If you retry the same call, the server will return the same cached response (30-minute TTL).
Idempotency-KeyRequest Body
Section titled “Request Body”namedocumentsdocuments[].ref_iddocuments[].source_typedocuments[].file_formatdocuments[].roledocuments[].source_payload.urlcallback_urlcallback_secretexternal_idmetadataEnvelope configuration (optional)
Section titled “Envelope configuration (optional)”The async endpoint accepts the same configuration fields as the Sync endpoint:
folder_tokenlangsignature_deadlineis_signature_order_activeis_rejection_allowedis_original_download_alloweddisable_owner_notificationsdisable_signer_notificationssend_automatic_invitationssend_automatic_invitations_bysend_signed_document_by_whatsappreminder_every_n_daysobserversredirect_linkcreated_bysender_namereply_to_emailIngestion Response
Section titled “Ingestion Response”If the request is valid, the system immediately responds with an ingestion token. The estimated time is calculated as min(1800, 10 + n·5) seconds, where n is the number of documents.
{ "ingest_token": "01234567-89ab-cdef-0123-456789abcdef", "status": "ingesting", "documents_total": 2, "credits_cost": 2, "status_url": "[https://api.firmeasy.legal/api/v1/documents/envelopes/01234567-89ab-cdef-0123-456789abcdef/status](https://api.firmeasy.legal/api/v1/documents/envelopes/01234567-89ab-cdef-0123-456789abcdef/status)", "estimated_processing_time_seconds": 20}ingest_tokenstatusdocuments_totalcredits_coststatus_urlestimated_processing_time_secondsBilling note: 1 credit per document is charged only upon successful completion of the assembly. If ingestion fails, no credits are deducted. If the organization balance is firmas_disponibles < -500, the operation is rejected with code 402.
Check Ingestion Status
Section titled “Check Ingestion Status”Allows you to verify the progress of the envelope assembly. When it reaches the ready status, the system will return the definitive document_token.
See the dedicated page for full detail: Ingestion Status.
Endpoint: GET /v1/documents/envelopes/{{ingest_token}}/status
Possible statuses: ingesting → assembling → ready (success) | failed | cancelled.
Additional error codes: 402 if the organization has insufficient balance (firmas_disponibles < -500).
Cancel Ingestion in Progress
Section titled “Cancel Ingestion in Progress”If the document is still in progress, you can send the order to abort it.
See the dedicated page for full detail: Cancel Ingestion.
Endpoint: POST /v1/documents/envelopes/{{ingest_token}}/cancel
It will respond with code 200 if cancelled successfully. If the envelope is already in a terminal state (ready, failed, or cancelled), it will return a 409 error.
Document Object (Final Response / Webhooks)
Section titled “Document Object (Final Response / Webhooks)”Once the document is processed, the system consolidates the complete envelope. This is the structure you will get when querying the document via the API (or through creation Webhooks).
{ "external_id": "ERP-123", "token": "abcdef01-2345-6789-abcd-ef0123456789", "name": "CONTRATO_LOTE_MASIVO.pdf", "folder": { "token": "uuid", "name": "Carpeta" }, "status": "pending", "lang": "es", "size": 245100, "original_file": "https://.../files/...?intent=view&signature=...", "signed_file": null, "original_download_file": "https://.../files/...?intent=download&...", "signed_download_file": null, "signatures_made": 0, "signature_deadline": "2026-12-31T23:59:59.000Z", "extra_docs_count": 2, "extra_docs": [ { "token": "anexo-token", "name": "Anexo 1 - Tarifario 2026.pdf", "original_file": "https://.../?intent=view&...", "signed_file": null, "original_download_file": "https://.../?intent=download&...", "signed_download_file": null, } ], "signers": [ { "external_id": null, "token": "signer-api-id", "status": "pending", "rejection_reason": null, "order": 1, "name": "Jane Doe", "phone": "900000001", "country_code": "+51", "document_type": "dni", "document_number": "900000003", "role": "signer", "link": "[https://app.firmeasy.legal/](https://app.firmeasy.legal/)...", "placements": [ { "document_ref": "main", "type": "signature", "page_number": 1, "relative_position_left": 36.5, "relative_position_top": 39.25, "relative_size_width": 25, "relative_size_height": 8 } ], "standard_flow": [ { "state": "pending", "flow_name": "Firma Holográfica", "flow_key": "holographic_signature" } ], "advanced_flow": [] } ], "created_through": "api", "created_at": "2026-06-23T10:00:00.000000Z", "updated_at": "2026-06-23T10:00:00.000000Z"}tokenexternal_idnamestatusoriginal_fileoriginal_download_filesigned_filesignatures_madeextra_docs_countextra_docssignerscreated_at