Factuarea API
Invoices

Unschedule an invoice

Cancel a scheduled issuance. The invoice returns to draft, scheduled_for and scheduled_action are set back to null, and it becomes editable and deletable again as any other draft.

Unscheduling leaves no fiscal trace, because nothing fiscal had happened yet: no correlative number of the series was consumed (the invoice still carries its BORRADOR placeholder), nothing was registered with VeriFactu and no email was sent. This is not an annulment and it does not appear in any AEAT record.

Window of use. It only applies while the invoice is scheduled. A draft that was never scheduled returns 422, and so does an invoice the sweep has already issued: from that instant on it is sent, it owns a definitive number and — where VeriFactu applies — an AEAT record, so the way back is no longer unschedule but void/annul to withdraw it (only while it is unpaid) or corrective to amend it. In practice the race is real: an invoice whose scheduled_for has just elapsed may already have been issued when your call lands.

If you only want to move the date, use PATCH /v1/invoices/{id}/reschedule instead — it avoids the round trip through draft and the window in which the document is editable.

POST
/invoices/{invoice}/unschedule
AuthorizationBearer <token>

In: header

Path Parameters

invoice*string

Header Parameters

Factuarea-Version?string

Pin the API version (YYYY-MM-DD, Stripe-style date versioning) for this request; omit to use the key's pinned version, or the latest if none. Unsupported version → 400 unsupported_api_version; malformed → 400 parameter_invalid_format. The effective version is echoed in the Factuarea-Version response header. See the Versioning guide.

Formatdate
X-Active-Profile?string

Operate on behalf of a child company (gestoría master key): pass its public id (UUID v7) and the request runs against that child's data without changing the key's scope, tier or environment (omit to use the key's own company). Invalid UUID → 400 parameter_invalid_uuid; unknown or non-owned id → 404 profile_not_found. See the Acting on behalf guide.

Formatuuid

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

import { Factuarea } from "@factuarea/sdk";const factuarea = new Factuarea({ apiKey: process.env.FACTUAREA_API_KEY! });const result = await factuarea.invoices.unschedule("01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a01");
{
  "data": {
    "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a42",
    "object": "invoice",
    "number": "FAC-2026-00042",
    "is_number_assigned": true,
    "type": "F1",
    "series": {
      "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8b02",
      "code": "FAC-2026"
    },
    "client": {
      "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a01",
      "name": "Acme Soluciones SL"
    },
    "status": "paid",
    "issued_on": "2026-03-15",
    "due_on": "2026-04-14",
    "subtotal": 1000,
    "taxes_total": 210,
    "total": 1210,
    "total_disbursements": 0,
    "total_to_pay": 1210,
    "currency": "EUR",
    "notes": "Servicios profesionales marzo 2026.",
    "external_id": "ERP-2026-0042",
    "lines": [
      {
        "object": "invoice_line",
        "description": "Consultoría técnica (10 h)",
        "product": {
          "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8b03",
          "name": "Consultoría técnica (hora)"
        },
        "quantity": 10,
        "unit_price": 100,
        "tax_rate": 21,
        "retention_rate": 0,
        "surcharge_rate": 0,
        "discount_percent": 0,
        "subtotal": 1000,
        "taxes": 210,
        "total": 1210,
        "indirect_tax_regime": "iva",
        "aeat_tax_code": "S1",
        "line_type": "NORMAL"
      }
    ],
    "metadata": {
      "order_id": "PO-2026-0042"
    },
    "tags": [
      "consultoria",
      "cliente-vip"
    ],
    "custom_fields": [
      {
        "field": "centro_coste",
        "value": "CC-2026-001"
      },
      {
        "field": "numero_pedido",
        "value": "PO-2026-0042"
      }
    ],
    "operation_regime": "general",
    "exemption_reason": null,
    "legal_mentions": [],
    "exclude_347": false,
    "verifactu_status": "accepted",
    "paid_amount": 1210,
    "pending_amount": 0,
    "payments": {
      "detail": [
        {
          "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a90",
          "object": "payment",
          "invoice_id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a42",
          "amount": 1210,
          "payment_date": "2026-03-20",
          "payment_method": "bank_transfer",
          "payment_method_text": "Transferencia bancaria",
          "reference": "TRF-2026-0042",
          "notes": null,
          "created_at": "2026-03-20T10:30:00Z",
          "updated_at": "2026-03-20T10:30:00Z"
        }
      ],
      "total": 1210,
      "pending": 0
    },
    "is_corrective": false,
    "corrective": null,
    "payment": {
      "method": "bank_transfer",
      "reference": "TRF-2026-0042",
      "date": "2026-03-20"
    },
    "public_link": {
      "object": "public_link",
      "url": "https://app.factuarea.com/d/01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a42",
      "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a42",
      "enabled": true,
      "expires_at": "2026-09-15T23:59:59Z",
      "max_days": 120
    },
    "substituted_by": null,
    "recurring": null,
    "paid_at": "2026-03-20T10:30:00Z",
    "paid_on": "2026-03-20",
    "sent_at": "2026-03-15T11:45:00Z",
    "voided_at": null,
    "void_reason": null,
    "scheduled_for": null,
    "scheduled_action": null,
    "created_at": "2026-03-15T11:30:00Z",
    "updated_at": "2026-03-20T10:30:00Z"
  }
}

{
  "error": {
    "type": "authentication_error",
    "code": "missing_api_key",
    "message": "No se ha proporcionado una API key válida en el header Authorization.",
    "param": null,
    "doc_url": "https://docs.factuarea.com/guides/errors#missing_api_key",
    "request_id": "req_01HKQS5N8VR7QXJ9K3T6BWPMZA"
  }
}

{
  "error": {
    "type": "authorization_error",
    "code": "insufficient_scope",
    "message": "Esta API key no tiene el scope requerido para esta operación.",
    "param": null,
    "doc_url": "https://docs.factuarea.com/guides/errors#insufficient_scope",
    "request_id": "req_01HKQS5NBC3P8M1KX4V7SLNHQD"
  }
}

{
  "error": {
    "type": "not_found_error",
    "code": "resource_not_found",
    "message": "El recurso solicitado no existe o pertenece a otra empresa.",
    "param": null,
    "doc_url": "https://docs.factuarea.com/guides/errors#resource_not_found",
    "request_id": "req_01HKQS5NEQ6X1R4N9B0C5DWTPG"
  }
}

{
  "error": {
    "type": "idempotency_error",
    "code": "idempotency_key_reused",
    "message": "La cabecera `Idempotency-Key` ya se usó con un body distinto. Usa una clave nueva o reenvía exactamente el mismo body.",
    "param": null,
    "doc_url": "https://docs.factuarea.com/guides/errors#idempotency_key_reused",
    "request_id": "req_01HKQS5NHT9A4U7R2E3F8GZWTJ"
  }
}

{
  "error": {
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded",
    "message": "Has excedido el rate limit de 60 peticiones por minuto. Reintenta tras 30 segundos.",
    "param": null,
    "doc_url": "https://docs.factuarea.com/guides/errors#rate_limit_exceeded",
    "request_id": "req_01HKQS5NKW1C6W9T4G5H0JBZVL"
  }
}

{
  "error": {
    "type": "api_error",
    "code": "internal_error",
    "message": "Ha ocurrido un error inesperado. Si persiste, contacta con soporte adjuntando el request_id.",
    "param": null,
    "doc_url": "https://docs.factuarea.com/guides/errors#internal_error",
    "request_id": "req_01HKQS5NLX2D7X0U5H6J1KCAWM"
  }
}