Purchase Invoices

Find an expense by external ID

Look up a single expense by its external_id (sent in the JSON body), the integration key that maps it to a record in a third-party system (ERP/CRM/e-commerce). Orthogonal to the supplier-provided external_invoice_number (the vendor's fiscal number). Returns the matching expense or 404 purchase_invoice_not_found if none uses that external_id within your company.

post/companies/{company}/purchase-invoices/find-by-external-id

Request

  • Base URL: https://api.factuarea.com/v1
  • URL: https://api.factuarea.com/v1/companies/{company}/purchase-invoices/find-by-external-id
  • Auth: one of:
    • HTTP bearer
    • API key in header X-API-Key

Path parameters

companystring uuid required

Public identifier (UUID v7) of the company. Get it from GET /v1/me (data.scope[].id).

Headers

Factuarea-Versionstring date
Example:2026-06-01

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.

Request body

external_idstring required

Response

Example response

{
  "data": {
    "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a07",
    "external_invoice_number": "INV-2026-001-DI",
    "external_id": "ERP-COMPRA-2026-0007",
    "internal_code": "GASTO-2026-0007",
    "supplier": {
      "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a02",
      "name": "Distribuciones Ibéricas, S.L."
    },
    "status": "paid",
    "issued_on": "2026-01-05",
    "received_on": "2026-04-18",
    "due_on": "2026-02-04",
    "subtotal": "350.00",
    "taxes_total": "73.50",
    "total_vat": "73.50",
    "total_retention": "0.00",
    "total_surcharge": "0.00",
    "total": "423.50",
    "currency": "EUR",
    "paid_amount": "423.50",
    "pending_amount": "0.00",
    "payment_status": "paid",
    "paid_recorded_at": "2026-01-10T10:00:00Z",
    "payment_method": "transferencia",
    "payment_terms_days": 30,
    "expense_account": "6280001",
    "expense_category_id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8c01",
    "deductible_percentage": 100,
    "operation_class": "corriente",
    "tax_period": "2026-Q2",
    "tags": [
      "suministros",
      "oficina"
    ],
    "custom_fields": [
      {
        "field": "centro_coste",
        "value": "CC-OFICINA"
      }
    ],
    "internal_notes": "Revisar con contabilidad antes del cierre trimestral.",
    "attachment": {
      "filename": "factura-suministros-abril-2026.pdf",
      "mime_type": "application/pdf",
      "size_bytes": 241,
      "download_url": "/v1/companies/0193f1a0-5c2e-7b41-8d06-9a1e2f3c4d5e/purchase-invoices/019e822c-555a-709d-99d7-2cfeac9fc920/file"
    },
    "lines": [
      {
        "object": "purchase_invoice_line",
        "description": "Material oficina pedido Q1",
        "unit_price": "350.0000",
        "tax_rate": 21,
        "subtotal": "350.00",
        "taxes": "73.50",
        "retention_amount": "0.00",
        "vat_deductible": true,
        "total": "423.50",
        "product": {
          "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8a09",
          "name": "Consultoría hora estándar"
        },
        "configuration": {
          "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8c05",
          "name": "Caja A4 · Entrega paletizada",
          "signature": "c73a1e5b09d426f8135ac0e7b249d68f0a3c5127e9b4d086f21a7c3e5940bd18"
        },
        "options": [
          {
            "group": {
              "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8c15",
              "name": "Entrega"
            },
            "value": {
              "id": "01931b3e-7c4a-7f2e-9a8b-3c5d6e7f8c25",
              "name": "Paletizada"
            },
            "price_adjustment": "25.0000",
            "applied": true
          }
        ],
        "price_semantics": "per_commercial_unit",
        "price_adjustment_total": "25.0000"
      }
    ],
    "metadata": {
      "erp_code": "IVA-GEN",
      "ledger_account": "477000"
    },
    "notes": "Pedido material oficina Q1.",
    "created_at": "2026-01-08T10:00:00Z",
    "updated_at": "2026-01-10T12:00:00Z"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.