API · v1 · estable
CODEMETA OSDeveloper Center
ES
Abrir la consola
Entidad · invoices

Invoice Schema

ID del esquema
invoice
Colección
invoices
Permisos
  • Leerinvoice_view
  • Crearinvoice_create
  • Modificarinvoice_edit
  • Eliminarinvoice_delete
Relaciones

Campos

Invoice Schema

invoices4 permisos

Schema for validating Rechnung (invoice) entities

documentLanguagestringopcional

Language the document (PDF) is rendered in. Decided when the document is created (explicit → customer language → tenant default → de) and never re-derived. Missing = de.

deenesfrnlnull
admite null
partyIduuidobligatorio

Customer party UUID

invoiceNumberstringopcional

Auto-generated sequence number (e.g. RE-2026-00001)

máx. 1000 caracteressolo lecturaadmite null
invoiceDatedateopcional

Invoice date

admite null
dueDatedateopcional

Payment due date

admite null
statusstringobligatorio

Invoice lifecycle status. POSTED = verbucht / revisionssicher festgeschrieben (lockedAt set). SENT = an Kunden versandt. Beide sind immutable.

DRAFTPOSTEDSENTPAIDPARTIALLY_PAIDOVERDUECANCELLEDCREDITED
Valor por defecto: "DRAFT"
salesInvoiceTypestringopcional

Type of sales invoice (mirrors weclapp salesInvoiceOrigin). ADVANCE_PAYMENT=Anzahlung, PART_PAYMENT=Teilrechnung, FINAL=Schlussrechnung, RECURRING=wiederkehrend

STANDARDADVANCE_PAYMENTPART_PAYMENTPREPAYMENTFINALRECURRINGRETAIL
Valor por defecto: "STANDARD"
bookingDatedateopcional

Buchungsdatum für DATEV (may differ from invoiceDate). Set on POSTED, drives the booking period.

admite null
lockedAtdatetimeopcional

When the invoice was locked (POSTED). After this the invoice is immutable except for status changes (PAID/OVERDUE/CANCELLED) and dunning fields.

solo lecturaadmite null
lockedByuuidopcional

User UUID who posted (locked) the invoice

solo lecturaadmite null
contentHashstringopcional

SHA-256 hash of canonical invoice content at lock time (GoBD revisionssicher). Verified on every read after POSTED.

máx. 128 caracteressolo lecturaadmite null
recordAddressSnapshotobjectopcional

Frozen invoice (recipient) address snapshot taken at POSTED. GoBD requires the address as printed on the original document.

solo lecturaadmite null
namestringopcional
máx. 300 caracteresadmite null
addressLine1stringopcional
máx. 300 caracteresadmite null
addressLine2stringopcional
máx. 300 caracteresadmite null
postalCodestringopcional
máx. 20 caracteresadmite null
citystringopcional
máx. 200 caracteresadmite null
statestringopcional
máx. 200 caracteresadmite null
countryCodestringopcional
máx. 2 caracteresadmite null
vatRegistrationNumberstringopcional
máx. 50 caracteresadmite null
deliveryAddressSnapshotobjectopcional

Frozen delivery address snapshot (if different from invoice address)

solo lecturaadmite null
namestringopcional
máx. 300 caracteresadmite null
addressLine1stringopcional
máx. 300 caracteresadmite null
addressLine2stringopcional
máx. 300 caracteresadmite null
postalCodestringopcional
máx. 20 caracteresadmite null
citystringopcional
máx. 200 caracteresadmite null
statestringopcional
máx. 200 caracteresadmite null
countryCodestringopcional
máx. 2 caracteresadmite null
exchangeRatestringopcional

Exchange rate to EUR at invoice date. Only set when currency != EUR. Used for DATEV export.

Patrónadmite null
sourcestringopcional

How the invoice was created

MANUALPERFORMANCE_RECORDSALES_ORDERCONTRACTWECLAPPCREDIT_NOTEWHOLESALE_LICENSING
Valor por defecto: "MANUAL"
customerTenantIdstringopcional

Customer tenant this invoice was generated for (only set when source=WHOLESALE_LICENSING).

PatrónValor por defecto: nulladmite null
invoiceTypestringopcional
INVOICECREDIT_NOTE
Valor por defecto: "INVOICE"
creditedInvoiceIdstringopcional

Original invoice ID (for credit notes)

PatrónValor por defecto: nulladmite null
contractIdstringopcional

Source contract (if generated from recurring billing)

PatrónValor por defecto: nulladmite null
dunningLevelintegeropcional
0 – 3Valor por defecto: 0
lastDunningAtdatetimeopcional
Valor por defecto: nulladmite null
dunningBlockedUntildateopcional

Dunning suspended until this date

Valor por defecto: nulladmite null
projectIduuidopcional

Project this invoice bills (propagated from a per-project performance record). Null/absent for collective, per-ticket and legacy invoices.

solo lecturaadmite null
performanceRecordIduuidopcional

Source performance record UUID (if generated from Leistungsnachweis)

admite null
billingAddressIdstringopcional

Separately billed customer site (party.addresses[]._id) this invoice is addressed to — copied from the performance record. Null/absent = the customer default address.

admite null
deliveryAddressIdstringopcional

Delivery address (party.addresses[]._id) printed on this invoice — copied from the contract. Null/absent = the customer DELIVERY address, if any.

admite null
titlestringopcional

Invoice title / subject

máx. 200 caracteresadmite null
introTextstringopcional

Introductory text above positions

máx. 2000 caracteresadmite null
closingTextstringopcional

Closing text below positions

máx. 2000 caracteresadmite null
notesstringopcional

Internal notes (not printed)

máx. 2000 caracteresadmite null
openTicketNotesobject[]opcional

ADR 0146 — Snapshot copied from the source Leistungsnachweis: tickets that were still open at billing time but were unlocked via `ticket.billingOverride`. The invoice PDF renders a neutral "Hinweise"-section listing the affected ticket numbers; the internal reason is intentionally NOT propagated here.

Valor por defecto: []admite null
ticketIduuidobligatorio
ticketNumberstringobligatorio
máx. 50 caracteres
titlestringopcional
máx. 500 caracteresadmite null
releaseSourcestringopcional

ADR 1209 — internal: what released the open ticket (per-ticket override, customer rule, tenant rule). Missing on snapshots before ADR 1209 = TICKET.

TICKETCUSTOMERTENANTnull
admite null
itemsobject[]opcional

Invoice line items

Valor por defecto: []
positionintegeropcional
≥ 1
descriptionstringobligatorio
máx. 500 caracteres
unitstringopcional
máx. 20 caracteresadmite null
quantitynumberobligatorio
≥ 0
unitPricestringobligatorio

Decimal string, e.g. "125.00"

vatRatestringopcional

VAT rate as percent string

Valor por defecto: "19"
netAmountstringopcional

Computed: quantity * unitPrice

admite null
articleIdstringopcional

Article reference (local UUID or weclapp article id)

máx. 64 caracteresadmite null
articleNumberstringopcional

Article SKU / weclapp articleNumber

admite null
itemTypestringopcional

Categorizes the line item origin

SERVICETRAVEL_DISTANCETRAVEL_TIMETRAVEL_OTHERFLAT_RATEEXPENSETICKETMATERIAL
admite null
materialBucketIduuidopcional

Source material bucket UUID (if generated from Materialkorb)

admite null
materialBucketItemIdstringopcional

Source line of the material bucket (`items[].id`) — lets the price weclapp sets reach the asset of that serial-number line

máx. 64 caracteresadmite null
expenseIduuidopcional

Source expense UUID (EXPENSE lines of a per-project billing run)

admite null
positionIduuidopcional

Source project_position UUID (FLAT_RATE lines of a per-project billing run)

admite null
contractIdstringopcional
Valor por defecto: nulladmite null
contractItemIdstringopcional

Which contract position generated this invoice line

Valor por defecto: nulladmite null
timeRecordIdstringopcional

Source time_record UUID — set when this line was generated from a single booking (perEntry, ungrouped perTicket, or travel linked via trip.timeRecordId).

PatrónValor por defecto: nulladmite null
timeRecordNumberstringopcional

Human-readable record number (e.g. TR-2026-00042) of the source time record. Snapshotted at build time so the UI can deep-link without an extra fetch.

máx. 50 caracteresValor por defecto: nulladmite null
ticketIdstringopcional

Source ticket UUID — set when this line aggregates time records of one ticket (perTicket) or originates from a TR with referenceType=TICKET.

PatrónValor por defecto: nulladmite null
accountCodestringopcional

DATEV revenue account (Erlöskonto, e.g. "8400"). Falls back to article.revenueAccountCode at posting time.

máx. 20 caracteresValor por defecto: nulladmite null
costCenterIdstringopcional

Cost center UUID (Kostenstelle) for DATEV

PatrónValor por defecto: nulladmite null
pricedAtstringopcional

ADR 0415 — date (YYYY-MM-DD) at which the base rate of this line was resolved (copied 1:1 from the performance-record snapshot). Service date by default; billing-run date for pricingDateBasis=BILLING_DATE.

Valor por defecto: nulladmite null
rateSourcestringopcional

ADR 0415 — provenance of the applied hourly rate (copied 1:1 from the performance-record snapshot). `position` = price of the sold order line (ADR 1056). `record` = rate frozen at booking time with unknown origin (legacy).

positioncontractparty_overrideparty_discountarticleservice_typerecordnull
Valor por defecto: nulladmite null
nonBillableServicebooleanopcional

ADR 0873 §7 — travel line of a non-billable booking (copied 1:1 from the performance-record snapshot). Only set on travel lines.

priceFromErpbooleanopcional

Material line from a material bucket whose price weclapp sets: pushed without unitPrice and with manualUnitPrice=false, the price weclapp returns replaces the local 0.00 placeholder and the flag is removed. Absent on every other line.

groupLabelstringopcional

ADR 0909 — heading of the position group (copied 1:1 from the performance-record snapshot; material lines of a grouped invoice get the rendered material group). Missing = ungrouped. Pushed to weclapp as salesInvoiceItem.groupName.

máx. 1000 caracteresadmite null
costTypeIdstringopcional

Cost type UUID (Kostenträger) for DATEV

PatrónValor por defecto: nulladmite null
taxKeystringopcional

DATEV Steuerschlüssel (e.g. "9" for 19% USt., "8" for 7%)

máx. 10 caracteresValor por defecto: nulladmite null
netAmountstringopcional

Net total (excl. VAT) as decimal string

Patrónadmite null
vatAmountstringopcional

VAT total as decimal string

Patrónadmite null
grossAmountstringopcional

Gross total (incl. VAT) as decimal string

Patrónadmite null
vatRatestringopcional

Default VAT rate for this invoice

Valor por defecto: "19"
currencystringopcional
máx. 3 caracteresValor por defecto: "EUR"
paymentTermsDaysintegeropcional

Payment terms in days (e.g. 14, 30)

≥ 0admite null
pdfFileIduuidopcional

Reference to stored PDF file in files collection

admite null
weclappIdstringopcional

External weclapp sales invoice ID (if synced from weclapp)

solo lecturaadmite null
weclappBaseUrlstringopcional

Base URL of the weclapp tenant (e.g. https://demo.weclapp.com) for deep-linking

solo lecturaadmite null
externalVersionstringopcional

External system version (e.g. weclapp `version` field). Used to detect changes without re-downloading the PDF.

solo lecturaadmite null
syncedAtdatetimeopcional

Timestamp of the last successful sync from the external system

solo lecturaadmite null
customerPaymentReportedAtdatetimeopcional

Set when the customer pressed "Bezahlt gemeldet" in the portal. Does NOT change `status` — the MSP confirms separately. UI surfaces this as a yellow "Zahlung gemeldet" pill until the MSP transitions to PAID.

solo lecturaadmite null
customerPaymentReportedByuuidopcional

Customer portal user who reported the payment

solo lecturaadmite null
customerPaymentReferencestringopcional

Optional reference text from the customer (e.g. SEPA reference, IBAN-Last4)

máx. 200 caracteressolo lecturaadmite null
groupingModestringopcional

Grouping mode used when generating line items from performance record

onePositionperTicketperEntry
admite null
groupPositionsByTicketbooleanopcional

ADR 0909 — copied from the performance record: items carry groupLabel headings (grouped by ticket). Missing = ungrouped.

admite null
servicePeriodFromdateopcional

Service period start (from performance record)

admite null
servicePeriodTodateopcional

Service period end (from performance record)

admite null
salesOrderIdstringopcional

Source sales order UUID (if generated from order)

PatrónValor por defecto: nulladmite null
proposalIdstringopcional

Legacy: source proposal UUID. ADR 1237: proposal entity removed; field kept for existing documents.

PatrónValor por defecto: nulladmite null

Endpoints estándar

Este recurso sigue el contrato CRUD genérico de la plataforma. Lea las convenciones sobre paginación, idempotencia, bloqueo optimista y auditoría. Los endpoints principales:

  • GET /api/v1/invoices — Lista, paginada y filtrable
  • GET /api/v1/invoices/<id> — Una entidad
  • POST /api/v1/invoices — Crear
  • PATCH /api/v1/invoices/<id> — Actualización parcial
  • DELETE /api/v1/invoices/<id> — Eliminación lógica
  • GET /api/v1/invoices/<id>/timeline — Auditoría y actividades

Búsqueda