Direct invoices
An API connection can issue invoices directly after its owner completes the Enable VeriFactu invoicing consent wizard in Factulit. Creating the technical connection or synchronizing orders does not enable this endpoint.
POST /api/v1/invoice issues immediately unless scheduled_issue_date is supplied. Immediate issuance atomically assigns the connection's current API-* series and number, creates the VeriFactu ALTA record, and leaves it pending for AEAT submission. Issued invoices cannot be updated with PUT.
Idempotency
Choose a stable external_id in your system:
- The first request returns HTTP
201. - The same
external_idand the same normalized payload returns the existing result with HTTP200andreplayed: true. - The same
external_idwith a different payload returns HTTP409anderror_code: idempotency_conflict.
Example
curl -X POST https://api.factulit.es/api/v1/invoice \
-H "X-API-KEY: factulit_example_key" \
-H "Content-Type: application/json" \
-H "X-Request-Id: 019ffae4-example" \
-d '{
"external_id": "invoice-2026-0001",
"invoice_type": "F1",
"description": "Online sale",
"currency": "EUR",
"recipient": {
"company": "Example SL",
"vat_number": "B00000000",
"country": "ES",
"address1": "Main Street 1",
"postcode": "28001",
"city": "Madrid"
},
"lines": [{
"description": "Product",
"quantity": 1,
"price_unit": 100,
"tax_rate": 21,
"regime": "01",
"qualification": "S1",
"type_tax": "01"
}]
}'Use GET /api/v1/invoice/{external_id} to retrieve the result. A non-EUR request must include exchange_rate and exchange_rate_date.
The documentary regime (art6_full or art7_simplified) is independent from the AEAT code. Exceptional crossings require their structured flag: qualified_simplified_art_7_2_3 for a qualified simplified F1, or no_recipient_article_6_1_d for a complete F2 without recipient identification. The general automatic simplified-invoice threshold is EUR 400. Requests for art7_simplified above EUR 400 must include a structured simplified_attestation covering the legal basis, buyer role and the exact line_id set. The article_4_2 basis retains the EUR 3,000 ceiling; aeat_authorisation must match the active audited authorisation configured in Factulit. Missing or ambiguous evidence is rejected with an actionable fiscal error.
Before consent, customer, status and order synchronization remains available; fiscal effects are deferred and direct invoice requests return 409 invoicing_not_enabled.
Scheduled invoices (1.10 extension)
Add scheduled_issue_date (YYYY-MM-DD), optional scheduled_issue_time (HH:mm, default 07:00) and send_to_customer to the creation payload. Do not combine issued_date with scheduling. The date must be after today and within 12 months in the business time zone. Pro or Premium must remain active both when scheduling and issuing; the same guards as the panel apply.
Creation returns 202, without a number or RF. The minute scheduler issues from the requested time using the latest saved data and current configuration. When operation_date is omitted, the actual issuance day is used.
Poll GET /api/v1/invoice/{external_id} for scheduled, issued, failed or cancelled, with the effective date, time and time zone. Failures include scheduled_error_code. There is no webhook. Requested email delivery occurs after AEAT acceptance. Technical failures retry only during the scheduled day; a missed day requires intervention.
Only active owners and administrators can schedule: when the API key's user is not one, POST and PUT return 403 actor_not_authorized. On the scheduled day the invoice is issued on behalf of the user who scheduled it or, if that user is no longer eligible, of an active owner or administrator.
Common scheduled_error_code values (decide on the code, not the text):
scheduled_error_code | Meaning | What to do |
|---|---|---|
technical_unavailable | Temporary failure; status stays scheduled and it retries during the same day. | Wait. |
scheduled_day_missed | The scheduled day passed without issuance. | Reschedule with PUT or issue with issue_now. |
pro_plan_required | No active Pro or Premium plan on the issuance day. | Restore the plan, then reschedule. |
payment_method_required, outstanding_debt | Billing restricted for the account. | Resolve billing in Factulit, then reschedule. |
owner_not_resolvable, actor_not_authorized | No active owner or administrator to issue on behalf of. | Fix the account users, then reschedule. |
invoicing_not_enabled | Invoicing is not enabled or AEAT readiness is incomplete. | Complete activation, then reschedule. |
fiscal_validation_failed, eu_* | Customer or fiscal data no longer pass validation (for example eu_vat_unverified). | Fix the data with PUT and reschedule. |
schedule_changed, preparation_changed, not_schedulable, recipient_not_found, issuance_blocked | The draft or its preparation changed, or another guard blocked issuance. | Review the invoice in Factulit and reschedule. |
Use PUT to update content or reschedule before issuance. Send {"scheduled_issue_date": null} to cancel and retain the draft, or {"issue_now": true} without scheduling fields to issue early. Issued invoices remain immutable (409). Failed or cancelled drafts can be rescheduled.
Replaying the original POST returns 200 and the current resource, even after PUT, cancellation or issuance; it never reactivates scheduling. A changed POST with the same external_id returns 409 idempotency_conflict.
For customer delivery, supply recipient.email on an F1 and set send_to_customer: true. Requests without a suitable recipient/email return 422. Cancellation remains available after a downgrade to Free.
Synthetic POST example (choose a future date within your allowed horizon):
{
"external_id": "scheduled-example-001",
"invoice_type": "F2",
"description": "Monthly service",
"scheduled_issue_date": "2027-01-12",
"scheduled_issue_time": "09:30",
"send_to_customer": false,
"lines": [{"description": "Service", "quantity": 1, "price_unit": 100, "tax_rate": 21}]
}