Skip to main content
POST
/
documents
Emitir una factura
curl --request POST \
  --url http://localhost:8000/documents \
  --header 'Content-Type: application/json' \
  --data '
{
  "issuer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "establishment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "emission_point_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "issue_date": "2023-12-25",
  "subtotal": 1,
  "total_tax": 1,
  "total": 1,
  "lines": [
    {
      "line_number": 2,
      "description": "<string>",
      "quantity": 1,
      "unit_price": 1,
      "subtotal": 1,
      "tax_rate_code": "<string>",
      "main_code": "<string>",
      "aux_code": "<string>",
      "discount": "0.00",
      "tax_code": "2"
    }
  ],
  "taxes": [
    {
      "tax_code": "<string>",
      "tax_rate_code": "<string>",
      "taxable_base": 1,
      "rate": 0.5,
      "tax_amount": 1
    }
  ],
  "numeric_code": "<string>",
  "total_discount": "0.00",
  "buyer_id_type": "<string>",
  "buyer_id": "<string>",
  "buyer_name": "<string>",
  "buyer_email": "<string>",
  "buyer_address": "<string>",
  "modified_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "modified_document_type": "<string>",
  "modified_document_number": "<string>",
  "modified_document_issue_date": "2023-12-25",
  "reason": "<string>",
  "idempotency_key": "<string>",
  "payments": [
    {
      "line_number": 2,
      "payment_method_code": "<string>",
      "total": 1,
      "term": 1,
      "time_unit": "<string>"
    }
  ]
}
'
{
  "document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "access_key": "<string>"
}

Headers

authorization
string | null
x-api-key
string | null
x-tenant-id
string | null

Cookies

factio_access_token
string | null

Body

application/json

Schema for creating a document (invoice, credit note, etc.).

issuer_id
string<uuid>
required
establishment_id
string<uuid>
required
emission_point_id
string<uuid>
required
document_type
enum<string>
required

Types of fiscal documents supported by the SRI.

Available options:
01,
04,
05,
06,
07
issue_date
string<date>
required
subtotal
required

Subtotal before taxes and discounts

Required range: x >= 0
total_tax
required

Total tax amount

Required range: x >= 0
total
required

Total amount (subtotal - discount + tax)

Required range: x >= 0
lines
DocumentLineCreate · object[]
required

Document line items

Minimum array length: 1
taxes
DocumentTaxCreate · object[]
required

Document tax entries

Minimum array length: 1
numeric_code
string
required

8-digit numeric code for access key generation

Required string length: 8
Pattern: ^\d{8}$
total_discount
default:0.00

Total discount amount

Required range: x >= 0
buyer_id_type
string | null

Buyer identification type (RUC, cedula, passport, etc.)

Maximum string length: 10
buyer_id
string | null

Buyer identification number

Maximum string length: 20
buyer_name
string | null

Buyer name

Maximum string length: 300
buyer_email
string | null

Buyer email address

Maximum string length: 255
buyer_address
string | null

Buyer address

Maximum string length: 500
modified_document_id
string<uuid> | null

Original document referenced by this document

modified_document_type
string | null

SRI type code of the modified document

Maximum string length: 2
modified_document_number
string | null

Formatted document number of the modified document

Maximum string length: 20
modified_document_issue_date
string<date> | null

Issue date of the modified document

reason
string | null

Reason for the document, mainly required for credit notes

Maximum string length: 500
idempotency_key
string | null

Client-provided idempotency key to prevent duplicate submissions

Maximum string length: 255
payments
DocumentPaymentCreate · object[]

SRI payment method entries

Response

Factura aceptada. Emisión en proceso.

Response returned when a document emission is accepted for async processing.

document_id
string<uuid>
required
status
enum<string>
required

Status values for document lifecycle.

Available options:
DRAFT,
VALIDATED,
NUMBER_RESERVED,
XML_GENERATED,
SIGNED,
RECEPTION_PENDING,
SUBMITTED_TO_SRI,
RECEIVED_BY_SRI,
AUTHORIZATION_PENDING,
AUTHORIZED,
REJECTED,
RECEPTION_RETRY_SCHEDULED,
AUTHORIZATION_RETRY_SCHEDULED,
RECEPTION_UNKNOWN,
AUTHORIZATION_UNKNOWN,
MANUAL_REVIEW_REQUIRED,
FAILED_PERMANENT,
CANCELLATION_REQUESTED,
CANCELLED,
VOIDED_BY_NC
access_key
string
required