# Relvo documentation (full text) > Every page of https://app.relvoerp.com/docs/product/ in one file, in the reading order of https://app.relvoerp.com/llms.txt. All pages are in English. Each product page also has a Spanish copy with the same content (`/es/` instead of `/en/`), listed in llms.txt and not repeated here. --- # What is Relvo? > The revenue operations layer for B2B companies with complex pricing. Source: https://app.relvoerp.com/docs/product/en/overview/ Relvo turns contracts and commercial terms into charge calculations, approvals, invoicing, collections and reconciliation. It is built for B2B teams that combine fixed and variable pricing, negotiate contracts deal by deal, or need a purchase order before they can invoice. **From contract to cash:** A contract and usage feed the calculation engine. The result goes through a pre-invoice, an optional commercial reference such as a PO (OC) or service acceptance (HES), an invoice, collections and reconciliation. ## The problem it solves When pricing is not a flat rate, invoicing stops being paperwork and becomes a calculation: you have to gather the period's usage, apply each charge's pricing model, honor minimums and discounts, convert currencies at the right date, and only then issue. That calculation usually ends up in a spreadsheet that nobody can reproduce two months later. Relvo is the system of record for that calculation. Every amount stays linked to the data and the rules that produced it, and it can be run again to get the same result. | Without Relvo | With Relvo | |---|---| | The amount lives in a spreadsheet | The amount is derived from the contract and the usage | | Correcting means editing a cell | Before issuance, correcting means recalculating; after issuance, a correction document | | "Has this been invoiced yet?" is answered by checking email | Every charge calculation has its own status, separate from the invoice's | | Invoiced and collected get mixed up | They are two distinct figures, with distinct dates | ## The four questions Relvo answers | Question | Where the answer lives | |---|---| | What did we agree to charge? | The **contract**: its phases, charges and terms | | How much should we charge this period? | The **charge calculation**: the period's computation, still editable | | What document did we issue? | The **invoice** and its credit or debit notes | | How much actually came in? | The **payments** and their **reconciliation** against the bank | > **Key rule: Each question has its own status** > > Relvo keeps those four axes separate on purpose: that is what lets you say "we invoiced 18,930 and collected 15,200" without ambiguity. ## What's included - **Contracts** with phases, amendments and renewals, and fixed, usage, seat-based or one-time charges. - **Pricing** with standard, tiered, volume, package and percentage models, plus free units, minimums and caps. - **Usage ingestion** via API, bulk upload or manual entry, with immutable events and explicit corrections. - **Chilean electronic invoicing** with the SII (Chile's tax authority), including export documents and credit and debit notes. - **Collections**: sending, reminders, payment recording and reconciliation against bank statements. - **Reporting** on contracts, invoicing, collections and usage, with MRR and ARR calculated from active contracts. ## Where to go next - [Core concepts](https://app.relvoerp.com/docs/product/en/core-concepts.md): The minimum vocabulary: contract, charge, charge calculation, invoice, payment. Read this first. - [How Relvo works](https://app.relvoerp.com/docs/product/en/how-relvo-works.md): The full journey of a single peso, from contract signature to reconciliation. - [From contract to payment](https://app.relvoerp.com/docs/product/en/contract-to-payment.md): The same journey, step by step and with screenshots, on a sample contract. - [Onboarding](https://app.relvoerp.com/docs/product/en/onboarding.md): What to configure, and in what order, to get your organization up and running. --- # How Relvo works > The complete mental model before you configure a contract. Source: https://app.relvoerp.com/docs/product/en/how-relvo-works/ A contract defines what a customer buys, how much they must pay and under what conditions they can be invoiced. Relvo evaluates those conditions every period, brings in usage where applicable, and computes the charge calculation before issuing a document. **How the concepts connect:** A customer can have several contracts. Each contract contains phases and charges. Usage feeds a charge calculation, which can become a pre-invoice and an invoice. ## The five questions Each stage of the journey answers a different operational question: | Stage | Question it answers | | --- | --- | | Catalog | What do we sell? | | Contract | What did we agree with this customer, and until when? | | Usage | How much did they actually use? | | Calculation | How much should we charge them this period? | | Document | What did we issue them, and what did they pay us? | ## What Relvo guarantees **The calculation is reproducible.** The same contract, the same usage and the same period always produce the same amount. There is no rounding that depends on arrival order, and no values that change because someone reopened the screen. **Correcting is cheap before issuance and explicit after it.** Until the charge calculation becomes a document, it is recalculated without leaving an awkward trail. Once issued, correcting means issuing a second document: nothing is edited or deleted retroactively. **Statuses are never made up.** Whatever can be derived from the data—whether an invoice is overdue, what its balance is—is derived. Whatever is a fact—that the SII (Chile's tax authority) accepted it, that the customer received it—is stored. > **Caution: Relvo doesn't guess** > > If a period's usage is missing, if the day's exchange rate is unavailable, or if the contract requires a purchase order (OC, *orden de compra*) that hasn't arrived, Relvo **stops** issuance and surfaces it. It prefers a blocked, visible charge calculation over an invoice issued with a made-up number, because an over-invoiced document costs a credit note, a conversation with the customer and an explanation to the auditor. ## Where to start - [Core concepts](https://app.relvoerp.com/docs/product/en/core-concepts.md): The twelve concepts and how they connect. - [Onboarding](https://app.relvoerp.com/docs/product/en/onboarding.md): From an empty account to your first invoice. - [From contract to payment](https://app.relvoerp.com/docs/product/en/contract-to-payment.md): A complete walkthrough with real numbers. - [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): The six models and their formulas. --- # Core concepts > The product vocabulary used in Relvo, and how the pieces connect. Source: https://app.relvoerp.com/docs/product/en/core-concepts/ Relvo has twelve concepts. Almost everything you see in the application is a combination of them, and almost every billing problem comes down to confusing two of them. > **Shortcut: The three distinctions that matter most** > > - **Charge ≠ charge calculation.** A charge is a contract rule; a charge calculation is the result of applying it to a specific period. > - **Charge calculation ≠ invoice.** A charge calculation can be recalculated freely; an issued invoice is never touched again. > - **Invoiced ≠ collected.** Issuing a document is not receiving money. They are two distinct axes of the same balance. 1. [Customers](https://app.relvoerp.com/docs/product/en/customers-catalog.md#clientes): The companies you sell to and invoice. Each customer can have its own contracts and commercial terms. 2. [Contracts](https://app.relvoerp.com/docs/product/en/contracts.md): The commercial agreement with a customer: what it buys, how it is charged, when it applies and which conditions must be met before invoicing. 3. [Items](https://app.relvoerp.com/docs/product/en/customers-catalog.md#items): The products or services you sell. Items are the base on which each contract’s charges are defined. 4. [Charges](https://app.relvoerp.com/docs/product/en/pricing.md): Each billable line of a contract: fixed recurring, usage-based, per seat or one-time. The pricing model lives on the charge. 5. [Billable metrics](https://app.relvoerp.com/docs/product/en/usage-billing.md#billable-metrics): Define how a customer’s consumption is measured to compute variable charges, for example conversations, active users or transactions. 6. [Usage](https://app.relvoerp.com/docs/product/en/usage-billing.md#usage-events): Records your customers’ real activity. Relvo uses these events to feed the billable metrics and compute variable charges. 7. [Charge calculations](https://app.relvoerp.com/docs/product/en/invoicing-collections.md#charge-calculation): How much a customer owes for a period, after applying the terms of its contract and its consumption. 8. [Pre-invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md#pre-invoice): Share and validate the detail of a charge calculation before the final invoice is issued, including processes that require a PO (OC) or service acceptance (HES). 9. [Invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md#invoice): The documents issued from approved charge calculations. Relvo keeps their status, due date, balance and relation to other documents. 10. [Credit and debit notes](https://app.relvoerp.com/docs/product/en/credit-debit-notes.md): An issued invoice is never edited: it is corrected by issuing a document that references it and moves the net balance down or up. 11. [Approvals and collections](https://app.relvoerp.com/docs/product/en/approvals-commercial-references.md): Relvo runs the conversations that move invoicing forward: requesting approvals, receiving OC/HES and following up on collections. 12. [Reconciliation](https://app.relvoerp.com/docs/product/en/payments-reconciliation.md#conciliacion): Matches received payments with the corresponding invoices to update their balances automatically and close the cycle. --- # From contract to payment > A complete, step-by-step walkthrough of Acme AI's monthly contract. Source: https://app.relvoerp.com/docs/product/en/contract-to-payment/ This page follows **one full month** of a real contract from start to finish. If you read only one page before setting up your organization, make it this one. Acme AI has a contract in force throughout 2026, in USD, billed monthly in arrears, with 30-day payment terms and a purchase order (OC, *orden de compra*) requirement. **January walkthrough:** 8,420 conversations → Billable metric → Tiered price → Pre-invoice → OC → Invoice → Payment ## 1 · The contract defines what is charged Acme's contract has two charges: | Charge | Type | Price | Timing | | --- | --- | --- | --- | | Platform | Fixed | USD 1,000 / month | In advance | | AI conversations | Usage | Tiered: 1,000 included · then 0.10 · above 5,000, 0.07 | In arrears | Neither price lives in the catalog: they live in **this** contract. The same service can cost another customer something different without touching anything here. ## 2 · Usage comes in during the month Each conversation arrives as a **usage event** with its time of occurrence and its unique identifier. Events are immutable: if one arrived wrong, it is corrected with a correction event, never by editing the original. If the same event arrives twice, it is not billed twice. That is why every submission carries its own identifier. ## 3 · The metric turns events into a quantity The contract does not bill "events": it bills the quantity produced by the **billable metric**. For Acme, the metric counts conversations in the period. In January: **8,420**. > **Key rule: Metric and price are separate decisions** > > The metric answers *how much was used*; the pricing model answers *how much that costs*. Changing the price of conversations does not change how many there were, and that measured usage remains queryable even if the price changes later. ## 4 · The period closes and the charge calculation runs When January closes, Relvo calculates the period's charge calculation: it applies the price to the quantity, adds the fixed charge and totals it. **Example: January charge calculation** | Item | Calculation | Amount | | --- | ---: | ---: | | First 1,000 conversations | included | USD 0.00 | | Next 4,000 | 4,000 × USD 0.10 | USD 400.00 | | Remaining 3,420 | 3,420 × USD 0.07 | USD 239.40 | | Platform subscription | monthly | USD 1,000.00 | | **Total** | | **USD 1,639.40** | A charge calculation is **not** an invoice: it has no tax effect and can be recalculated. If late January usage arrives before issuance, the charge calculation is recalculated and reflects the correct total. This is the cheap moment to correct. ## 5 · The pre-invoice seeks approval Acme requires a purchase order, so the charge calculation is shared as a **pre-invoice**: the same detail, with no tax validity, so the customer can validate it and issue its OC. Until the OC arrives, issuance stays blocked. This is not a failure: it is the contract's invoicing condition doing its job. Once the evidence is recorded, the block lifts. ## 6 · The invoice is issued With the approval in hand, the charge calculation becomes an invoice and is sent to the tax authority. From that moment the document **can no longer be edited**. Its status stops being a single value and becomes four, independent of one another: | Axis | At issuance | Shortly after | | --- | --- | --- | | Lifecycle | `open` | `open` | | Fiscal status | `pending` | `accepted` | | Delivery | `send_requested` | `delivered` | | Payment | `unpaid` | `unpaid` | With 30-day terms, the due date is set by the customer's billing link. ## 7 · The document reaches the customer Relvo sends the invoice to the contact with the billing role, and the XML to the XML email contact if the customer asks for it separately. *Sent* and *delivered* are two different things: the delivery axis records both, which is what lets you answer with evidence when a customer says they never received it. If the email bounces permanently, the address is suppressed and stops receiving: continuing to send to a dead mailbox degrades the domain's reputation for every other customer. ## 8 · Payment arrives and is reconciled Acme pays USD 1,000 on the 20th and the balance the following week. | Moment | Payment axis | Balance | | --- | --- | --- | | After the first payment | `partially_paid` | USD 639.40 | | After the second | `paid` | USD 0.00 | The bank movement is reconciled against the invoice. Relvo proposes the match; confirmation is human when there is ambiguity, because applying a payment to the wrong document costs more than reviewing it. > **Shortcut: “Overdue” was never a status anyone wrote** > > If Acme had not paid, the invoice would appear as overdue without anything marking it: it is derived from the due date and the balance. That is why, the instant the payment comes in, it stops being overdue — without anyone having to remember to update a column. ## What was recorded At the end of the walkthrough, every unit of currency charged has full traceability: which events originated it, which metric counted them, which price tier applied, which approval authorized it, which tax document formalized it and which bank movement settled it. - [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): The six pricing models and how each one calculates. - [Usage and billable metrics](https://app.relvoerp.com/docs/product/en/usage-billing.md): How usage comes in and how it becomes a billable quantity. - [Charge calculations, pre-invoices and invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md): The four status axes of an invoice, in detail. - [Onboarding](https://app.relvoerp.com/docs/product/en/onboarding.md): What to configure, and in what order, to reach this walkthrough. --- # Commercial models > The billing models Relvo runs today and how each one is put together. Source: https://app.relvoerp.com/docs/product/en/use-cases/ Almost every B2B billing model is built from the same four pieces: **fixed charges**, **usage charges**, **one-time charges** and **phases**. This page shows how they combine for the most common models, so you can recognize yours before configuring anything. ## Summary | Model | Pricing example | How it is built in Relvo | | --- | --- | --- | | **Fixed subscription** | USD 1,000 / month | One `standard` fixed charge | | **Base + seats** | USD 500 / month + USD 20 × active user | One fixed charge + one seat-based charge | | **Base + usage** | USD 1,000 / month + USD 0.05 × transaction | One fixed charge + one `standard` usage charge | | **Tiered usage** | 1,000 included · then 0.10 · above 5,000, 0.07 | One `graduated` usage charge | | **Volume discount** | If you exceed 5,000, *everything* at 0.07 | One `volume` usage charge | | **Package-based** | USD 50 per 1,000 calls | One `package` usage charge | | **GMV commission** | 1.5% of transacted value | One `percentage` usage charge | | **Fixed retainer** | USD 3,000 / month | One `standard` fixed charge | | **Retainer + variable** | USD 3,000 / month + USD 100 × meeting | Fixed charge + usage charge | | **One-time charge** | Implementation USD 5,000 | One one-time charge, non-recurring | | **Phased contract** | Month 1 implementation → then operation | Two phases with different charges | | **Enterprise with OC/HES** | Pre-invoice → OC → invoice | Invoicing condition on the contract | | **Guaranteed minimum** | USD 2,000 / month minimum against usage | Minimum commitment over the usage charges | ## Subscription, with or without usage The base case: one fixed charge per period. It is billed while the phase is in effect, whether or not there is usage. Adding usage does not change the contract; it adds a charge. Both are evaluated in the same period and go out on **a single invoice**, even if one is billed in advance and the other in arrears. **Example: Base + usage, one period** | Line | Timing | Amount | | --- | --- | --- | | Platform | In advance | USD 1,000.00 | | 8,420 conversations, tiered | In arrears | USD 639.40 | | **Total** | | **USD 1,639.40** | ## When the price depends on how much is consumed Three distinct models that are often confused: - **Tiered (`graduated`)** — each tier charges only its own units. This is the "first 1,000 free" model. - **Volume (`volume`)** — the total quantity selects *one* tier and that price applies to everything. This is the "reach 5,000 and everything gets cheaper" model. - **Package (`package`)** — billed in whole blocks, even if you don't use them fully. The same quantity yields very different amounts depending on which one you choose. See [Pricing models](https://app.relvoerp.com/docs/product/en/pricing.md#pricing-models) for the calculation of each. ## When the contract changes over time A contract with implementation in the first month and operation from the second is **not** two contracts: it is two phases of the same one. Each phase has its own charges, and the timeline leaves no gaps or overlaps. The same applies to a mid-year price increase or a plan change: you add a phase, you don't edit the past. What has already been invoiced keeps reflecting what was in effect when it was invoiced. See [Phases](https://app.relvoerp.com/docs/product/en/contracts.md#phases). > **Key rule: Never edit the price of a period that has already been invoiced** > > Changing a price retroactively would rewrite documents that have already been issued. If a period was invoiced incorrectly, it is corrected with a credit or debit note, not by editing the contract. See [Credit and debit notes](https://app.relvoerp.com/docs/product/en/credit-debit-notes.md). ## When there is a floor or a ceiling - **Guaranteed minimum** — the customer pays at least X per period, regardless of usage. If usage falls below the minimum, the difference is billed. - **Cap** — usage is billed up to a maximum; anything beyond it is not invoiced. - **Discounts** — percentage or fixed-amount, with or without a limited validity period. See [Discounts, minimums and caps](https://app.relvoerp.com/docs/product/en/commitments-discounts.md). ## When the customer requires prior approval In corporate accounts, the invoice is not issued until there is a purchase order (OC, *orden de compra*), a service acceptance sheet (HES) or an internal approval. In Relvo that is an **invoicing condition** on the contract: the charge is calculated the same way, shared as a pre-invoice, and issuance stays blocked until the evidence arrives — on purpose, because issuing without the OC is what later turns into an invoice rejected by the customer's accounts payable team. See [OC, HES and approvals](https://app.relvoerp.com/docs/product/en/approvals-commercial-references.md). ## When a charge calculation is split A single calculation can end up in more than one document: by cost center, by subsidiary or by billing account. The charge calculation is still one; what gets split is the issuance. - [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): The detail of each pricing model, with the formula and an example. - [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): Phases, amendments and terms. - [Discounts, minimums and caps](https://app.relvoerp.com/docs/product/en/commitments-discounts.md): Minimums, caps and discounts. - [From contract to payment](https://app.relvoerp.com/docs/product/en/contract-to-payment.md): A complete walkthrough of a sample contract. --- # Introduction > The Relvo public API for revenue and billing operations Source: https://app.relvoerp.com/docs/product/guides/introduction/ Relvo's public API lets you report usage, look up customers, and integrate billing events into your own systems. It is a customer-facing, token-authenticated REST API — separate from the internal API the Relvo dashboard itself uses. ## Base URL All paths below are relative to your Relvo environment's host: | Environment | Base URL | |---|---| | Production | `https://app.relvoerp.com` | | Development | your environment's Cloud Run URL (ask your Relvo contact) | A single domain serves both the dashboard and the API — there is no separate `api.` subdomain. ## Customer sandbox The isolated customer sandbox is configured for `https://sandbox.getrelvo.ai`. Access is provisioned by Relvo; confirm availability and your assigned hostname with your Relvo contact before connecting. Its API base is `https://sandbox.getrelvo.ai/api/v1/public`. Use the sandbox dashboard to issue a separate API key and create fictional customers, metrics, plans and contracts. Send sample usage, run billing, and inspect invoices before setting up production. Accounts, data, provider connections and keys stay separate from production; the token prefix alone does not identify the environment. Use only provider test credentials. Customer email is blocked; verified customer webhook receivers can receive signed test events on the isolated sandbox host. Follow the [sandbox guide](https://app.relvoerp.com/docs/product/guides/sandbox.md). Go live by onboarding your production organization and issuing production keys. Sandbox financial records are never promoted into production. ## What's in this reference The **API Reference** tab is generated directly from Relvo's backend — every endpoint, request/response shape, and required scope comes straight from the same route metadata that authorizes each request, not from hand-written documentation that can quietly fall behind. It's rebuilt and published as part of every release, so it reflects the version of the API currently deployed to production. Only operations explicitly marked for public documentation appear here. Internal application endpoints and inbound provider integrations (used internally for Chilean/LATAM fiscal document issuance) are never exposed. ## Conventions - Most lists return `{items, next_cursor}`. Paginate with `limit` (default 50, maximum 200) and pass `next_cursor` back as `cursor`. A `null` cursor means there are no more pages. - Money normally uses decimal strings, such as `"1250.00"`. The compatibility `/credit-grants` API uses exact JSON numbers and camelCase fields; see [Credits](https://app.relvoerp.com/docs/product/guides/credits.md#choose-an-api). - Native enums are lowercase. The compatibility `/credit-grants` API uses uppercase enums. - To match several values, repeat the filter: `status=open&status=paid`. - Check each operation for range boundaries. Credit availability and journal intervals include the lower bound and exclude the upper bound; compatibility credit-grant expiry dates include the whole UTC day. Most other ranges use `_from`/`_to`. Free-text search is `query`. Sort with `sort`/`order`. Lists that support it accept `updated_since`. - Writes need `Idempotency-Key`. Changes to existing resources also need `If-Match`. Errors use [one stable envelope](https://app.relvoerp.com/docs/product/guides/errors.md). - Every authenticated response carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds until capacity frees up). Slow down as `RateLimit-Remaining` approaches `0`. A `429` also carries `Retry-After`. - The API is versioned in the path (`/api/v1`) and changes within `v1` are additive only. The [changelog](https://app.relvoerp.com/docs/product/guides/changelog.md) lists every change and deprecation by date. Start with [Authentication](https://app.relvoerp.com/docs/product/guides/authentication.md) to get a token, then [Idempotency](https://app.relvoerp.com/docs/product/guides/idempotency.md) if you're writing (not just reading) through the API. The complete endpoint contract lives in the [API Reference](https://app.relvoerp.com/docs). ## Generate a client The API Reference is an OpenAPI 3.1 document served at `/public-openapi.json`. Download it and generate a typed client with any OpenAPI generator: ```bash curl -sSo relvo.openapi.json https://app.relvoerp.com/public-openapi.json npx @openapitools/openapi-generator-cli generate -i relvo.openapi.json -g typescript-fetch -o relvo-client # or, for Python: pipx run openapi-python-client generate --path relvo.openapi.json ``` Regenerate the client when the [changelog](https://app.relvoerp.com/docs/product/guides/changelog.md) shows a new version. Because changes within `v1` are additive, a client generated from an older document keeps working. If you are connecting an AI agent rather than writing an integration by hand, [MCP server](https://app.relvoerp.com/docs/product/guides/mcp.md) is the shorter path — it exposes invoice lookups and the operations task queue over the Model Context Protocol, with no client to write. --- # Developer sandbox > Build and verify a Relvo integration with isolated test data Source: https://app.relvoerp.com/docs/product/guides/sandbox/ Use `https://app.relvoerp.com/api/v1/sandbox` as your test API base. It shares the main app's infrastructure while keeping test data in a separate organization. An OWNER or ADMIN opens **Settings → Developers → API keys**, clicks **Crear sandbox de integración**, and is switched into the empty test workspace. Its creator is the owner; no production data or credentials are copied. A persistent Sandbox banner identifies the selected workspace. ## Your first integration Open **Settings → Developers**. The checklist reads your organization's actual issuer, keys, customer, active contract, invoice and successful webhook delivery. Metrics and usage are additional steps for usage-based billing. Refresh progress after making changes; errors never count as completed work. Create a fictional issuer, customer and customer billing entity, using USD for the examples below. Issue a temporary `full_access` sandbox key, store it in your secret manager, and expose it to your terminal as `RELVO_API_TOKEN`. Narrowly scoped keys remain recommended for your final integration. Keys are displayed once. The token prefix does not determine access: the authenticated key belongs to one organization, whose current mode must be sandbox. Never commit keys or paste them into verification websites. ```bash curl --fail-with-body https://app.relvoerp.com/api/v1/sandbox \ -H "Authorization: Bearer $RELVO_API_TOKEN" ``` This authenticated operation requires `full_access` and returns `runtime`, `tenant_mode`, and `organization_id`. `tenant_mode` must be `sandbox`. On the main app, `runtime` is `prod`; this is expected. A live organization key receives `403` from the sandbox API. All resource paths match the normal API, replacing `/api/v1/public` with `/api/v1/sandbox`. For an SDK, generate your client from [the sandbox OpenAPI contract](https://app.relvoerp.com/sandbox-openapi.json); it contains the same operations and schemas with sandbox paths. ## Run a billing example The repository includes `scripts/sandbox_scenarios.py`, which calls ordinary public APIs and creates no financial rows directly. Record a UUIDv7 run ID and reuse the same ID and inputs after a timeout. Each step reuses its idempotency key. ```bash uv run python scripts/sandbox_scenarios.py \ --scenario graduated --run-id "$RELVO_RUN_ID" \ --issuer-id "$RELVO_SANDBOX_ISSUER_ID" \ --customer-id "$RELVO_SANDBOX_CUSTOMER_ID" \ --billing-entity-id "$RELVO_SANDBOX_BILLING_ENTITY_ID" \ --period-start 2026-10-01 --period-end 2026-11-01 ``` Choose a completed calendar month, with an exclusive end date. The receiver must bill in USD. Use a fresh run ID for a different scenario or different inputs. | Scenario | Inputs | Independently expected USD subtotal | |---|---|---| | `fixed` | One complete month at 100 | 100.00 | | `usage` | 1,500 units at 0.01 | 15.00 | | `graduated` | First 1,000 units at 0.01; next 500 at 0.005 | 12.50 | | `minimum` | Usage of 15, with a minimum of 25 | 25.00 | The runner waits for usage receipts to become `processed` before activating the contract, then waits for the ordinary billing worker to produce the invoice. It compares the actual native-currency subtotal with the table. Taxes and provider issuance are separate. Exit 75 means usage or billing is still pending; rerun with identical inputs. A mismatch fails rather than being marked successful. No test clock is installed, and the script never issues a fiscal document or payment. ## Verify and debug webhooks In the sandbox workspace developer page, register a public HTTPS receiver. The default subscriptions are `customer.created` and `invoice.drafted`. Save the one-time signing secret in your receiver and click **Verificar receptor**. Your receiver must verify the signature and echo the ownership challenge; follow the [webhook guide](https://app.relvoerp.com/docs/product/guides/webhooks.md) for the exact format. Create a customer or run a scenario. The console shows the latest ten delivery outcomes per endpoint, including event identity and attempt count. It supports pausing, resuming, secret rotation and redelivering completed or terminally failed deliveries. Redelivery preserves event identity, so deduplicate in your receiver. For full history, pagination, event subscriptions and diagnostics, use the [public webhook API](https://app.relvoerp.com/docs). Private-network destinations and redirects are not allowed. API, HTTP, signature, and financial semantics match the production API. ## Integration capabilities | Capability | Sandbox behavior | |---|---| | Customers, catalog, contracts, metering and billing | Real domain behavior with isolated test data | | Customer webhooks | Verified public HTTPS receivers; signed deliveries and retries | | Email | No arbitrary customer delivery; inspect the existing email drafts and previews | | Payments and fiscal documents | Only independently configured, verified provider test tiers | | Provider without a test tier | Unavailable; never substitute production credentials | | FX, proration, credits and partial payments | Existing domain capabilities; configure their inputs and verify them separately from the four starter scenarios | | Advancing time | No global clock override; use explicit billing periods and previews | A provider saying “certification” is not sufficient evidence of a test tier. Confirm the provider/account environment before connecting it. Sandbox invoice preview PDFs and download filenames are labeled as test artifacts; original provider PDF bytes are preserved. ## Limits, fresh workspaces and production API requests have per-key and per-IP limits. Every sandbox workspace also has a shared organization budget across keys and IPs. Use `RateLimit-*` and `Retry-After` to handle `429`; creating more keys does not increase the workspace budget. Ask your Relvo contact for a fresh workspace when you need a clean dataset. The replacement is validated before the old organization is retired. Old financial history remains intact, and API keys from the retired organization stop authenticating. This does not clone production data. To go live, onboard a separate production organization, configure production providers, and issue production keys. Recreate reviewed configuration through the normal APIs. Sandbox usage, invoices, payments, callbacks and financial history are never promoted to production. Automatic configuration transfer and global time travel are not part of this release. --- # Authentication > Mint an API token and authenticate requests Source: https://app.relvoerp.com/docs/product/guides/authentication/ The public API authenticates every request with an **organization-scoped API token** — never with the session cookie your browser uses when logged into the Relvo dashboard. ``` Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx ``` ## Getting a token Mint a token from the **Developer Zone** inside the Relvo dashboard (Settings → Developers → API keys). Only organization OWNER/ADMIN members can issue keys. New hosted sandbox keys use `rk_test_…`; production keys use `rk_live_…`. Existing keys remain valid. The plaintext token is shown **once**, at creation — copy it immediately, Relvo does not store or redisplay it. A token is bound to a single organization. Every endpoint scopes its results to that organization automatically — there is no `organization_id` parameter to pass, and no way for a token to read or write another organization's data. ## Scopes The OpenAPI spec declares one security scheme, `BearerAuth` (HTTP bearer, "API Token"). Each operation lists the scopes it accepts in `x-required-scopes`. Your token must hold **any one** of them. Scopes follow a `resource:action` convention. A `write` scope implies `read` on the same resource, so a token with `contracts:write` can also call endpoints that require `contracts:read`. | Resource | Scopes | |---|---| | Catalog (items, billable metrics, seat metrics) | `catalog:read`, `catalog:write` | | Prices | `charging:read`, `charging:write` | | Contracts | `contracts:read`, `contracts:write` | | Customers, billing entities and taxpayer lookup | `customers:read`, `customers:write` | | Payment methods | `payment_methods:read`, `payment_methods:write` | | Payments | `payments:read` | | Invoices, credit notes, debit notes | `invoices:read`, `invoices:write` | | Usage events | `usage_events:read`, `usage_events:write`, `usage_events:correct`, `usage_event_volume:read` | | Billable metric evaluation | `usage_metric_evaluations:read` | | Seat events | `seat_events:read`, `seat_events:write` | | Credits | `credits:read`, `credits:write` | | Unmatched receipts (*pagos sin identificar*) | `reconciliation:read` | | Reports | `reports:read` | | FX conversions | `fx:read` | | Messages | `messages:read` | | Webhook endpoints | `webhooks:read`, `webhooks:write` | | Event log | `events:read` | ### Read-only keys: `full_read` `full_read` grants every `:read` scope in the table above and nothing else. It never passes a write check, so a key holding it cannot create, change, issue or delete anything. Use it for dashboards, BI exports and reporting scripts that read across invoices, usage, customers, contracts, reports and payments. A `full_read` key also reads resources added later under an existing `:read` scope. ### `full_access` `full_access` is a wildcard scope that passes every check, writes included. It is convenient for a single internal integration, but it grants everything. Prefer narrowly scoped keys, such as `usage_events:write` alone for a metering-only integration or `full_read` for a dashboard, so that a leaked key can do less damage. ## Example ```bash curl "https://app.relvoerp.com/api/v1/public/customers?limit=50" \ -H "Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx" ``` ## Rate limits Every authenticated request counts against two per-minute limits: | Limit | Default | |---|---| | Per API token | 600 requests per minute | | Per client IP, across all tokens | 1,200 requests per minute | | Hosted sandbox, per organization | 300 requests per minute, shared by every key and IP | Every authenticated response, `429` included, reports the limit that is closer to running out: | Header | Meaning | |---|---| | `RateLimit-Limit` | Requests allowed per window. | | `RateLimit-Remaining` | Requests left in the current window. | | `RateLimit-Reset` | **Seconds** until the window frees capacity. It is a delay, not a timestamp. | When you exceed a limit, Relvo answers `429` with code `rate_limited` and a `Retry-After` header in seconds. Wait that long before retrying. Pace a bulk read by `RateLimit-Remaining` rather than retrying in a tight loop. List endpoints return 50 items by default and up to 200 with `?limit=200`. Follow `next_cursor` until it is `null`. At 200 items per page, 600 requests per minute reads 120,000 records a minute, so a full dashboard refresh normally takes seconds. If you need a higher per-token limit, contact Relvo support. ## Common auth errors | Status | `code` and cause | |---|---| | `401` | `unauthenticated`: the `Authorization` header is missing or malformed, or the token is invalid. The response carries a `WWW-Authenticate` header. | | `403` | `insufficient_scope`: the token holds none of the operation's `x-required-scopes`. | | `403` | `ip_not_allowed`: the caller's IP is not on the token's allow-list. | | `404` | `not_found`: the resource belongs to another organization, or doesn't exist. | | `429` | `rate_limited`: the token or IP exceeded its per-minute limit. Retry after `Retry-After` seconds. | --- # Credits > Choose a credits API, grant prepaid or promotional capacity, create invoice drafts, and reconcile balances safely Source: https://app.relvoerp.com/docs/product/guides/credits/ Credits give a customer currency or metric capacity that billing can apply to eligible charges. A credit grant is the commercial entitlement; an **allowance** is an individual financial occurrence of that entitlement. A recurring contract grant can produce multiple allowances. Credit notes are separate fiscal correction documents; these APIs do not create credit notes. ## Choose an API All paths below start at `/api/v1/public`. Both APIs share financial capacity and history. Choose one creation workflow for each purchase; sending it to both APIs creates two grants. | Need | API Reference section | Endpoint | | --- | --- | --- | | Create customer currency credits with an explicit billing profile | One-off Credits | `POST /credits/grants` | | Grant metric units or free promotional credits | One-off Credits | `POST /credits/grants` | | Create a purchase invoice draft together with credits | One-off Credits | `POST /credits/grants` | | Inspect or revoke an individual financial allowance | One-off Credits | `GET /credits/grants/{grant_id}`, `POST /credits/grants/{grant_id}/revoke` | | Read stable customer or contract-phase grant configuration, refresh rules, and integration IDs | Credit Grants | `GET /credit-grants`, `GET /credit-grants/{id}` | | Create a customer currency grant using the compatibility payload | Credit Grants | `POST /credit-grants` | | Inspect scoped balances and journal activity | Credit Balances & History | `GET /credits/balances`, `GET /credits/customers`, `GET /credits/ledger` | Contract-phase grants are authored through contract configuration, not by posting a recurring grant to either customer creation endpoint. The read-only configuration view at `/credit-grants` includes these recurring grants. ### Contract differences | Contract | One-off credits: `/credits/grants` | Stable grants: `/credit-grants` | | --- | --- | --- | | Field names and enums | snake_case; lowercase enums | camelCase; uppercase enums | | Capacity | Currency or metric units | Customer creation: currency only; reads also expose contract metric grants | | Billing profile selection | Required `billing_entity_id` belonging to `customer_id` | Customer must have exactly one active billing profile; ambiguity is rejected | | Numbers | Exact decimal strings, including metric quantities | Exact JSON numbers; up to 15 integer and 10 fractional digits | | Availability | Issued during creation; effective window still applies | Creation returns `PENDING`; a durable worker issues after commit | | Purchase invoice | Optional atomic draft with `create_invoice` and `purchase_invoice` | Not supported by the customer creation payload | | Time | Offset-aware instants; microseconds retained; expiry exclusive | UTC calendar dates; expiry date inclusive | | List pagination | `limit` 1–100, default 50; `cursor` → `next_cursor` | `limit` 1–100, default 20; `after` or `before`, with `sortOrder` | | Identity | Financial allowance ID | Stable commercial grant ID; a phase ID is not an allowance ID | Do not translate IDs between these representations by assumption. A recurring configuration can have multiple financial occurrences. Use the identifiers returned by the operation you are calling. ## Authentication and prerequisites Use a bearer API token bound to the organization. Writes require `credits:write`, which also permits reads. Reads accept `credits:read` or the reviewed `full_read` scope. Credentials determine the organization; never send an organization ID in native credit payloads. Before creating credits: 1. Find or create the customer using the Customers API. 2. Read its Billing Entities and select the legal billing account receiving the credits. Use that account's public ID as `billing_entity_id`; a customer ID is not a billing-entity ID. 3. For metric credits, select an existing billable metric. For a purchase invoice, select your issuer billing entity and an active catalog item, and check the applicable invoice tax policy. 4. Generate an `Idempotency-Key` once for the intended purchase or promotion. Retain it for retries. Billing-entity lookup, catalog, and metric operations require their own token scopes; each operation in the [API Reference](https://app.relvoerp.com/docs) lists them. ## Create one-off credits This example grants USD 100 of capacity for a USD 80 purchase and creates its purchase invoice draft. Replace the example IDs with resources from your organization. Face value is the capacity the customer receives; purchase price is what the customer pays. ```bash curl --request POST 'https://app.relvoerp.com/api/v1/public/credits/grants' \ --header "Authorization: Bearer $RELVO_API_KEY" \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: purchase-prepaid-2026-11-17-001' \ --data @purchase.json ``` Save this request body as `purchase.json`: ```json { "customer_id": "019a8e00-0000-7000-8000-000000000001", "billing_entity_id": "019a8e00-0000-7000-8000-000000000002", "name": "Prepaid USD capacity", "origin": "purchased", "face_value": { "kind": "money", "money": {"amount": "100.00", "currency": "USD"} }, "purchase_price": {"amount": "80.00", "currency": "USD"}, "expires_at": "2027-01-01T00:00:00.000000Z", "create_invoice": true, "purchase_invoice": { "issuer_billing_entity_id": "019a8e00-0000-7000-8000-000000000003", "item_id": "019a8e00-0000-7000-8000-000000000004", "title": "Prepaid capacity purchase", "issue_date": "2026-11-17", "payment_terms_days": 30 } } ``` A successful `201` response returns the immutable command receipt: `id`, `version`, `face_value`, `purchase_invoice_id`, and `changed`. `Location` points to the allowance detail and `ETag` carries its version. Read that location for current counters; retrying the creation returns the original receipt even if capacity has since changed. ### Purchase invoice behavior `create_invoice: true` requires `purchase_invoice` and `origin: "purchased"`. The grant and complete invoice draft commit together, or neither does. The receiving billing entity comes from the grant; the issuer is selected separately using `issuer_billing_entity_id`. The invoice net price is `purchase_price`; tax references must agree with invoicing fiscal policy. This creates a **draft**. It does not finalize or fiscally issue an invoice, contact a fiscal provider, charge a payment method, or wait for payment before making issued credits spendable. Continue through the normal invoice workflow using `purchase_invoice_id`. For credits without an invoice, omit `purchase_invoice` and omit `create_invoice` or set it to `false`. Supplying invoice details while the flag is false is rejected. ### Promotional and metric credits For a promotion, use `origin: "promotional"` and a zero `purchase_price`; promotions cannot create purchase invoices. For metric capacity, replace `face_value` with: ```json { "kind": "metric", "metric_id": "019a8e00-0000-7000-8000-000000000005", "quantity": "1000.125" } ``` Metric units and monetary purchase price are independent. Use decimal strings and a decimal-capable client; do not round-trip values through binary floating point. Currency inputs must satisfy the currency's precision without rounding. ### Effective and expiry windows Omitting `effective_at` makes the grant effective at the operation instant. Availability includes `effective_at` and excludes `expires_at`; a null expiry means no expiry. A future-effective grant is issued but is not yet spendable. Issuance, validity, revocation, and depletion are separate facts. Native credit instants require an explicit timezone offset and preserve up to six fractional digits. `purchase_date` and invoice `issue_date` are calendar dates spelled `YYYY-MM-DD`. For the compatibility API, an `expiryDate` of `2026-12-31` includes that whole UTC day, equivalent to an exclusive native expiry of `2027-01-01T00:00:00Z`. ## Balances and history - `GET /credits/grants?customer_id=…&grant_scope=customer` lists customer-wide allowances. Without `grant_scope`, the list also includes contract allowances. Filter `billing_schedule_id` to inspect a contract lineage. - `GET /credits/balances?customer_id=…` returns that customer's complete scoped balances without another page. Keep billing entities, currencies, and metrics separate; their values cannot be added into one spendable total. - `GET /credits/customers` pages customer summaries and includes complete balances for each selected customer. - `GET /credits/ledger?customer_id=…` pages immutable movements. Use `grant_id` or `invoice_id` to reconcile a specific allowance or invoice. `occurred_from` is inclusive and `occurred_before` exclusive; microseconds are preserved. Spendability considers issuance, reservations, revocation, and the effective window. Expired capacity is not spendable even before an expiry journal entry is posted. Time-sensitive reads include `evaluated_as_of`. Reads never issue, consume, or repair credits. For native paginated lists, repeat the same filters and pass `next_cursor` as `cursor` until it is null. Cursors are signed and tied to the operation, organization, and filters. They are not interchangeable with `/credit-grants` before/after cursors. Pages reflect current state rather than a frozen snapshot. ## Revoke unused capacity Read `GET /credits/grants/{grant_id}`, retain its `ETag`, then call: ```bash curl --request POST \ "https://app.relvoerp.com/api/v1/public/credits/grants/$GRANT_ID/revoke" \ --header "Authorization: Bearer $RELVO_API_KEY" \ --header "If-Match: $GRANT_ETAG" \ --header 'Idempotency-Key: revoke-prepaid-2026-11-17-001' \ --header 'Content-Type: application/json' \ --data '{"reason":"Unused capacity retired at customer request"}' ``` `GRANT_ETAG` must contain the complete header value from the detail response, including its quotes. Revocation preserves consumed capacity and financial history. It cannot delete a grant, undo consumed credits, cancel an invoice, or proceed while invoice reservations are outstanding. ## Retries and errors | Response | Meaning and next action | | --- | --- | | `400` missing/invalid idempotency key | Supply a valid key; retain the same key and intent for retries. | | `400 invalid_cursor` | Restart the list with the intended filters. | | `403` | Check the API token's operation scope. | | `404` | Check customer, billing entity, or allowance ownership within the token's organization. | | `409 idempotency_key_reused` | The key was already used for a different intent. Correct the request or create a new intentional operation with a new key. | | `409` transition/concurrency conflict | Read the current allowance and reservations before deciding the next action. | | `412` | The allowance changed. Read a fresh ETag, reassess, and submit a new intended operation with a new key. | | `428` | Supply `If-Match` for revocation. | | `422` | Correct invalid amounts, scope/asset combinations, dates, or invoice terms using the error details. | After a timeout, retry the same request with its original key. Do not issue a new key merely because the response was lost. See [Idempotency](https://app.relvoerp.com/docs/product/guides/idempotency.md) and [Errors](https://app.relvoerp.com/docs/product/guides/errors.md) for the shared error envelope and concurrency rules. ## Sequence integration comparison Sequence's [customer credit workflow](https://docs.sequencehq.com/credits/grant-credits) supports cash or metric units, expiry, and an optional invoice draft. Relvo's one-off API covers those workflows with explicit receiver/issuer selection and an atomic draft. Sequence's [older create-credit endpoint](https://docs.sequencehq.com/reference/2024-07-30/billing/create-a-new-credit-grant) is `/api/credits`; Relvo's counterpart is `POST /api/v1/public/credits/grants`. Sequence's [stable credit-grant resource](https://docs.sequencehq.com/reference/latest/billing/list-credit-grants) exposes customer and schedule grants, state, refresh configuration, and integration identifiers. Relvo exposes that view through `/api/v1/public/credit-grants`. This is payload compatibility for supported operations, not a drop-in transport replacement: authentication, base paths, errors, and the native financial API follow Relvo's contracts. | Migration concern | Relvo behavior | | --- | --- | | Sequence `createInvoice` | Native `create_invoice` plus required `purchase_invoice` details; creates a draft only. | | Sequence `costOfCredit` and `amount` | Native `purchase_price` and `face_value` are separate; use exact decimal strings. | | Sequence expiry dates | Preserve inclusive dates for `/credit-grants`; convert deliberately to an exclusive instant for native credits. | | Deleting a mistaken grant | Revoke unused capacity; financial records and journal history remain auditable. | | Stable schedule grant ID | Inspect configuration via `/credit-grants`; use the actual financial allowance ID for native detail and revocation. | Check each endpoint in the [API Reference](https://app.relvoerp.com/docs) when migrating. Similar field names do not guarantee identical lifecycle, validation, pagination, or precision rules. --- # Idempotency > Safely retry writes without double-processing Source: https://app.relvoerp.com/docs/product/guides/idempotency/ Every `POST` to `/api/v1/public` requires an `Idempotency-Key` header. This includes creates and actions such as `/contracts/{id}/activate`. Relvo uses the key to process a request at most once, even if you retry after a timeout or a network error. ``` Idempotency-Key: 2f6a1e4c-9b3d-4a11-9e2f-6c1a8b0d5e77 ``` There are two exceptions: `POST /usage-events` and `POST /seat-events`. Batch ingestion carries an `idempotency_key` **on each event** instead of in a header. ## How it works - Send a unique key with every write. A UUID works well. - If Relvo has already completed a request with that key, it returns the **original result** and does not process the request again. - A missing header is rejected with `400 idempotency_key_required`. A malformed key is rejected with `400 invalid_idempotency_key`. - If you reuse a key with a **different** body, the response is `409 idempotency_key_reused`. Either your retry logic generated the wrong key, or two unrelated operations collided. ## Idempotency and If-Match `PATCH`, `PUT`, `DELETE` and actions on existing resources also need `If-Match: W/""`. See [Errors](https://app.relvoerp.com/docs/product/guides/errors.md#optimistic-concurrency). Keep the same `Idempotency-Key` when you retry a request. When `If-Match` was stale, read the resource again, then send a new request with a new key. ## Practical guidance - Generate the key once per logical operation, before the first attempt. Every retry of that operation must reuse it. - Keys normally belong to a specific operation. The compatibility `/credit-grants` creation contract uses a permanent account-scoped marker; keep its keys unique across customer grant purchases. See [Credits](https://app.relvoerp.com/docs/product/guides/credits.md). - If you retry while Relvo is still processing the original request, you get a fast, safe rejection rather than a duplicate write. ## Example ```bash curl -X POST "https://app.relvoerp.com/api/v1/public/customers" \ -H "Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx" \ -H "Idempotency-Key: 2f6a1e4c-9b3d-4a11-9e2f-6c1a8b0d5e77" \ -H "Content-Type: application/json" \ -d '{ "...": "..." }' ``` --- # Errors > The error response shape and the stable error code catalogue Source: https://app.relvoerp.com/docs/product/guides/errors/ Every error from `/api/v1/public` uses the same JSON envelope. This includes validation failures, domain rule violations and auth rejections. ```json { "code": "validation_failed", "message": "Request validation failed", "request_id": "019f5334-1e22-7082-a665-b54b0e93bfba", "correlation_id": "019f5334-1e22-7082-a665-b54b0e93bfba", "params": { "validation_errors": [ { "loc": ["body", "currency"], "type": "missing", "message": "Field required" } ] }, "is_transient": false } ``` | Field | Description | |---|---| | `code` | A stable, machine-readable `snake_case` code. You can safely branch on it in your integration. | | `message` | A human-readable description. Its wording may change, so don't parse it. | | `request_id` | The ID of this HTTP request. Include it when you contact support. | | `correlation_id` | Groups related requests, such as a request and the async work it triggers. | | `params` | Structured detail about the failure. It is always an object, and may be `{}`. | | `is_transient` | `true` means the same request may succeed if you retry it later. `false` means a retry fails the same way unless you change the request. | ## Cross-cutting codes | Status | `code` | Meaning | |---|---|---| | `400` | `bad_request` | The request is malformed. | | `400` | `idempotency_key_required` | A POST without an `Idempotency-Key` header. See [Idempotency](https://app.relvoerp.com/docs/product/guides/idempotency.md). | | `400` | `invalid_idempotency_key` | The `Idempotency-Key` value is malformed. | | `400` | `invalid_if_match` | The `If-Match` value is not `W/""`. | | `400` | `invalid_cursor` | The pagination `cursor` is malformed or expired. | | `401` | `unauthenticated` | The token is missing or invalid. The response carries a `WWW-Authenticate` header. | | `403` | `forbidden` | You are authenticated, but not allowed to perform this action. | | `403` | `sandbox_organization_required` | Use an API key from an active sandbox workspace for the sandbox API. | | `403` | `insufficient_scope` | The token lacks every scope the operation accepts. See [Authentication](https://app.relvoerp.com/docs/product/guides/authentication.md). | | `403` | `ip_not_allowed` | The caller's IP is not on the token's allow-list. | | `404` | `not_found` | The resource doesn't exist or isn't visible to your organization. | | `405` | `method_not_allowed` | The HTTP method is not supported on this path. | | `406` | `not_acceptable` | The `Accept` header asks for a format the operation cannot produce. | | `409` | `conflict` | The request conflicts with the resource's current state. | | `409` | `idempotency_key_reused` | The `Idempotency-Key` was already used with a different request body. | | `409` | `idempotency_key_in_progress` | The first request with this `Idempotency-Key` is still running. Wait briefly, then retry with the same key. | | `410` | `gone` | The resource or operation was permanently removed. | | `412` | `version_conflict` | The `If-Match` version is stale. `params.current_version` holds the current version. | | `413` | `payload_too_large` | The body is too large. `params.max_bytes` holds the limit. | | `415` | `unsupported_media_type` | Send `Content-Type: application/json`. | | `422` | `validation_failed` | The body or query failed validation. See `params.validation_errors`. | | `422` | `metadata_invalid` | `metadata` breaks a limit (50 keys, 40-character keys, 500-character values). `params.reason` says which. | | `428` | `precondition_required` | A PATCH, PUT, DELETE or action was sent without the required `If-Match` header. | | `429` | `rate_limited` | Too many requests. Wait for `Retry-After` seconds. | | `500` | `internal_error` | An unexpected error. Check `is_transient`. | | `502` | `bad_gateway` | An upstream provider returned an invalid response. Retry with backoff. | | `503` | `service_unavailable` | A dependency is temporarily unavailable. Retry with backoff. | | `503` | `concurrency_retry` | A concurrent write collided with this one. Retry the same request, with the same `Idempotency-Key`. | | `504` | `gateway_timeout` | An upstream provider did not answer in time. Retry with the same `Idempotency-Key`. | | `422` | `invalid_date_window` | The requested start/end date window is invalid; correct its boundaries. | | `409` | `invoice_line_total_discount_review_required` | Remove the total discount before editing a line amount or currency, then review and reapply it. | Resource-specific codes (for example `webhooks_endpoint_not_found`) are listed on each resource's page. ## Report codes Every operation under `/reports/` can also return these: | Status | `code` | Meaning | |---|---|---| | `400` | `reporting_money_fx_rate_not_found` | No exchange rate on or before the anchor date converts an amount into `reporting_currency`. `params` names `from_currency`, `to_currency` and `anchor_date`. Load the rate or choose another `reporting_currency`. | | `400` | `reporting_*` | Another reporting rule rejected the inputs. The code names the rule. | | `400` | `invalid_cursor` | On the receivables-aging invoice list: the `cursor` was altered, or was sent with different filters (`customer_id`, `as_of`, `group_key`, `reporting_currency`, `contract_id`) than the page that issued it. | | `422` | `validation_failed` | An unknown enum value or timezone, `date_from` after `date_to`, or a `limit` out of range. | | `500` | `report_unavailable` | The report could not be computed. This is a server-side fault, not something the request can fix. Retrying is safe. | ## Invoices, credit notes and debit notes | Status | `code` | Meaning | |---|---|---| | `404` | `invoice_not_found` | The invoice does not exist in your organization. | | `404` | `invoice_line_not_found` | The invoice line does not exist on this invoice. | | `404` | `invoice_line_group_not_found` | The invoice line group does not exist on this invoice. | | `404` | `invoice_version_not_found` | The requested invoice version does not exist. | | `404` | `credit_note_not_found` | The credit note does not exist in your organization. | | `404` | `debit_note_not_found` | The debit note does not exist in your organization. | | `404` | `fiscal_artifact_not_found` | The document exists but has no stored PDF or XML yet; `params.kind` names which one. Try again once the document is issued. | | `503` | `fiscal_artifact_unavailable` | Document storage is temporarily unavailable (`is_transient: true`); retry later. | | `422` | `invoice_billing_entities_not_paired` | Only one of `billing_entity_id` and `issuer_billing_entity_id` was sent; send both or neither. | | `422` | `invoice_update_empty` | The invoice update body changes no field. | | `422` | `invoice_line_update_empty` | The line update body changes no field. | | `422` | `invoice_line_group_update_empty` | The line group update body changes no field. | | `422` | `invoice_field_not_clearable` | The body sets a required invoice field to `null`; `params.field` names it. | | `422` | `invoice_line_group_field_not_clearable` | The body sets a required line group field to `null`; `params.field` names it. | | `422` | `invoicing_invoice_line_input_invalid` | A line in the request is invalid. | | `409` | `invoicing_invoice_draft_edit_lifecycle_conflict` | The invoice is no longer a `draft`, so it cannot be edited. | | `409` | `invoicing_invoice_draft_resource_removal_conflict` | The resource cannot be removed from the draft, for example a group that still has lines. | | `409` | `invoicing_invoice_cancellation_lifecycle_conflict` | Only a `draft` can be cancelled. | | `409` | `invoicing_invoice_opening_blocked` | The draft cannot be issued yet. `params.blocking_codes` lists the reasons. `issuer_fiscal_registration_missing` means the issuer needs an active fiscal registration. `issuer_fiscal_connection_unresolved` means Relvo could not select an active fiscal provider connection for the issuer. | | `409` | `invoicing_invoice_line_fiscal_basis_missing` | A line lacks the fiscal basis needed to duplicate the invoice. | | `409` | `invoicing_next_credit_note_lifecycle_status_invalid` | The credit note is not in the status the operation requires. | | `409` | `invoicing_next_debit_note_lifecycle_status_invalid` | The debit note is not in the status the operation requires. | | `409` | `invoicing_next_credit_note_fiscal_status_invalid` | The credit note's fiscal status does not allow the operation. | | `409` | `invoicing_next_debit_note_fiscal_status_invalid` | The debit note's fiscal status does not allow the operation. | | `409` | `invoicing_next_credit_note_source_stale` | The source invoice changed after the credit note was drafted; re-read it and draft again. | | `409` | `invoicing_next_correction_note_source_invoice_invalid` | The source invoice cannot be corrected by a note. | | `422` | `invoicing_next_debit_note_tax_rate_unsupported` | The tax rate is not accepted for debit notes. | ## Payments and payment methods | Status | `code` | Meaning | |---|---|---| | `422` | `invalid_range` | `received_at_from` is after `received_at_to` on `GET /payments`. | | `404` | `payment_not_found` | No payment with this id in your organization. | | `404` | `customer_not_found` | The customer doesn't exist in your organization or is inactive. | | `404` | `billing_entity_not_found` | The billing entity doesn't belong to the customer in the path. | | `404` | `payment_method_not_found` | No payment method with this id in your organization. | | `404` | `payment_method_assignment_not_found` | The customer payment method doesn't belong to the customer in the path. | | `409` | `payment_method_conflict` | The change conflicts with the method's current state, or a concurrent write won the race. Re-read and retry. | | `409` | `payment_method_inactive` | The payment method is inactive; inactive methods are terminal. | | `409` | `payment_method_assignment_inactive` | The customer payment method is inactive; inactive assignments are terminal. | | `409` | `billing_entity_inactive` | The billing entity is not an active customer relationship. | | `409` | `payment_method_provider_mismatch` | The method's provider differs from the billing entity's collection provider. | | `422` | `payment_method_invalid` | The method's fields are not a valid combination (for example `offline` with a provider). | | `422` | `payment_method_reference_unusable` | The referenced bank account or provider connection is missing, inactive or of another provider. | | `422` | `payments_payment_method_bank_account_required` | A Relvo-collected `bank_transfer` method needs a `bank_account_id`. | | `422` | `payments_payment_method_bank_account_incomplete` | The bank account lacks fields a payer needs; `params.missing` names them. | | `422` | `payments_payment_method_bank_account_currency_unsupported` | The bank account's currency is not one the method supports. | ## Metering, seat events and seat metrics | Status | `code` | Meaning | |---|---|---| | `422` | `invalid_timestamp` | A time filter (`GET /usage-events`, `GET /seat-events`, `GET /currency-conversions`, evaluation timeframes) is not an RFC 3339 instant with an offset. | | `422` | `invalid_range` | A `*_from` filter is after its `*_to` (`GET /usage-events`, `GET /seat-events`, `GET /payments`). | | `404` | `seat_event_not_found` | No seat event with that id in this organization. | | `404` | `seat_metric_not_found` | The seat metric is missing or already deleted (`PATCH`). | | `404` | `seat_metric_not_on_contract` | `GET /seat-events/count`: the seat metric is not defined on that contract (or any of its revisions) in this organization. | | `409` | `seat_metric_in_use` | `DELETE /catalog/seat-metrics/{id}`: seat prices or open contracts still read quantity from the metric. | | `404` | `usage_event_not_found` | No usage event with that id in this organization. | | `404` | `usage_event_receipt_not_found` | No usage event receipt with that id in this organization. | Per-item results of `POST /seat-events` carry `idempotency_key_reused` when an item's key was already used with a different body; nothing is written for that item. The same key with the same body is reported as a duplicate. ## Customers, billing entities and contacts | Status | `code` | Meaning | |---|---|---| | `409` | `customer_code_not_unique` | Another customer in your organization already uses this `code`; pick a different one. | | `422` | `customer_rejected` | The customer create or update breaks a customer rule; check the fields you sent. | | `422` | `billing_entity_rejected` | The billing entity create, update or delete breaks a billing entity rule. | | `422` | `billing_entity_is_issuer` | Your organization's own issuing billing entity cannot be deleted. | | `422` | `billing_profile_archived` | The billing profile is archived, so it cannot be updated. | | `422` | `billing_profile_rejected` | The billing profile update breaks a billing profile rule. | | `422` | `contact_rejected` | The contact create or update breaks a contact rule. | ## Contracts and contract documents | Status | `code` | Meaning | |---|---|---| | `403` | `contract_forbidden` | The token may not access contracts of this organization. | | `404` | `contract_not_found` | The contract, or a resource it references, does not exist in your organization. | | `404` | `contract_amendment_reconciliation_not_found` | The amendment reconciliation does not exist. | | `404` | `contract_document_not_found` | The contract document does not exist on this contract. | | `409` | `contract_not_active` | The contract must be active for this action. | | `409` | `contract_price_not_active` | A price bound to the contract is not active; activate it or bind another price. | | `409` | `contract_state_conflict` | The contract's current state does not allow this action; re-read the contract. | | `413` | `contract_document_too_large` | The PDF exceeds 20 MiB. | | `415` | `contract_document_content_type_invalid` | Send the document with `Content-Type: application/pdf`. | | `422` | `contract_document_pdf_invalid` | The upload is not an intact PDF of at most 20 MiB. | | `422` | `contract_invalid` | The contract change violates a contract rule. | | `422` | `contract_unreadable` | The contract could not be read; contact support with the `request_id`. | ## Imports | Status | `code` | Meaning | |---|---|---| | `403` | `contract_import_requester_not_authorized` | No organization administrator stands behind this upload, so the import was refused. | | `404` | `contract_import_not_found` | The contract import does not exist in your organization. | | `422` | `contract_import_pdf_invalid` | The contract PDF could not be read; resend the original file. | ## FX (`/currency-conversions`) | Status | `code` | Meaning | |---|---|---| | `404` | `currency_conversion_not_found` | No official conversion rate is available for this currency pair at that instant. | | `422` | `currency_pair_invalid` | `base_currency` and `quote_currency` must differ. | ## Organization | Status | `code` | Meaning | |---|---|---| | `404` | `organization_not_found` | The token's organization does not exist. | | `404` | `invitation_not_found` | The invitation does not exist, or its organization is gone. | ## Commercial references | Status | `code` | Meaning | |---|---|---| | `404` | `parsed_commercial_reference_not_found` | The parsed commercial reference does not exist in your organization. | ## Messaging | Status | `code` | Meaning | |---|---|---| | `404` | `message_not_found` | The message does not exist in your organization. | ## Financial credits (`/credits/*`) | Status | `code` | Meaning | |---|---|---| | 403 | `credits_forbidden` | Current organization membership or token authority does not permit the operation. | | 404 | `credits_not_found` | Credit grant or a required customer, billing entity, metric or purchase reference is unavailable in this organization. | | 404 | `credits_scope_mismatch` | The requested credit scope does not match its organization, customer or billing entity. | | 422 | `credits_invalid` | A credit amount, availability window, purchase invoice or other financial term is invalid. | | 422 | `credits_asset_mismatch` | Credit currencies or metrics do not match exactly. | | 409 | `credits_capacity_exceeded` | The operation exceeds authoritative credit capacity. | | 409 | `credits_not_spendable` | The grant is revoked, scheduled or expired at the relevant instant. | | 409 | `credits_transition_invalid` | The current lifecycle or outstanding invoice reservations block this operation. | | 409 | `credits_concurrent_write` | Credits changed concurrently; recompute the operation and retry with the same request key. | | 409 | `credits_grant_stale_version` | A correction was built against an outdated grant version. | Revocation uses the standard `428 precondition_required` and `412 version_conflict` codes for missing or stale `If-Match`. Idempotency and cursor failures use the cross-cutting codes above. A purchase invoice draft failure rolls back the grant too. ## Validation errors `params.validation_errors` is a list of `{loc, type, message}` objects. `loc` is the path to the invalid field. The list is capped at 100 entries. When the cap is hit, `params.truncated` is `true`. ## Optimistic concurrency Every mutable resource returns its `version` in the body and as an `ETag: W/""` header. To change a resource, send that value back in `If-Match`. Each failure has its own code: - If `If-Match` is missing, the response is `428 precondition_required`. - If it is malformed, the response is `400 invalid_if_match`. - If it is stale, the response is `412 version_conflict`. Re-read the resource, then retry using `params.current_version`. ## Quotes and stable credit grants | Status | `code` | Meaning and recovery | |---|---|---| | 400 | `invalid_quote_query` | The quote or template filters are invalid. Correct the named filters; keep the cursor bound to the same query. | | 400 | `invalid_quote_request` | The quote body is invalid. Check required fields, supported names, exact decimal strings and body limits. | | 409 | `quote_identity_unavailable` | Original quote identity is unavailable. Reconcile its creation evidence before listing it. | | 404 | `quote_not_found` | The quote is missing or is not available in this organization. | | 409 | `quote_presentation_unavailable` | The retained quote cannot be presented completely. Restore its required presentation evidence before retrying. | | 409 | `quote_template_creator_unknown` | The template has no retained original creator. Reconcile its creation evidence before listing it. | | 503 | `quote_write_temporarily_unavailable` | The quote write could not complete reliably. Retry the identical request with its original Idempotency-Key. | | 422 | `retired_query_parameter` | A removed credit-grant filter was supplied. Use contractId instead of billingScheduleId. | | 400 | `unsupported_quote_version` | The selected quote version profile is unsupported. Omit Sequence-Version or select 2024-07-30. | --- # Webhooks > Register an endpoint, prove you own it, and receive event deliveries Source: https://app.relvoerp.com/docs/product/guides/webhooks/ Webhook endpoints let your application receive Relvo events as HTTP callbacks, instead of polling: invoices, credit notes and debit notes accepted or rejected by the tax authority, invoices entering draft, payments, paid and voided invoices, contract and customer changes, and customer emails arriving in Relvo. The full list is in [Events](https://app.relvoerp.com/docs/product/guides/webhooks.md#events). Registering one is a two-step process: create the endpoint, then prove you control the URL. ## Endpoint lifecycle ``` pending_verification → active ⇄ disabled any status → deleted ``` | Status | Meaning | |---|---| | `pending_verification` | Registered, but ownership hasn't been confirmed yet. No events are delivered here. | | `active` | Verified and receiving deliveries for its subscribed event types. | | `disabled` | Paused with `POST /{id}/disable`. Resume it with `POST /{id}/enable`. | | `deleted` | Removed. Its URL is free to register again as a new endpoint. | ## 1. Register an endpoint Authenticate with an API token that has `webhooks:write` (or `webhooks:read` for the `GET` operations). See [Authentication](https://app.relvoerp.com/docs/product/guides/authentication.md). | Operation | Method & path | |---|---| | List / get endpoints | `GET /public/webhook-endpoints`, `GET /public/webhook-endpoints/{id}` | | Create an endpoint | `POST /public/webhook-endpoints` | | Verify / reissue challenge | `POST /public/webhook-endpoints/{id}/verify`, `POST /{id}/reissue-challenge` | | Disable / enable | `POST /{id}/disable`, `POST /{id}/enable` | | Rotate the signing secret | `POST /{id}/rotate-secret` | | Replace subscriptions | `PUT /{id}/subscriptions` | | Delete | `DELETE /{id}` | | List / get deliveries | `GET /{id}/deliveries`, `GET /{id}/deliveries/{delivery_id}` | | Redeliver | `POST /{id}/deliveries/{delivery_id}/redeliver` | Every `POST` needs an `Idempotency-Key` header with a unique value you generate, such as a UUID. Retrying with the same key and body returns the original result without repeating the action, so network retries are safe. Every write on an existing endpoint also needs `If-Match: W/""`. This covers all actions, `PUT` and `DELETE`. Take the value from the endpoint's `version` or its `ETag` header. `PUT` and `DELETE` take no `Idempotency-Key`, because `If-Match` already makes them safe to retry. `redeliver` acts on a delivery rather than the endpoint, so it takes no `If-Match`. Lists return `{items, next_cursor}`. Errors use the [standard envelope](https://app.relvoerp.com/docs/product/guides/errors.md). Branch on `code`, never on `message`. The wire `code` is snake_case. The dotted form in brackets is the same error's internal name, which appears in older integrations and logs: | Status | `code` | Meaning | |---|---|---| | `400` | `idempotency_key_required` | A `POST` without an `Idempotency-Key` header. | | `400` | `invalid_idempotency_key` | The key is not 8–128 characters of `A–Z a–z 0–9 . _ -`. | | `400` | `invalid_if_match` | `If-Match` is not a `W/""` ETag. | | `404` | `webhook_endpoint_not_found` | Wrong ID or another organization's endpoint. | | `404` | `webhook_delivery_not_found` | The delivery does not exist or belongs to another endpoint. | | `409` | `webhook_endpoint_url_taken` | Create: a live (not `deleted`) endpoint already uses this URL. | | `409` | `webhook_endpoint_state_conflict` | The endpoint's status does not allow the operation (e.g. `/verify` on an endpoint that is not `pending_verification`). | | `409` | `webhook_verification_failed` | `/verify`: your endpoint did not answer 2xx with the challenge echoed, could not be reached, or resolves to a non-public address. | | `409` | `webhook_delivery_not_eligible` | `redeliver` on a delivery that is still `pending`, `retry_scheduled` or `in_flight`. | | `409` | `idempotency_key_reused` | The `Idempotency-Key` was already used with a different request. | | `412` | `version_conflict` | `If-Match` is stale. Re-read the endpoint and retry. | | `422` | `validation_failed` (`params.field`: `endpoint_url`) | Create: invalid URL or an unknown event type. | | `422` | `validation_failed` (`params.field`: `subscriptions`) | Replace subscriptions: an unknown or duplicated pair. | | `428` | `precondition_required` | A write on an existing endpoint without `If-Match`. | ```bash curl -X POST "https://app.relvoerp.com/api/v1/public/webhook-endpoints" \ -H "Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "endpoint_url": "https://example.com/relvo/webhooks", "subscriptions": [ { "event_type": "invoice.issued", "schema_version": 1 }, { "event_type": "message.received", "schema_version": 1 } ] }' ``` ```json { "id": "018f1234-5678-7abc-def0-1234567890ab", "status": "pending_verification", "signing_secret": "kP3x_9vN2-qT7...", "verification_challenge": "AbC123-xyz..." } ``` Two values in the response are shown only once — store them immediately: - **`signing_secret`**: the key for verifying every future delivery to this endpoint. See [Verifying delivery signatures](https://app.relvoerp.com/docs/product/guides/webhooks.md#verifying-delivery-signatures). It is an opaque URL-safe string with no prefix, and it is never shown again. If it is lost or compromised, rotate it. See [Rotating the signing secret](https://app.relvoerp.com/docs/product/guides/webhooks.md#rotating-the-signing-secret). - **`verification_challenge`**: the value your endpoint must hand back to prove ownership. It expires **15 minutes** after creation. `POST /{id}/reissue-challenge` issues a fresh one. The response also carries `version` (here `1`) and an `ETag: W/"1"` header. Send that value as `If-Match` on the next write. ## 2. Implement the verification handshake Before Relvo marks your endpoint `active`, it sends this to the URL you registered: ``` POST User-Agent: Relvo-Webhooks/1.0 Content-Type: application/json Relvo-Verification: Relvo-Timestamp: Relvo-Webhook-Version: v1 Relvo-Signature: v1= {"type":"relvo.webhook.verify","challenge":""} ``` The challenge is sent both ways — header and body — so you can read it from whichever is easiest. The request is signed exactly like an event delivery, with the same `signing_secret` and the same `Relvo-Timestamp` / `Relvo-Signature` headers (see [Verifying delivery signatures](https://app.relvoerp.com/docs/product/guides/webhooks.md#verifying-delivery-signatures)), so a handler that checks signatures on every request can keep doing so. If your signature check would reject it, it would reject every real delivery too, and `/verify` tells you now instead of after go-live. Your endpoint needs to: 1. Recognize `type == "relvo.webhook.verify"` instead of routing it into your normal event handling. 2. Respond `2xx`. 3. Echo the challenge back, either as a `Relvo-Verification` response header or a `{ "challenge": "..." }` JSON body. One of the two is enough. ```ts const payload = await request.json(); if (payload.type === "relvo.webhook.verify") { return json({ challenge: payload.challenge }, { status: 200 }); } // ... handle your normal event types below ``` If your handler only matches known business event types and ignores everything else, it will 2xx the verification request without echoing anything — and verification will keep failing. Match `relvo.webhook.verify` explicitly. ## 3. Trigger verification Once your endpoint is ready to answer the handshake: ```bash curl -X POST "https://app.relvoerp.com/api/v1/public/webhook-endpoints/{id}/verify" \ -H "Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx" \ -H "Idempotency-Key: $(uuidgen)" \ -H 'If-Match: W/"1"' ``` | Result | Meaning | |---|---| | `200 OK` | Verified. The endpoint moves to `active` and starts receiving real deliveries. The body holds the endpoint and its new `version`. | | `409 webhooks_verification_failed` | Your endpoint did not respond 2xx, did not echo the challenge correctly, or could not be reached. Fix your handler and call `/verify` again. You need a fresh challenge from `/reissue-challenge` only after it expires, 15 minutes after it was issued. | | `409 webhooks_endpoint_state_conflict` | The endpoint is not `pending_verification`: it is already `active`, `disabled` or `deleted`. | | `404 webhooks_endpoint_not_found` | Wrong ID or wrong organization. | | `412 version_conflict` | The `If-Match` value is stale. Re-read the endpoint first. | `/verify` is idempotent per `Idempotency-Key`: retry a timed-out call with the same key. ## Events Subscribe with an `event_type` and `schema_version` pair from this table. It is the complete list. Any other pair, such as `payment.received` or `invoice.overdue`, is rejected with `422 validation_webhook_endpoint` when you create the endpoint. | `event_type` | `schema_version` | Sent when | `data` fields | |---|---|---|---| | `invoice.drafted` | 1 | An invoice enters draft | `invoice_id` | | `invoice.issued` | 1 | The tax authority accepts an invoice | `invoice_id`, `fiscal_uuid`, `folio` | | `invoice.fiscal_rejected` | 1 | The tax authority rejects an invoice, or the customer claims it | `invoice_id`, `rejection_reason`, `rejection_source` | | `credit_note.issued` | 1 | The tax authority accepts a credit note | `credit_note_id`, `source_invoice_id`, `fiscal_uuid`, `folio` | | `credit_note.fiscal_rejected` | 1 | The tax authority rejects a credit note | `credit_note_id`, `source_invoice_id`, `rejection_reason` | | `debit_note.issued` | 1 | The tax authority accepts a debit note | `debit_note_id`, `source_invoice_id`, `fiscal_uuid`, `folio` | | `debit_note.fiscal_rejected` | 1 | The tax authority rejects a debit note | `debit_note_id`, `source_invoice_id`, `rejection_reason` | | `message.received` | 1 | A customer email arrives in Relvo: a reply to a Relvo email or a new message | `message_id`, `conversation_id`, `received_at`, `sender_email`, `subject`, `text_preview`, `attachments`, `invoice_ids` | | `invoice.payment_received` | 1 | A payment is applied to an invoice, partially or in full | `invoice_id`, `payment_id`, `amount_paid`, `currency`, `payment_status` | | `invoice.paid` | 1 | An invoice becomes fully paid | `invoice_id`, `total_amount`, `currency`, `paid_at` | | `invoice.voided` | 1 | An accepted credit note voids the whole invoice | `invoice_id`, `credit_note_id` | | `payment.succeeded` | 1 | A payment is confirmed as received | `payment_id`, `customer_id`, `amount`, `currency`, `origin` | | `contract.activated` | 1 | A contract becomes active | `contract_id`, `customer_id` | | `contract.amended` | 1 | An amendment is applied to a contract | `contract_id`, `customer_id` | | `contract.cancelled` | 1 | A contract is cancelled | `contract_id`, `customer_id` | | `customer.created` | 1 | A customer is created | `customer_id` | | `customer.updated` | 1 | A customer's details are edited | `customer_id` | | `customer.deleted` | 1 | A customer is deleted | `customer_id` | `fiscal_uuid`, `folio` and `rejection_reason` are `null` when the tax authority did not provide them. `rejection_source` on `invoice.fiscal_rejected` says who rejected the invoice: `tax_authority`, `customer_claim` (the customer claimed the accepted document, which voids its acceptance) or `imported` (it was already rejected when imported). It is `null` for events sent before 2026-10-27. Amounts are decimal strings, such as `"10.50"`, with an ISO 4217 `currency`. In `invoice.payment_received`, `amount_paid` is the **total paid on the invoice so far**, not the amount of this one payment. `payment_status` is `unpaid`, `partially_paid` or `paid`, and `payment_id` is `null` when the payment was not recorded in Relvo. `credit_note_id` on `invoice.voided` is `null` unless exactly one credit note voided the invoice. `payment.succeeded` describes the payment itself: `amount` is what was received, `customer_id` is `null` until the payment is matched to a customer, and `origin` is `manual`, `bank_transfer`, `point_of_sale` or `payment_provider`. Each time the payment is applied to an invoice, you also get an `invoice.payment_received`. Payment reversals and partial voids don't send an event, and customer events cover customers only, not vendors. ### Delivery body Every delivery has the same envelope. Only `data` changes with the event type: ```json { "id": "019a2b3c-4d5e-7f60-8a1b-2c3d4e5f6a7b", "type": "message.received", "schema_version": 1, "occurred_at": "2026-10-13T14:02:11.000Z", "organization_id": "0190f1e2-d3c4-7b5a-9687-a1b2c3d4e5f6", "data": { "message_id": "019a2b3c-5e6f-7a80-9b1c-2d3e4f5a6b7c", "conversation_id": "019a2b3c-6f70-7b81-8c2d-3e4f5a6b7c8d", "received_at": "2026-10-13T14:02:11.000Z", "sender_email": "ap@customer.cl", "subject": "OC 4512", "text_preview": "Adjunto la orden de compra…", "attachments": [ { "id": "019a2b3c-7081-7c92-9d3e-4f5a6b7c8d9e", "filename": "oc-4512.pdf", "content_type": "application/pdf" } ], "invoice_ids": [] } } ``` - `id` is the event id, the same value as the `Relvo-Event-Id` header. Use it to deduplicate, because a retried or redelivered event keeps its id. - `occurred_at` is UTC ISO-8601 with milliseconds. - `schema_version` is the version you subscribed to. Before this release the field was named `version`. Retries and redeliveries of deliveries created before the rename keep their original body. Until those drain, read `schema_version` and fall back to `version`. ### Delivery guarantees - **At least once.** A delivery is retried until your endpoint answers `2xx`, so the same event can arrive more than once. Deduplicate on the `Relvo-Event-Id` header, which equals the envelope `id` and stays the same across retries and redeliveries. - **Order is not guaranteed.** `invoice.paid` can arrive before `invoice.payment_received`, for example. When order matters, fetch the current state of the resource instead of relying on arrival order. - If your endpoint was down, the [event log](https://app.relvoerp.com/docs/product/guides/webhooks.md#event-log) keeps every event for 30 days. ### Fetching the full resource Payloads name the resource and what happened to it. They never carry line items. To get the rest, call the public API with an API token: | Field in `data` | Endpoint | Token scope | |---|---|---| | `invoice_id`, `source_invoice_id` | `GET /api/v1/public/invoices/{invoice_id}` | `invoices:read` | | `contract_id` | `GET /api/v1/public/contracts/{contract_id}` | `contracts:read` | | `customer_id` | `GET /api/v1/public/customers/{customer_id}` (`404` after `customer.deleted`) | `customers:read` | | `credit_note_id` | `GET /api/v1/public/credit-notes/{credit_note_id}` | `invoices:read` | | `debit_note_id` | `GET /api/v1/public/debit-notes/{debit_note_id}` | `invoices:read` | | `message_id` | `GET /api/v1/public/messages/{message_id}` | `messages:read` | A `message.received` event is sent as soon as the email is saved, before Relvo downloads its body and attachments, so `GET` the message works immediately. The body and attachments appear in that response once Relvo has fetched them. `text_preview` is the email provider's short preview, not the full body. The public API returns attachment metadata (`id`, `filename`, `content_type`) only; the file itself can be downloaded from the Relvo app, not with an API token. ## Event log Every public event is logged for **30 days**, whether or not an endpoint subscribed to it. Use the log to catch up after downtime or to check what you missed. Both calls need a token with the `events:read` scope; webhook scopes are not enough. ```bash curl "https://app.relvoerp.com/api/v1/public/events?type=invoice.paid&delivery_success=false" \ -H "Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx" ``` | Query parameter | Meaning | |---|---| | `type` | Event type. Repeat it to match several. | | `created_at_from`, `created_at_to` | Inclusive RFC 3339 bounds on `created_at`. | | `delivery_success` | `true`: every webhook delivery of the event succeeded. `false`: at least one delivery has not succeeded yet or failed. Events no endpoint subscribed to match neither. | | `limit`, `cursor` | Pass `next_cursor` back as `cursor`, with the same filters. | Results are newest first. Each item is the delivery body plus `created_at`. `GET /api/v1/public/events/{event_id}` fetches one event by its `Relvo-Event-Id`. It returns `404 event_not_found` for an unknown id or an event older than 30 days. ## Verifying delivery signatures Every event delivery is a `POST` carrying these headers (the verification handshake carries the same signature headers, without the two id headers): | Header | Value | |---|---| | `Relvo-Signature` | `v1=` — lowercase hex HMAC-SHA256, 64 characters | | `Relvo-Timestamp` | Unix seconds at which this attempt was signed | | `Relvo-Event-Id` | The event's id; stable across retries and redeliveries, so use it to deduplicate | | `Relvo-Delivery-Id` | This delivery's id | | `Relvo-Webhook-Version` | `v1` | To verify: 1. Read the **raw request body bytes** before any JSON parsing. Re-serializing the parsed JSON changes the bytes and breaks the signature. 2. Build the signed message: `` + `.` + ``. 3. Compute `HMAC-SHA256(key, message)` and hex-encode it. The key is the `signing_secret` string exactly as returned at creation, as UTF-8 bytes: there is no prefix to strip and nothing to base64-decode. 4. Split `Relvo-Signature` on `,` and accept the request if any entry equals `v1=` under a constant-time comparison. There is usually one value. There are several during a [secret rotation](https://app.relvoerp.com/docs/product/guides/webhooks.md#rotating-the-signing-secret). 5. Reject deliveries whose `Relvo-Timestamp` is more than 5 minutes from your clock, to block replays. This is **not** the Svix / Standard Webhooks scheme, even though the header names look similar: there is no `webhook-id` in the signed message, the key is not base64, and the signature is hex, not base64. ```ts import { createHmac, timingSafeEqual } from "node:crypto"; function isValidRelvoSignature(rawBody: Buffer, headers: Headers, secret: string): boolean { const timestamp = headers.get("Relvo-Timestamp") ?? ""; const received = (headers.get("Relvo-Signature") ?? "").split(",").map((s) => s.trim()); if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; const expected = Buffer.from( "v1=" + createHmac("sha256", secret).update(`${timestamp}.`).update(rawBody).digest("hex"), ); // During a secret rotation the header carries one `v1=` per active secret. return received.some( (candidate) => candidate.length === expected.length && timingSafeEqual(Buffer.from(candidate), expected), ); } ``` **Test vector.** Check your implementation against this before you go live (skip the timestamp freshness check for this test): | Input | Value | |---|---| | `signing_secret` | `Zm9vYmFyLWV4YW1wbGUtc2VjcmV0LW5vdC1yZWFs` | | `Relvo-Timestamp` | `1767225600` | | Raw body | `{"id":"evt_example","type":"invoice.issued"}` | | Expected `Relvo-Signature` | `v1=5e60c0036e884bf3a74b9bac82b6566017a74fb482c5b6bdf255938d6f718ed0` | The verification handshake is signed with the same scheme, so a handler that checks signatures on every request exercises its signature code during verification. A handler that skips the check for `relvo.webhook.verify` does not, and can still become `active` while rejecting every real delivery — run the test vector first. ## Responses, retries and failed deliveries | Your response | What Relvo does | |---|---| | `2xx` | Delivered. | | `408`, `429`, `5xx`, timeout or connection error | Retried with backoff (at least 5 seconds, at most 6 hours apart), up to 12 attempts in total. `Retry-After` is honoured within the same bounds. | | Any other status, including `401`/`403` | Failed permanently on that attempt. Not retried. | A delivery that fails permanently (`dead`) is kept, not discarded. List deliveries with `GET /{id}/deliveries`. You can filter by `status`, `event_type`, `created_from` and `created_to`, and repeat `status` or `event_type` to match several values. Once your endpoint is fixed, call `POST /{id}/deliveries/{delivery_id}/redeliver` with an `Idempotency-Key` on a `delivered`, `dead` or `cancelled` delivery. It resends the frozen body unchanged, with the same event `id`. A redelivery is one attempt: if your endpoint fails it again, it is not retried, so fix the endpoint before asking. Relvo does not disable an endpoint because its deliveries fail, so a misconfigured endpoint keeps failing until it is fixed. Events published while an endpoint is disabled are never queued for it. ## Managing subscriptions Update which event types an endpoint receives without recreating it: ``` PUT /api/v1/public/webhook-endpoints/{id}/subscriptions Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx If-Match: W/"3" Content-Type: application/json { "subscriptions": [ { "event_type": "invoice.issued", "schema_version": 1 }, { "event_type": "credit_note.issued", "schema_version": 1 } ] } ``` This replaces the full subscription list — include every event type you still want, not just the ones you're adding. Only the pairs listed in [Events](https://app.relvoerp.com/docs/product/guides/webhooks.md#events) are accepted; anything else, and any pair listed twice, is rejected with `422 validation_webhook_subscriptions`. The response is `200` with the endpoint. Replacing works in every status except `deleted` (`409 webhooks_endpoint_state_conflict`). ## Disabling and deleting - `POST /{id}/disable` pauses an `active` or `pending_verification` endpoint and cancels its queued deliveries. - `POST /{id}/enable` resumes a `disabled` endpoint. If its URL was already verified, it goes back to `active`. Otherwise it goes back to `pending_verification` with a fresh challenge. Deliveries cancelled while it was disabled are not revived, so redeliver any you need. - `DELETE /public/webhook-endpoints/{id}` with `If-Match` deletes an endpoint from any status and cancels its queued deliveries. Retrying the same `DELETE` returns `204` again. The URL can then be registered again as a new endpoint, with a new ID and secret. - Disabled and deleted endpoints stop receiving deliveries immediately. `/verify` on them returns `409 webhooks_endpoint_state_conflict`. ## Rotating the signing secret ```bash curl -X POST "https://app.relvoerp.com/api/v1/public/webhook-endpoints/{id}/rotate-secret" \ -H "Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx" \ -H "Idempotency-Key: $(uuidgen)" \ -H 'If-Match: W/"4"' ``` The response is `200` with the endpoint and a new `signing_secret`. The secret is shown only in this response, and an idempotent replay returns `null`. For the next **24 hours**, every delivery is signed with both the new and the previous secret, so `Relvo-Signature` carries two comma-separated values, such as `v1=,v1=`. Their order is not guaranteed. Your receiver accepts the request when any value matches a secret it holds. Deploy the new secret within those 24 hours, then remove the old one. Retries of deliveries created before the rotation are signed with the new secret as well, so a receiver that has already switched still verifies them. --- # MCP server > Connect an AI agent to Relvo over the Model Context Protocol Source: https://app.relvoerp.com/docs/product/guides/mcp/ Relvo exposes a **Model Context Protocol** server, so an AI agent — Claude Code, your own SDK-based agent, anything that speaks MCP — can investigate invoices, customers, contracts, usage, payments, bank movements and reports, and work your operations task queue, without you writing an API client for it. MCP is built for an agent asking questions. To feed a dashboard, a BI tool or a scheduled script, use the REST API instead: see [Reading data for dashboards](https://app.relvoerp.com/docs/product/guides/mcp.md#reading-data-for-dashboards-use-rest-not-mcp). The boundary is deliberate and worth stating first: - **Financial records are read-only by default.** No tool edits, voids or sends an invoice, a credit note or any other fiscal document, and none of them moves money. Issuing an invoice is possible only through the prepared-issuance workflow. Relvo enables it separately for each organization, and it needs `invoices:write` plus an explicit issuer permission. - **The task queue is writable.** An agent can create tasks and move them through their state machine — assign, start, complete, cancel — in the same queue your team works in the Relvo dashboard. - **Proposal decisions require human approval attested by the connected app.** The `operations:write` scope also permits approve/reject calls. Relvo checks the named operator's membership and role, but cannot independently prove a human clicked an approval button. ## Connect with an API token ```bash claude mcp add --transport http relvo \ https://app.relvoerp.com/api/mcp/ \ --header "Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx" ``` | | | |---|---| | URL | `https://app.relvoerp.com/api/mcp/` — **with the trailing slash** | | Transport | Streamable HTTP | | Auth | API token in `Authorization: Bearer ` | | Organization | Carried by the token. There is no organization parameter or header on this surface | Configure the trailing slash. The bare path `/api/mcp` answers a `307` redirect to `/api/mcp/`; most clients follow it, but some drop the `Authorization` header when they do, which then looks like an auth failure rather than a URL mistake. ## Get an API token Mint an API token in the Relvo dashboard under **Developer Zone** (OWNER or ADMIN members only), exactly as described in [Authentication](https://app.relvoerp.com/docs/product/guides/authentication.md). The plaintext token is shown once, at creation. Issue the **narrowest scope that does the job**. `full_access` is issuable and would hand a model every machine endpoint Relvo has — it is the wrong credential for an MCP client, always. `operations:write` implies `operations:read`; `invoices:read` implies nothing else. For an agent that only investigates, a single `full_read` key covers every reviewed read tool and grants no writes. An agent that must also work the queue needs a second connection with an `operations:write` token, so each connection's blast radius stays legible. ## Connect with OAuth Relvo also supports OAuth 2.1 for remote MCP clients that cannot accept a static API token. Point the client to the MCP URL below; it discovers the authorization server and takes the user through the Relvo consent flow. | | | |---|---| | MCP URL | `https://app.relvoerp.com/api/mcp/` | | Protected-resource discovery | `https://app.relvoerp.com/.well-known/oauth-protected-resource` | | Authorization-server metadata | `https://app.relvoerp.com/.well-known/oauth-authorization-server` | | Issuer | `https://app.relvoerp.com` | | OAuth scopes | The `scopes_supported` list in the metadata above: the business `:read` scopes, plus `invoices:write`, `billing:write`, `contracts:write` and `operations:write`. Add `offline_access` for persistent access | If your connector offers **Dynamic Client Registration**, select it and enter the MCP URL. Relvo advertises `https://app.relvoerp.com/oauth/register`, where the connector registers its own callback and receives a generated client ID. You do not need an API key, client secret, or manually supplied client ID. Then sign in to Relvo, choose your organization, and approve the requested scopes. Self-registered client names are marked **Unverified:** on the consent screen. Connectors may request any of the business scopes listed in `scopes_supported`; request only the ones the agent needs. For persistent access, they register the `refresh_token` grant and request `offline_access`. Access tokens last ten minutes; refresh tokens rotate and each successor lasts 30 days, so working refresh keeps the connection active without repeated login. Manual OAuth configuration remains supported for clients without dynamic registration. Relvo must register that client's exact callback first; use the client ID supplied for that connector, not another connector's ID. Client scope ceilings and organization consent still apply; OAuth never grants `full_access`. ## What the agent can do Tools are grouped by the scope they require. Relvo turns tool families on per organization, so the authoritative list for your connection is what `tools/list` returns. Beyond the tables below, read families cover customers (`customers:read`), contracts (`contracts:read`), catalog and prices (`catalog:read`), taxes (`taxes:read`), FX (`fx:read`), billing schedules (`billing:read`), usage (`usage_events:read`), payment methods (`payment_methods:read`), banking (`banking:read`), reconciliation and unmatched cash (`reconciliation:read`) and reports (`reports:read`). ### `invoices:read` | Tool | Answers | |---|---| | `relvo_invoices_search` | find invoices by text and by lifecycle / fiscal / payment / delivery status and issue-date range | | `relvo_invoice_get` | one invoice in full | | `relvo_invoice_check_open_readiness` | why a draft cannot be opened yet — findings, missing FX rates | | `relvo_invoice_payment_status` | what has been paid against one invoice | ### `operations:read` | Tool | Answers | |---|---| | `relvo_task_search` | find tasks by text, status, kind, priority, assignee, due date | | `relvo_task_get` | one task, including its action proposals | ### `operations:write` — also grants operations reads | Tool | Effect | Destructive | |---|---|---| | `relvo_task_create` | opens a new task, optionally carrying action proposals | no | | `relvo_task_assign` | gives a task to a member, **by email** | no | | `relvo_task_start` | OPEN → IN_PROGRESS | no | | `relvo_task_complete` | OPEN / IN_PROGRESS → COMPLETED | yes | | `relvo_task_cancel` | → CANCELLED | yes | | `relvo_task_proposal_approve` | records the app-attested human approval and starts separate execution | yes | | `relvo_task_proposal_reject` | records rejection with a required reason | yes | Assignment is by email address and never by user id. No tool on this server returns a user, organization or membership id — resolving the email server-side, against the caller's own organization, is the only shape that cannot be used to probe for user ids belonging to another tenant. ## Reading data for dashboards: use REST, not MCP An MCP tool answers one question for one agent turn. Its pages hold at most 50 records, and a model reads every page before it answers. Reading a whole ledger that way takes hours. A dashboard, a BI export or a nightly script should call the [REST API](https://app.relvoerp.com/docs) directly: 1. Issue a key with the [`full_read`](https://app.relvoerp.com/docs/product/guides/authentication.md#read-only-keys-full_read) scope. It reads everything a dashboard needs and can write nothing. 2. Page every list with `?limit=200` and follow `next_cursor` until it is `null`. 3. Stay inside the [rate limits](https://app.relvoerp.com/docs/product/guides/authentication.md#rate-limits): 600 requests per minute per key, about 120,000 records a minute at 200 per page. ```bash curl "https://app.relvoerp.com/api/v1/public/invoices?limit=200" \ -H "Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxx" ``` | Dashboard data | REST resource | Scope | |---|---|---| | Invoices | `GET /invoices` | `invoices:read` | | Usage | `GET /usage-events` | `usage_events:read` | | Customers | `GET /customers` | `customers:read` | | Contracts | `GET /contracts` | `contracts:read` | | MRR and receivables | `GET /reports/mrr`, `GET /reports/receivables-aging/customers` | `reports:read` | | Payments | `GET /payments` | `payments:read` | | Unmatched receipts (*pagos sin identificar*) | `GET /reconciliation/unmatched-receipts`, `/by-counterparty`, `/totals` | `reconciliation:read` | Every path is relative to `https://app.relvoerp.com/api/v1/public`. `full_read` covers every scope in the table. Keep MCP for what it is good at: an agent investigating why one invoice, customer or payment looks wrong. ## Retries are replays, not duplicates MCP has no `Idempotency-Key` header, so Relvo derives one for you from the tool name, the organization and the validated arguments — the same guarantee as [Idempotency](https://app.relvoerp.com/docs/product/guides/idempotency.md) on the REST API, without the bookkeeping. An agent that retries `relvo_task_create` with identical arguments gets **the same task back**, not a second task. When you genuinely mean "again" — the same daily task, a second time — pass a different `request_marker` on the write tool. Without it, a repeat is a replay, which is the safe default. ## Client compatibility The same MCP endpoint supports two credential types: a static API token for header-capable clients, and OAuth 2.1 for remote connectors. Do not copy an API token into a client that supports OAuth; use the consent flow instead. | Client | Works | How | |---|---|---| | Claude Code | ✅ | the `claude mcp add` command above | | Your own agent, any MCP SDK | ✅ | Streamable HTTP plus the `Authorization` header | | `mcp-remote` and similar proxies | ✅ | pass the header through; useful for stdio-only hosts | | Claude remote connectors (claude.ai, Desktop, and mobile) | ✅ | OAuth 2.1 discovery and consent | | ChatGPT custom MCP app (web) | ✅ | OAuth discovery, PKCE, and `offline_access` provide persistent read-only access when the registered client permits it | | ChatGPT mobile | ❌ | ChatGPT custom MCP apps are currently web-only | OAuth access tokens are short-lived. Request `offline_access` only for a client registered to allow it; Relvo then issues rotating refresh tokens. It is a persistence capability, not a data permission, and the consent screen still names the business scopes the client requests. ## When something fails Tool failures come back as **tool errors** — an error flag plus a `{code, message, retryable}` body — rather than protocol errors, so the agent can read the message and act on it. | Code | Cause | |---|---| | `mcp.unauthenticated` | no valid API token or OAuth access token on the request — including a browser session reaching the endpoint, which is rejected on purpose | | `mcp.forbidden` | the token's scope does not cover that tool. The tool never ran | | `mcp.invalid_arguments` | the arguments failed validation | | `mcp.not_found` | the id does not exist **in your organization**. A record belonging to another tenant is indistinguishable from a missing one, deliberately | | `mcp.conflict` | a state guard or a concurrent edit — for example completing a task someone else already cancelled. `retryable` tells you which: reload with `relvo_task_get` and decide | | `mcp.unavailable` | a genuine server-side problem. This is the only one worth retrying blindly | A `307` followed by a `401` is not an auth problem — it is the missing trailing slash, and a client that dropped the header on the redirect. --- # Changelog > Dated changes to the Relvo public API, newest first Source: https://app.relvoerp.com/docs/product/guides/changelog/ Every change to the public API's contract is listed here, newest first. The version on each entry is the `info.version` of the [API Reference](https://app.relvoerp.com/docs) from that date. Within `v1`, changes are additive only: new operations, optional parameters, response fields, enum values and headers. Ignore fields you don't recognize, and handle enum values you don't recognize. Removing, renaming or retyping anything, or newly requiring an input, happens only in a new major version (`/api/v2`), except for the rare break approved and listed explicitly in an entry below. ## Deprecations A deprecated operation keeps working until its sunset date. Every response from it, errors included, carries: | Header | Meaning | |---|---| | `Deprecation` | When the operation was deprecated: `@` followed by Unix seconds ([RFC 9745](https://www.rfc-editor.org/rfc/rfc9745)). | | `Sunset` | When it stops answering, as an HTTP-date ([RFC 8594](https://www.rfc-editor.org/rfc/rfc8594)). | | `Link` | This page's entry for the deprecation, with `rel="deprecation"`. The entry names the replacement. | The API Reference also marks the operation as deprecated. Alert on the `Deprecation` header in your integration so a deprecation never reaches you as an outage. ## 2026-11-17 Version: `1.8.1` - API Reference ETags now describe versioned resources and explicitly documented headers. Lists, reports, totals and immutable processing records no longer advertise a version token they do not return. Quote PDF ETags are documented as document checksums. Request bodies, paths and runtime concurrency behavior are unchanged. - **Approved breaking quote API cleanup:** quote summaries, amendments and credit-grant responses/filters use `contractId` instead of `billingScheduleId`; execution uses `contractAction` instead of `scheduleAction`. Supported HTTP paths are unchanged. Quote detail and execution responses now expose the created or targeted `contractId`. - The deprecated `POST /api/v1/public/quotes/{quote_id}/send-reminders` is removed (404). Use `notify-recipients` with explicit `recipients`. Notification evidence and historical delivery history remain available. Old credit-grant filters return 422; old execution field names return 400. Reused idempotency keys still reject changed intent. - Quote SDK operation names now use resource verbs, including `listQuotes`, `getQuote`, `executeQuote` and `calculateQuoteTotals`. Regenerate SDKs from the API reference. Existing grant issuance, exact monetary values and contract activation rules are unchanged. - Credit reference navigation now separates stable Credit Grants, One-off Credits, and Credit Balances & History. The [credits guide](https://app.relvoerp.com/docs/product/guides/credits.md) documents billing entity selection, invoice drafts, lifecycle differences, and migration from Sequence. - The financial credits API is now available under `/api/v1/public/credits`: create, list and read grants; revoke unused capacity; and read customer balances, immutable ledger movements and customer summaries. It supports both currency and metric credits, with explicit customer `billing_entity_id` selection. - `POST /credits/grants` accepts `create_invoice` and `purchase_invoice` to create a purchase invoice draft atomically with purchased credits. It does not issue a fiscal document. Writes require `Idempotency-Key`; revocation also requires the `If-Match` value returned as `ETag` by a grant detail read. Read and write token scopes are `credits:read` and `credits:write`. - `/api/v1/public/credit-grants` retains its existing stable schedule/customer configuration contract and asynchronous issuance behavior. ## 2026-11-12 Version: `1.6.0` - New `GET /api/v1/public/seat-events/count?contract_id=…&seat_metric_id=…` returns a contract's seat count for one seat metric, using the same rule billing applies. `as_of` (a date) reads the count on that day; it defaults to today in the contract's billing timezone. Read the count back after sending changes instead of keeping your own running total. - Seat prices (`type: seat`) accept `pricing.model` `graduated` and `volume` with tier ranges, as usage prices already do. A `volume` seat price is billed in arrears only. Until tiered seat pricing is enabled, these models return `422`. - `quantity_strategy` on seat prices accepts `time_weighted` (each day's seat count, averaged over the period) and `prorated_additions` (seats added during the period are charged for the days they were active). Both bill in arrears, require the `standard` model and cannot be combined with `prorated`. Until they are enabled, they return `422`; `snapshot_end` stays the default. ## 2026-11-11 Version: `1.5.0` - `POST /api/v1/public/seat-events` accepts a third `change_type`, `set`: the seat count is exactly `count` from `effective_date` (zero allowed), so an integration can send the current total instead of deltas. Changes are ordered by `effective_date`, then `timestamp`; `added`/`removed` changes ordered after a `set` move the count from it, and earlier ones are already part of it. Cancelling a `set` returns to the previous one. `count` now accepts `"0"` for `set` only. Integrations that only send `added`/`removed` are unaffected. Seat events listed or read back can now carry `change_type: set`. ## 2026-11-05 Version: `1.4.0` - Added three read-only operations for money received in your bank accounts that no invoice explains yet (*pagos sin identificar*), all under `reconciliation:read`: `GET /api/v1/public/reconciliation/unmatched-receipts` lists each receipt (newest posting first, filterable by currency, posting dates and payer tax id), `GET /api/v1/public/reconciliation/unmatched-receipts/by-counterparty` sums them per payer tax id and currency, and `GET /api/v1/public/reconciliation/unmatched-receipts/totals` gives the count and sum per currency. All three read the same classification as the reconciliation workspace, so they always agree. A `full_read` key covers them. ## 2026-11-04 Version: `1.3.0` - Added `GET /api/v1/public/sandbox` for a `full_access` key to identify its runtime and bound organization before running sandbox automation. - Hosted sandbox keys are issued with `rk_test_`; existing `rk_live_` keys remain supported. Prefixes never determine authorization or cross-host access. - Hosted sandbox organizations share a request budget across their keys and IPs; exhausted budgets return `429` with `Retry-After` and `RateLimit-*` headers. ## 2026-10-27 Version: `1.2.0` - Webhooks: `invoice.fiscal_rejected` adds `rejection_source`, which says who rejected the invoice: `tax_authority`, `customer_claim` or `imported`. It is `null` on events sent before this release, including when read back from `GET /api/v1/public/events`. ## 2026-10-20 Version: `1.1.0` - Every authenticated response now carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` for whichever limit, per token or per IP, is closest to being reached. A `429` carries them too, alongside `Retry-After`. - Deprecated operations now answer with `Deprecation`, `Sunset` and a `Link` to this changelog, and are marked as deprecated in the API Reference. No operation is deprecated yet. - New operations: `GET /api/v1/public/events` and `GET /api/v1/public/events/{event_id}` (the last 30 days of webhook events, `events:read`); `GET /api/v1/public/payments` and `GET /api/v1/public/payments/{payment_id}` (`payments:read`); `GET /api/v1/public/seat-events` and `GET /api/v1/public/seat-events/{seat_event_id}` (`seat_events:read`); `GET /api/v1/public/imports/contracts/{import_id}`; `PATCH` and `DELETE /api/v1/public/catalog/seat-metrics/{seat_metric_id}`. - Webhooks: the contract, customer, invoice and payment events are documented with closed payload schemas. Delivery is at least once and unordered; deduplicate on the event `id`. Rotating a signing secret signs with both secrets for 24 hours. - `Idempotency-Key` is required on `POST` only. `PATCH`, `PUT` and `DELETE` are made safe to retry by `If-Match` and no longer ask for the header. - Paginated search (`query`) resumes exactly where the previous page ended, without repeating or skipping results. A cursor used with a different `query` or filters returns `400 invalid_cursor`. - `GET /api/v1/public/customers`, `/contracts`, `/invoices` and `/customers/{customer_id}/billing-entities` filter by metadata: `metadata[]=` matches exactly, and several keys must all match. - Breaking, approved without a deprecation window: - Receivables-aging bucket keys are now `no_due_date`, `not_due`, `days_0_30`, `days_31_60`, `days_61_90` and `days_90_plus`, and an aging invoice's `folio` is now `fiscal_number`. - A billable metric's `sql_expression` is `null` unless the token has `billable_metrics:sql` (or `full_access`). `contracts_count` and `plans_count` are no longer returned. ## 2026-10-16 Version: `1.0.0` - Public API v1: a dedicated `/api/v1/public` surface with uniform conventions. Lists use cursor pagination (`{items, next_cursor}`) and money is a decimal string. Writes take `Idempotency-Key`, edits take `If-Match`, and errors share one envelope with a stable code catalogue. --- # Customers and items > Model who you sell to, which tax identity you invoice them under and what you sell them. Source: https://app.relvoerp.com/docs/product/en/customers-catalog/ ## Customers A customer is the company you have a commercial relationship with. It is the party you talk to: it has a name, a contact, a history. It is not necessarily the entity you issue the document to. Relvo separates three things that a spreadsheet usually collapses into a single column: | Piece | What it is | Example | | --- | --- | --- | | **Customer** | The commercial relationship | Acme AI | | **Billing account** | The legal and tax identity that receives the document | Acme AI SpA, RUT (Chilean tax ID) 76.123.456-7 | | **Billing link** | The terms under which you invoice that identity | 30 days, subject to VAT (IVA), domestic invoice | > **Key rule: A customer can invoice more than one identity** > > A single customer can have several billing accounts—subsidiaries, countries, cost centers—and each link carries its own terms. That is why payment terms and tax treatment live on the link, not on the customer: changing them for one subsidiary does not affect the others. ### Billing accounts The billing account brings together the legal name, tax ID, line of business (*giro*), default currency, time zone and address that Relvo uses when issuing documents. Set it up before enabling invoicing for that customer. The same structure serves both ends of the document: there are billing accounts with the **issuer** role—your own legal identities, one per country or line of business—and with the **customer** role. > **Caution: Not everything you see was created by you** > > When syncing documents from the SII (Chile's tax authority), Relvo creates any missing billing account so it can record the document without losing it. Those accounts are flagged as **automatically created**, as opposed to **verified by a person**. Review and merge them before treating them as curated customers: it is the difference between a customer and a RUT that showed up on a bank statement. ### Link terms | Term | What it determines | | --- | --- | | **Payment terms** | The due date of each invoice, and with it the entire overdue axis. | | **Tax treatment** | Taxable, exempt or reverse charge (*cambio de sujeto*). | | **Default document** | Domestic invoice, receipt (*boleta*) or export invoice. | | **Status** | Active, suspended or archived — suspending stops invoicing without erasing the history. | A one-off invoice can force export treatment at issuance; otherwise, the document follows what the link says. ### Contacts Contacts hang off the billing link, not the customer, and each one has one or more **roles**: | Role | What it receives | | --- | --- | | **Billing** | Issued invoices and credit notes | | **Collections** | Payment reminders | | **Commercial reference** | Requests for purchase orders (OC, *orden de compra*) and service acceptance sheets (HES) | | **XML email** | Only the document's XML, for accounting systems | There is one default contact per role within each link. A single contact can have several roles, and its identity is preserved even if its email changes: if an address bounces and is replaced, no new person appears in the operation. ## Items An item represents a product or service you sell: a platform, conversations, an implementation. It is the commercial basis on which a contract's charges are defined, and what is described on the invoice line. An item does **not** carry a price. The price lives on the contract charge, because the same service can cost different amounts in two contracts, and the 2024 price must not be rewritten when you change the 2026 price list. **Example: One item, two contracts** | Contract | Item | Charge | | --- | --- | --- | | Acme AI | Conversations | Usage-based, tiered: 1,000 included, then USD 0.10 | | Globex | Conversations | Usage-based, flat rate USD 0.08 | Items are deactivated rather than deleted: documents already issued keep pointing to the item they were issued with. ## API | Resource | Endpoint | Scopes | | --- | --- | --- | | Customers and billing entities | `/api/v1/public/customers` | `customers:read` · `customers:write` | | Taxpayer lookup (Chile) | `GET /api/v1/public/integrations/chile/taxpayers/lookup` | `customers:read` | | Payment methods | `/api/v1/public/customers/{customer_id}/payment-methods` | `payment_methods:read` · `payment_methods:write` | | Items | `/api/v1/public/catalog/items` | `catalog:read` · `catalog:write` | | Billable metrics | `/api/v1/public/catalog/billable-metrics` | `catalog:read` · `catalog:write` | Every `POST` requires `Idempotency-Key`. `PATCH` and `DELETE` also require `If-Match`. Lists return `{items, next_cursor}` and accept `query`, `limit` and `cursor`. - [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): The pricing models a charge on an item can use. - [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): Where the customer, the item and the price come together. --- # Contracts and phases > How Relvo records commercial terms, how they change over time, and why a closed period is never rewritten. Source: https://app.relvoerp.com/docs/product/en/contracts/ The contract is Relvo's central object. It ties a customer to the charges they will be billed, under which conditions and for what term. Everything that gets billed has a contract behind it. ## What a contract contains | Element | What it defines | | --- | --- | | Customer | Who is invoiced | | Term | When the agreement starts and ends | | Currency | The currency amounts are expressed in | | Billing anchor | The date from which periods run | | Phases | The terms in force during each segment of the contract term | | Charges | Fixed, usage, seat-based and one-time | | Adjustments | Discounts, minimums and caps | | Payment terms | The time from issuance to due date | | Commercial references | Purchase order (OC, *orden de compra*), service acceptance sheet (HES, *hoja de entrada de servicio*) or other evidence required before issuing | | Invoicing route | How charges are grouped into documents and lines | | FX policy | How the exchange rate is determined | ## Statuses **Lifecycle:** DRAFT → UPCOMING → ACTIVE → PAUSED → COMPLETED | Status | Meaning | | --- | --- | | `DRAFT` | Being prepared. Generates no charges | | `UPCOMING` | Activated but not yet in force. Applies only to contracts with a future start date | | `ACTIVE` | In force. Generates charges every period | | `PAUSED` | In force but temporarily suspended | | `COMPLETED` | Term has ended | | `AMENDED` | Superseded by a later version. Kept as history | | `CANCELLED` | Terminated before the end of its term | An `AMENDED` contract is neither deleted nor edited: it remains the record of what was agreed during that period. That is what lets you explain, months later, why an old invoice charged what it charged. ## Phases A **phase** is a segment of the contract term during which the terms do not change. A single-price contract has one phase; a ramp deal has several. **Example: Three-phase ramp deal** | Phase | Term | Platform | Price per conversation | | --- | --- | --- | --- | | 1 | Jan–Apr 2026 | USD 500 | USD 0.12 | | 2 | May–Aug 2026 | USD 1,000 | USD 0.10 | | 3 | Sep–Dec 2026 | USD 1,500 | USD 0.08 | All three phases are defined from day one. Relvo applies the right one to each period without anyone having to remember to change the price in May. A contract's phases are contiguous by construction: there are no gaps or overlaps in the timeline. Every day of the term belongs to exactly one phase. ## Pausing and resuming When you pause a contract, you decide what happens to usage during the paused period: | Behavior | Effect | | --- | --- | | `bill_through_pause` | The period is billed anyway, as if there were no pause | | `hold_unbilled` | Usage is held without being billed | And when you resume, what happens to the cycle: | Anchor on resume | Effect | | --- | --- | | `unchanged` | The cycle keeps its original anchor | | `resume_date` | The cycle is re-anchored to the resume date | These are separate commercial decisions and are declared separately: pausing the service does not automatically shift the billing dates. ## Amendments An amendment changes the contract's terms **going forward**. It preserves the previous contract as history and creates the version in force from the effective date. > **Caution: An amendment does not rewrite an already-invoiced period** > > If you need to change the amount of a period that has already been invoiced, an amendment is not the tool: finalized periods are immutable. The difference is settled with a [credit or debit note](https://app.relvoerp.com/docs/product/en/credit-debit-notes.md), which leaves an explicit fiscal trail of the correction. An amendment whose effective date falls mid-period splits that period: the earlier portion is charged under the old terms and the later portion under the new ones. Both portions end up on the same invoice. ## Invoicing route By default, all of a contract's charges produce one invoice. The **invoicing route** lets you explicitly declare something else: - **Several invoices** from the same contract — for example, one per customer cost center — each identified by its own key. - **Group several charges into a single invoice line**, with the name the customer expects to see, instead of exposing the contract's internal structure. The limits are 50 invoices per route, 200 lines per invoice and 50 charges per line. The rule Relvo enforces is one of coverage: **every charge in the phase is routed exactly once**. There are no orphaned charges silently left unbilled, and no charges duplicated across two documents. ## Currency and FX The contract declares its currency. When the contract currency is not the document's issuance currency, the FX policy determines the exchange rate: | Policy | Effect | | --- | --- | | `not_required` | No conversion is needed | | `official_issue_date` | The official exchange rate for the issue date is used | Every exchange rate applied is recorded with its date, so reprinting an old invoice reproduces its original amounts, not today's. ## API | Operation | Endpoint | | --- | --- | | Create / list | `POST` · `GET /api/v1/public/contracts` | | Retrieve | `GET /api/v1/public/contracts/{contract_id}` | | Amend (partial) | `PATCH /api/v1/public/contracts/{contract_id}` | | Activate | `POST /api/v1/public/contracts/{contract_id}/activate` | | Pause / resume | `POST /api/v1/public/contracts/{contract_id}/pause` · `/resume` | | Cancel / reinstate | `POST /api/v1/public/contracts/{contract_id}/cancel` · `/reinstate` | | Start / complete a milestone | `POST /api/v1/public/contracts/{contract_id}/phases/{phase_id}/start` · `/complete` | | Comments | `GET` · `PUT /api/v1/public/contracts/{contract_id}/comments` | | Documents | `GET` · `POST /api/v1/public/contracts/{contract_id}/documents`, `GET …/documents/{document_id}` | | Amendment reconciliation | `GET /api/v1/public/contracts/amendment-reconciliations/{reconciliation_id}` | Status transitions are dedicated, named endpoints, not a generic `PATCH` of a `status` field. Each transition validates its own rules. `PATCH` is a partial amendment: it changes only the fields you send. Every contract returns its `id` and its `version` (also in the `ETag` header). Every write to an existing contract (`PATCH`, `PUT` on comments and all transitions) requires `If-Match: W/""`. If it is missing, the response is `428 precondition_required`. If the version is stale, it is `412 version_conflict`. Every `POST` and every `PATCH` also requires an `Idempotency-Key`. Lists return `{items, next_cursor}`. - [Discounts, minimums and caps](https://app.relvoerp.com/docs/product/en/commitments-discounts.md): The adjustments a contract can apply to its charges. - [Billing periods and cadence](https://app.relvoerp.com/docs/product/en/billing-schedules.md): How a contract's periods are determined. - [OC, HES and approvals](https://app.relvoerp.com/docs/product/en/approvals-commercial-references.md): The commercial evidence a contract can require before issuing. - [From contract to payment](https://app.relvoerp.com/docs/product/en/contract-to-payment.md): The full journey of a real contract. --- # Billing periods and cadence > When Relvo evaluates a contract, which period each charge belongs to and why period identity is deterministic. Source: https://app.relvoerp.com/docs/product/en/billing-schedules/ Two separate questions determine when a contract is billed: 1. **How often?** → the **interval**, which is a property of each charge. 2. **Starting from which date?** → the **anchor**, which is a property of the contract. Keeping them separate is what lets a single contract have a monthly platform fee and an annual license without the periods falling out of alignment. ## Intervals Each charge declares its billing interval: | Interval | Frequency | | --- | --- | | `ONE_TIME` | Once, with no recurrence | | `WEEKLY` | Weekly | | `MONTHLY` | Monthly | | `QUARTERLY` | Quarterly | | `SEMIANNUAL` | Semiannual | | `YEARLY` | Yearly | ## The contract anchor The anchor is declared as three explicit fields: **day**, **month** and **year**. | Field | Range | What it determines | | --- | --- | --- | | `day` | 1–31 | The day of the month on which the cycle cuts over. With no value, it cuts over on the 1st | | `month` | 1–12 | The reference month for cadences longer than one month | | `year` | year | The reference year from which the anchored cycle is projected | ### Day 31 does not drift An anchor on the 31st adjusts to the actual last day of each month: January 31 → February 28 (or 29) → March 31. **It does not drag the cutover to the 28th in the following months.** A contract anchored to month-end stays anchored to month-end all year. > **Key rule: Month and year go together, or not at all** > > `month` and `year` are either both declared or neither is. > > - **Both declared** → *anchored* cycle: the cycle is pinned to a negotiated `(year, month, day)` date, which must be a real calendar date. If `month` is declared, `day` is also required. > - **Neither declared** → *calendar* cycle: aligned to the natural calendar (January/April/July/October for quarterly, January for yearly), with `day` as an optional cutover. **Example: Anchored quarterly vs. calendar quarterly** | Configuration | Periods it produces | | --- | --- | | `QUARTERLY`, no `month` | Jan–Mar · Apr–Jun · Jul–Sep · Oct–Dec | | `QUARTERLY`, `month = 2`, `day = 15`, `year = 2026` | Feb 15–May 14 · May 15–Aug 14 · Aug 15–Nov 14 · … | The second case is a contract negotiated on February 15 whose customer expects the cycle to respect that date, not the fiscal calendar. ## One anchor per contract There is **only one anchor per contract**. What varies per charge is the interval, not the cutover date. > **Caution: Do not configure a different anchor per charge** > > Even though a charge can carry its own anchor configuration, the effective period identity is resolved from the contract's default anchor. Two charges on the same contract with the same interval **always** share the same period boundaries. If you truly need different cutover dates, that is a second contract, not a second anchor. ## Period identity Interval and anchor together form a charge's **period identity**. Two charges with the same identity produce exactly the same period boundaries, which is why they can be grouped into the same calculation and the same invoice. That identity is derived from the configuration, not from the moment the process runs: a billing cycle can be rerun tomorrow, next week or during an audit, and it produces the same period. ## In advance and in arrears within the same period The interval defines the window; `pay_in_advance` defines which end of that window the charge is billed at. A typical monthly contract bills the platform fee when the period opens and usage when it closes, and both amounts end up on the same invoice. ## Changing the cadence The cadence of a period that has already closed is not modified. A change of interval or anchor is a change to future terms, and it is recorded as an **amendment** with an effective date. See [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md). - [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): How terms change over time without rewriting the past. - [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): What is billed in each period the cadence defines. - [Charge calculations, pre-invoices and invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md): What happens when the period closes. --- # Charges and pricing > How Relvo turns commercial terms and measured quantities into a billable amount. Source: https://app.relvoerp.com/docs/product/en/pricing/ A **charge** is the smallest unit of billing in Relvo: it defines what is charged, with which pricing model and at what cadence. A contract does not have "a price": it has a list of charges, and each one is evaluated separately every period. ## The three charge types | Type | When it is charged | Depends on usage | Example | | --- | --- | --- | --- | | **Fixed charge** | Every period, while the phase is active | No | Platform USD 1,000 / month | | **Usage charge** | Every period, on the measured quantity | Yes | AI conversations at USD 0.10 | | **One-time charge** | Once | No | Implementation USD 5,000 | A seat-based charge is a special case of a fixed charge: the quantity is not entered by hand but resolved from a **seat metric**. See [Seat-based charges](https://app.relvoerp.com/docs/product/en/seat-based-charges.md). ## Pricing models Relvo offers six models. **Not every charge type supports all six**: | Model | Usage charges | Fixed charges | What it does | | --- | :---: | :---: | --- | | `standard` | ✅ | ✅ | Unit price times quantity | | `graduated` | ✅ | ✅ | Each tier charges its own price, only for the units that fall within it | | `volume` | ✅ | ✅ | The tier reached sets a single price that applies to the **entire** quantity | | `package` | ✅ | — | Charges per full package of N units | | `percentage` | ✅ | — | A percentage of each event's value | | `graduated_percentage` | ✅ | — | Tiered percentage on the accumulated value | > **Key rule: Fixed charges support only three models** > > A fixed charge can use `standard`, `graduated` or `volume`. `package`, `percentage` and `graduated_percentage` require usage events with an associated value, which a fixed charge does not have. If you need to charge a percentage of GMV, that is a usage charge, not a fixed charge. ### Standard The simplest model: a unit price applied to each billable unit. ``` amount = unit_price × max(quantity − free_units, 0) ``` Free units are subtracted **before** the price is applied, not after. 1,200 units with 200 free at a price of 0.05 charge 1,000 × 0.05 = 50, not 1,200 × 0.05 with a discount on top. ### Graduated (tiered) Each tier has its own unit price and, optionally, a flat amount (`flat_amount`) that is charged only if the tier received at least one unit. Units are distributed across tiers, and each portion is charged at its own price. ``` amount = Σ tiers ( units_in_tier × tier_price + tier_flat_amount ) ``` **Example: 8,420 conversations with tiers** | Tier | From | To | Unit price | Units | Subtotal | | --- | --- | --- | --- | --- | --- | | 1 | 0 | 1,000 | USD 0.00 | 1,000 | USD 0.00 | | 2 | 1,001 | 5,000 | USD 0.10 | 4,000 | USD 400.00 | | 3 | 5,001 | ∞ | USD 0.07 | 3,420 | USD 239.40 | | | | | | **8,420** | **USD 639.40** | ### Volume The total quantity determines **one** tier, and that tier's price applies to every unit. It is the "buy more and everything gets cheaper" model. ``` tier = the tier that contains the total quantity amount = billable_units × tier_price + tier_flat_amount ``` **Example: The same quantity, with volume instead of graduated** With the same three tiers, all 8,420 conversations fall into tier 3: ``` 8,420 × USD 0.07 = USD 589.40 ``` Compared with USD 639.40 under `graduated`. **The same tiers produce different amounts depending on the model.** Choosing one or the other is a commercial decision, not a configuration detail. ### Package An amount is charged for each package of N units. A started package is charged in full. ``` amount = package_amount × ceil( billable_units / package_size ) ``` If the charge defines an overage price (`overage_unit_amount`), the behavior changes: one base package is charged and the excess is charged per unit. ``` amount = package_amount + max( billable_units − package_size, 0 ) × overage_price ``` ### Percentage and graduated percentage These charge a percentage of each event's **value**, not its quantity. They are used for commissions on GMV, processed transactions or traded volume. ``` amount_per_event = event_value × rate / 100 + flat_amount_per_event ``` They support three additional controls: | Property | Effect | | --- | --- | | `free_units_per_events` | The first N events of the period are not charged | | `free_units_per_total_aggregation` | The first band of accumulated value is not charged | | `per_transaction_min_amount` / `per_transaction_max_amount` | Floor and ceiling applied **to each event**, not to the period total | > **Key rule: Percentage needs a calculation base** > > A metric with `LATEST` aggregation returns a point-in-time value—the last observed data point—not a base on which to calculate a percentage. Relvo blocks the combination instead of calculating a meaningless amount. See [Usage and billable metrics](https://app.relvoerp.com/docs/product/en/usage-billing.md). ## Proration When a phase starts or ends mid-period, a charge marked as proratable charges the fraction of the period that was actually in effect. A non-proratable charge bills the full amount even when the window is partial. It is a property of the charge, not of the contract: in the same period you can have the platform prorated and an annual license charged in full. ## In advance and in arrears Each charge declares whether it is billed **in advance** (`pay_in_advance`) or **in arrears**. It is a per-charge property, not a property of the whole contract: - **In arrears** — billed when the period closes, once usage is known. This is the norm for usage charges. - **In advance** — billed when the period opens. It only makes sense for amounts known beforehand. A typical monthly contract combines both: platform in advance, usage in arrears, both on the same invoice. ## Calculation order Discounts, minimums and caps are not applied in arbitrary order. Relvo always evaluates: ``` 1. Usage aggregation 2. USAGE discounts → reduce the quantity 3. Pricing model → adjusted quantity to amount 4. AMOUNT and % discounts → reduce the subtotal 5. Minimums → true-up if the subtotal fell below the floor 6. Caps → trimmed if the subtotal exceeded the ceiling 7. Taxes → on the already adjusted subtotal ``` The detail of each step, with numerical examples, is in [Discounts, minimums and caps](https://app.relvoerp.com/docs/product/en/commitments-discounts.md). ## API Prices are managed at `/api/v1/public/prices` (scopes `charging:read` and `charging:write`): `GET` and `POST` on the collection, and `GET`, `PATCH` and `DELETE` on `/prices/{price_id}`. `PATCH` and `DELETE` require `If-Match`. `POST /prices/formula/preview` evaluates a formula without saving it. Each price declares its type in `type` (`fixed`, `usage` or `seat`) and its model in `pricing.model`. `fixed` and `seat` prices always use `standard`. All amounts travel as decimal strings. ```json { "type": "usage", "currency": "USD", "interval": "monthly", "status": "active", "billable_metric_id": "…", "pricing": { "model": "graduated", "tiers": [ { "from": 0, "up_to": 1000, "unit_amount": "0.10", "flat_amount": "0" }, { "from": 1000, "up_to": null, "unit_amount": "0.05", "flat_amount": "0" } ] } } ``` A `{from, up_to}` tier covers quantities `from < q ≤ up_to`. The first tier starts at `0` (or at `free_units`), each tier starts where the previous one ended, and only the last one can be left open (`up_to: null`). The list accepts the filters `type`, `status`, `query` and `updated_since`, and returns `{items, next_cursor}`. - [Discounts, minimums and caps](https://app.relvoerp.com/docs/product/en/commitments-discounts.md): How adjustments stack and what base tax is calculated on. - [Usage and billable metrics](https://app.relvoerp.com/docs/product/en/usage-billing.md): Where the quantity consumed by the pricing model comes from. - [Billing periods and cadence](https://app.relvoerp.com/docs/product/en/billing-schedules.md): When each charge is evaluated and which period it belongs to. - [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): How charges are grouped and how they change over time. --- # Seat-based charges > Charge for active users, licenses or seats without reporting usage by hand. Source: https://app.relvoerp.com/docs/product/en/seat-based-charges/ A seat-based charge bills a unit price for a quantity that Relvo **resolves on its own** at invoicing time, from the additions and removals recorded during the period. It is the right fit for active users, licenses, seats or workspaces: nobody has to remember to update the quantity every month. ## The three pieces | Piece | What it is | Where it lives | | --- | --- | --- | | Seat metric | The kind of seat being counted: *Admin*, *Editor*, *Viewer* | Defined **inside a contract** | | Seat event | An addition or a removal, with its effective date | Entered via API, manually or by CSV | | Seat-based charge | The unit price and its cadence | One more charge in a phase | > **Key rule: The seat metric belongs to the contract** > > Unlike a usage billable metric, which is a reusable catalog object, a seat metric is defined inside a contract and its code is unique there. Acme's seats are never counted together with another customer's. ## Seat events Each event declares a change type, a count and an **effective date**: the day the change starts to apply commercially, which need not be the day it was recorded. | Type | Meaning | Count | | --- | --- | --- | | `added` | Seats were added | Positive | | `removed` | Seats were removed | Positive | | `set` | From the effective date there are **exactly** this many | Zero or positive | `set` is useful when your system knows the current total of seats but not the detail of additions and removals: you send the snapshot and Relvo does not need to rebuild it by summing movements. A `set` also corrects a history of deltas that got out of order, without cancelling events one by one. Events are immutable and carry an idempotency key: resending the same addition does not duplicate seats. If an event was a mistake, it is **cancelled**; it is not edited. ## How the quantity is resolved The available strategy is **snapshot at period end** (`snapshot_end`): ``` seats = (additions effective ≤ period end) − (removals effective ≤ period end) ``` There is no period-start filter: the contract's entire history up to the cutoff date is counted. A seat added in March still counts in August without being re-declared. The cutoff date depends on when the charge is billed. **In arrears**, it is the period's last day. **In advance**, it is the period's **first** day: the invoice is issued before the period is consumed, so it bills the seats in force when the period starts, and an addition or removal during the period reaches the next period's invoice. The same day is used every time a draft is recalculated, so a recompute never changes the advance seat count. When there are `set` events, the count starts from the latest effective `set`: ``` seats = (count of the latest set effective ≤ period end) + (additions after that set) − (removals after that set) ``` Events are ordered by effective date and, within the same day, by `timestamp`. Without any `set`, the result is exactly the previous formula. | Situation | Result | | --- | --- | | Addition effective **before** a `set` (even if recorded later) | Already included in the `set`: it does not add | | Two `set` events | The one with the most recent effective date wins | | A `set` is cancelled | The previous `set` (or zero) applies again, plus the movements after it | | `set` to zero | Releases all seats; the charge's minimum quantity still applies | > **Caution: The snapshot is billed, not the average** > > A seat that existed for twenty days and was removed before period end is **not billed** in that period under this strategy. If your contract needs to bill seats by time held, that is not a seat-based charge: it is usage, and it is modeled with a [billable metric](https://app.relvoerp.com/docs/product/en/usage-billing.md). ## Charge configuration | Option | Rule | | --- | --- | | Pricing model | Always standard: unit price × resolved seats | | Cadence | Any recurring interval. **Never** a one-time charge | | In advance / in arrears | In advance by default | | Minimum quantity | Integer ≥ 1, optional. That floor is billed even if there are fewer seats | | Proration | Optional, **incompatible with billing in advance** | > **Caution: Proration and in-advance billing do not mix** > > Prorating means billing a share of a period that has already elapsed; billing in advance means billing a period that has not happened yet. Relvo rejects the combination when the charge is created, instead of letting it produce an ambiguous amount on the first invoice. **Example: Acme, Admin licenses** Charge: USD 20 per *Admin* seat, monthly, in advance, minimum 5. | Effective date | Event | Running total | | --- | --- | ---: | | Mar 1 | +3 Admin | 3 | | Apr 12 | +4 Admin | 7 | | May 20 | −2 Admin | 5 | | May 28 | +1 Admin | 6 | May is billed in advance with the seats in force on May 1: 7 × USD 20 = **USD 140.00**. The May 20 and May 28 changes reach June: 6 × USD 20 = USD 120.00. In March there were 3 seats, below the minimum of 5: 5 × USD 20 = USD 100.00 is billed. ## When not to use seats - **The customer pays for actual usage, not for available seats** → usage billable metric. - **The quantity is fixed and negotiated in the contract** → fixed charge with an authorized quantity, no metric. - **Additions and removals must be billed prorated by the day** → usage with time-based aggregation. ## API Seat metrics are created and listed at `/api/v1/public/catalog/seat-metrics`. Movements are sent in batches to `POST /api/v1/public/seat-events`, 1 to 500 per call, with the `seat_events:write` scope. Ingestion is synchronous and responds `200`. | Field | Description | | --- | --- | | `contract_id`, `seat_metric_id` | Contract and seat metric | | `change_type` | `added`, `removed` or `set` | | `count` | Count as an integer string: positive for `added`/`removed`, zero or positive for `set` | | `effective_date` | Date from which the change applies | | `timestamp` | Moment of the movement. More than 24 hours in the future is rejected | | `idempotency_key` | Unique key for the movement. There is no `Idempotency-Key` header | The response separates `ingested_idempotency_keys`, `duplicate_idempotency_keys` and `validation_failed`. - [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): Fixed, usage and one-time charges. - [Usage and billable metrics](https://app.relvoerp.com/docs/product/en/usage-billing.md): When what you bill is usage, not seats. - [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): Where the seat metric lives. --- # Discounts, minimums and caps > The adjustments that modify a charge calculation, the exact order in which they apply and the base on which tax is calculated. Source: https://app.relvoerp.com/docs/product/en/commitments-discounts/ A contract rarely bills list price. Relvo has three adjustments, and the result depends on the order in which they apply — which is why that order is fixed and not configurable. ## Calculation order ``` 1. Usage aggregation 2. Usage discount → reduces the QUANTITY 3. Pricing model → adjusted quantity to AMOUNT 4. Amount or % discount → reduces the SUBTOTAL 5. Minimum → true-up if the subtotal fell below the floor 6. Cap → trim if the subtotal exceeded the ceiling 7. Taxes → on the already-adjusted subtotal ``` > **Key rule: All adjustments are pre-tax** > > Discounts, minimums and caps operate on the subtotal before taxes. Tax is calculated on the **already-adjusted** subtotal, never on the original amount. > > With a USD 1,000 charge, a USD 100 discount and 19% VAT (IVA): subtotal USD 900 → VAT USD 171 → total USD 1,071. **Not** USD 1,000 − 100 + VAT on 1,000. ## Discounts | Type | What it acts on | When it applies | Scope | | --- | --- | --- | --- | | **Usage** | The measured quantity | Before pricing | Exactly one charge | | **Amount** | The subtotal | After pricing | One or more charges | | **Percentage** | The subtotal | After pricing | One or more charges | ### Usage discount Reduces the billable units before the pricing model sees them. With 100 calls and a discount of 10, 90 are billed — and those 90 run through the pricing tiers as usual. It is the right tool for promotional free units or for absorbing usage that has already been committed. ### Amount discount Subtracts a fixed amount from the subtotal. **It never makes the charge negative**: the discount is limited to the charge amount. A USD 500 discount on a USD 300 charge reduces it to zero, not to −200. ### Percentage discount Reduces the subtotal by a proportion. 10% off USD 1,000 leaves USD 900. > **Key rule: One discount per charge, per phase** > > A given charge does not stack two discounts in the same phase. If the commercial agreement combines several, express it as the resulting net discount. Relvo rejects the ambiguous configuration instead of deciding for you in what order to stack them. > **Shortcut: A usage discount is not the same as free units** > > Free units (`free_units`) are part of the **charge** definition and are always deducted. A usage discount is a **contract** adjustment, negotiated with a specific customer and visible as such. Commercially they are different things, and keeping them separate lets you answer "how much did we discount this customer?" without taking the pricing apart. ## Minimums A minimum guarantees a billing floor. If the period's charges fall below that floor, a **true-up** for the difference is added. ``` true_up = max( minimum_amount − billed_amount, 0 ) ``` The minimum applies to the set of charges it covers — not charge by charge — and is evaluated in each period of those charges. **Example: A slow month under a minimum commitment** Monthly minimum of USD 1,000. The customer used USD 620 and has a 10% discount on usage. | Step | Amount | | --- | --- | | Priced usage | USD 620.00 | | 10% discount | − USD 62.00 | | Subtotal before minimum | USD 558.00 | | True-up to the minimum | + USD 442.00 | | **Billable subtotal** | **USD 1,000.00** | | VAT 19% | USD 190.00 | | **Total** | **USD 1,190.00** | The true-up comes in **after** the discount. If it came in before, the discount would eat into the committed floor and the minimum would protect nothing. The true-up can be shown as a separate line on the invoice or consolidated into the charge. It is a presentation decision: the invoiced amount is the same. Showing it separately is usually preferable, because the customer sees why their invoice does not match their usage. ## Caps A cap limits the amount for a period. If the charges exceed the ceiling, the ceiling is billed. ``` billable = min( billed_amount, maximum_amount ) ``` The excess **does not carry over** to the next period: it is discarded. That is what makes the cap a real protection for the customer rather than a deferral of the charge. > **Key rule: The cap can never be lower than the minimum** > > Relvo validates that `cap ≥ minimum` when the phase is saved. A contract with a USD 1,000 floor and a USD 800 ceiling describes no possible agreement, and it is rejected at configuration time instead of producing unpredictable amounts at invoicing. **Example: Minimum and cap on the same charge** Minimum USD 500, cap USD 1,000. | Priced usage | After the minimum | After the cap | Billed | | --- | --- | --- | --- | | USD 300 | USD 500 (true-up +200) | USD 500 | **USD 500** | | USD 700 | USD 700 | USD 700 | **USD 700** | | USD 1,500 | USD 1,500 | USD 1,000 (−500) | **USD 1,000** | ## Revenue impact The amount recognized is the pre-tax billable amount: a minimum's true-up is recognized as revenue in the same period, and the excess trimmed by a cap does not exist as revenue. - [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): The six pricing models and their formulas. - [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): Where adjustments live and how they change between phases. - [Reporting and metrics](https://app.relvoerp.com/docs/product/en/reporting.md): How adjustments show up in revenue analysis. --- # POs, HES and approvals > Gather the commercial evidence the customer requires before an invoice exists. Source: https://app.relvoerp.com/docs/product/en/approvals-commercial-references/ Many corporate customers will not pay an invoice that does not cite their purchase order (OC, *orden de compra*). In that world, issuing first and asking for the PO afterwards is the fastest way to end up with an unpaid invoice and a credit note ahead of you. Relvo reverses the order: the **commercial reference** is requested from the charge calculation, before issuance, and until it arrives the charge calculation is visibly blocked. > **Key rule: Request the PO from the charge calculation, not from the invoice** > > The request goes out tied to the customer, the period and the charge calculation that requires it. When the customer replies, the reference already knows which future document it belongs to: nobody has to match a loose PDF to an invoice by hand. ## Reference types A commercial reference can be the buyer's document that authorizes the spend, or a prior tax document that the new document must cite. | Reference | Typical use | SII code | | --- | --- | --- | | Purchase order (OC) | Customer's purchase authorization | 801 | | Order note (*nota de pedido*) | Formal order prior to the PO | 802 | | HES | Service acceptance sheet | *alphanumeric* | | Invoice | Document being corrected or continued | 33 · 34 (exempt) | | Credit note | Prior correction being cited | 61 | | Debit note | Prior correction being cited | 56 | | Dispatch guide (*guía de despacho*) | Associated delivery | 52 | | Export invoice | Export transaction | 110 | > **Caution: HES is the alphanumeric exception** > > Every reference type is declared to the SII (Chile's tax authority) with a numeric code, except the HES, whose identifier is literally `HES`. If your integration assumes the reference type is always a number, the HES breaks it. Relvo treats it as the special case it is. ## What a reference stores Beyond type, number and date, a reference captures the issuer's tax identity, the country, the net and total amounts, and—where applicable—the declared exchange rate. That makes it possible to compare what the PO authorizes with what the charge calculation computes, **before** issuance. If the reference arrives as an attached document, Relvo extracts those fields and flags the result as pending review when the extraction was inconclusive. ## The two axes of a reference The status of the reference and the status of its attached document are different things: a reference can be registered with manually entered data and no file at all. **Reference status** | Status | Meaning | | --- | --- | | Registered | The data was captured | | Verified | An operator confirmed the data. Unblocks issuance | | Superseded | A later version exists, for example a corrected PO | | Rejected | Reviewed and found invalid | | Voided | Withdrawn from operational use, kept for audit | **Attachment extraction status** Pending → processing → accepted · needs review · failed. > **Caution: An automatic extraction is a proposal, not an approval** > > A *registered* reference with data read automatically from a PDF is not enough to lift the issuance block — an operator has to review and confirm it. A superseded or voided reference is never deleted: it is kept so that, months later, you can explain why an invoice was issued citing that PO and not another. **Example: Acme, July close** 1. The July charge calculation comes to USD 1,639.40 and the contract requires a PO. 2. Relvo sends the request from the charge calculation; the charge calculation shows as blocked for issuance. 3. Acme replies with PO no. `4500192387` for USD 20,000 per year. 4. An operator verifies it. The block is lifted. 5. The invoice is issued citing the PO as a commercial reference, code 801. In August the same PO is still valid: the block does not have to be cleared from scratch every month. ## When the reference does not match If the PO authorizes less than the charge calculation computes, the answer is not to issue anyway. It is to correct the charge calculation, or obtain an expanded PO, and record which of the two happened. Issuing above the PO produces an invoice the customer will reject under its own internal controls. - [Charge calculations, pre-invoices and invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md): What exactly gets blocked. - [Messaging](https://app.relvoerp.com/docs/product/en/communications.md): How the request is sent and recorded. - [Credit and debit notes](https://app.relvoerp.com/docs/product/en/credit-debit-notes.md): The cost of issuing without the evidence. --- # Usage and billable metrics > From a customer activity event to a billable, auditable quantity. Source: https://app.relvoerp.com/docs/product/en/usage-billing/ A usage charge needs a quantity. That quantity is not entered by hand: it is calculated from the events your system reports. This page covers the three pieces of that chain. **From activity to quantity:** Event → Billable metric → Filters → Aggregation → Period quantity ## Usage events A usage event is a timestamped fact: *what happened, when, and for which customer*. It is immutable — Relvo never edits an event once ingested. ### The ingestion contract Events are sent in batches to `POST /api/v1/public/usage-events`, **1 to 500 events per call**. It requires the `usage_events:write` scope. It takes no `Idempotency-Key` header, because each event carries its own `idempotency_key`. | Field | Required | Description | | --- | :---: | --- | | `event_name` | ✅ | Event name. This is what the metric selects on. | | `timestamp` | ✅ | When the usage occurred, ISO 8601 in UTC. Determines which period it belongs to. | | `idempotency_key` | ✅ | Unique key for the event. Resending the same key does not duplicate usage. | | `customer_id` | — | Internal UUID of the customer. Mutually exclusive with `external_customer_id`. | | `external_customer_id` | — | The customer's code in your system. Mutually exclusive with `customer_id`. | | `properties` | — | The event's dimensions and quantities. | `properties` is a **flat** map—no nested objects—of strings and booleans. Quantities go as decimal strings (`"42"`, `"0.75"`), never as JSON numbers. Up to 100 properties, with keys of at most 128 characters. > **Key rule: Fractional quantities go as strings** > > `"0.75"` as text, not `0.75` as a number. A floating-point decimal loses precision in transit, and in billing that loss ends up as a wrong amount. Relvo rejects the ambiguous format before accepting it, not after invoicing it. ### The response is 202, not 201 Ingestion is asynchronous: Relvo accepts the batch into an idempotent inbox and processes it afterwards. The response tells you exactly what happened to each event: | Field | Meaning | | --- | --- | | `receipts` | One ingestion receipt per new event: `id`, `idempotency_key`, `status` (`pending`, `processing`, `processed`, `failed`, `dead`), `received_at`, `processed_at` and `usage_event_id` | | `duplicate_idempotency_keys` | Keys that were already in the inbox. They are not re-queued, and this is not an error | | `validation_failed` | Rejected events, each with its `idempotency_key` and its `errors` | A receipt can be looked up later with `GET /api/v1/public/usage-event-receipts/{receipt_id}`, or by key with `GET /api/v1/public/usage-event-receipts?idempotency_key=…`. Reusing a key with a different body rejects the whole batch with `409`. If the queue is full, the response is `429` with `Retry-After`. A batch can have mixed results: 480 queued, 15 duplicates and 5 rejected. Check `validation_failed` on every response — a `202` does not mean all 500 events got in. **Example: Safe retry after a timeout** Your process sends 500 events, the connection drops and you don't know whether they arrived. You resend the same batch with the same `idempotency_key` values. ```json { "receipts": [], "duplicate_idempotency_keys": ["evt-0001", "…", "evt-0500"], "validation_failed": [] } ``` No usage was duplicated. This is exactly why `idempotency_key` is required rather than optional. ### Origin and status Each event records where it came from (`api`, `manual` or `csv`) and what status it is in: | Status | Meaning | | --- | --- | | `active` | Counts toward the calculation | | `voided` | Voided by a correction. No longer counts | | `superseded` | Replaced by a later event. No longer counts | Events are listed with `GET /api/v1/public/usage-events`, which accepts the filters `event_name`, `customer_id`, `external_customer_id`, `status`, `query` and `timestamp_from`/`timestamp_to`, and returns `{items, next_cursor}`. Hourly volumes come from `GET /api/v1/public/usage-events/volume`. ### Corrections An event is not edited: it is corrected with `POST /api/v1/public/usage-events/{usage_event_id}/corrections`, with the `usage_events:correct` scope and an `Idempotency-Key`. There are two possible operations. | Operation | Effect | When to use it | | --- | --- | --- | | `void` | Withdraws the event (it becomes `voided`) | The usage never happened | | `replace` | Substitutes it with the `replacement_event` (the original becomes `superseded`) | The usage happened, but with different data | Only an `active` event can be corrected. Correcting any other returns `409`. The response tells you what the consequences are: - **`rerating_required`** — the affected period must be recalculated. `rerating_status` shows where that recalculation stands (`not_required`, `requested`, `completed` or `failed`). - **`adjustment_required`** — the period has already been invoiced, so the correction cannot change the issued document and needs a credit or debit note. > **Caution: Correcting already-invoiced usage does not rewrite the invoice** > > An issued invoice is an immutable financial record. If the correction affects a period that has already been invoiced, Relvo flags it with `adjustment_required` and the difference is settled with a [credit or debit note](https://app.relvoerp.com/docs/product/en/credit-debit-notes.md). Never by altering the original document. ## Billable metrics A billable metric turns a pile of events into a number. It defines three things: **which events it selects**, **which property it measures** and **how it combines them**. They can be defined in two ways: | Mode | For whom | What it allows | | --- | --- | --- | | **Guided** | Operations and RevOps | Choosing the event, property, aggregation method and filters from the interface | | **SQL** | Data teams | Writing the query when the logic does not fit guided mode | Both modes produce an equivalent metric downstream: the charge does not know how it was authored. ### Aggregation methods Guided mode offers: | Method | What it calculates | Example | | --- | --- | --- | | `count_agg` | Counts events | Number of API calls | | `sum_agg` | Sums a property | GB transferred | | `avg_agg` | Average of a property | Mean latency | | `max_agg` | Maximum for the period | Peak concurrent connections | | `min_agg` | Minimum for the period | Floor of capacity used | | `unique_count_agg` | Distinct values | Unique active users | | `latest_agg` | Last observed value | Storage at period close | Two additional methods exist at the engine level but cannot be authored from guided mode: `weighted_sum_agg` (a sum weighted by how long each value was in effect) and `custom_agg`. > **Key rule: `latest_agg` cannot serve as a percentage base** > > `latest_agg` returns a point-in-time snapshot, not a series of quantities: there is no transacted value to apply a rate to. Relvo rejects the combination with `percentage` and `graduated_percentage` **when the charge is created**, not at invoicing, so the error shows up while it is still cheap to fix. ### Filters A filter restricts the metric to a subset of events based on their properties. The same event can feed several metrics filtered in different ways. **Example: One event, three charges** Your system emits a single `api_request` event with `properties.region`. With filters, that same stream feeds three charges with different prices: | Metric | Filter | Charge | | --- | --- | --- | | LATAM requests | `region = latam` | USD 0.04 / request | | US requests | `region = us-east` | USD 0.06 / request | | Total requests | *(no filter)* | Monthly minimum | There is no need to change your instrumentation: you change the metric. ## How the period closes When the period closes, Relvo aggregates the `ACTIVE` events whose `timestamp` falls within the window, applies the metric's filters and hands the quantity to the charge's pricing model. An event that arrives late, with a `timestamp` in an already-invoiced period, does not rewrite that invoice: it triggers the same adjustment path as a correction. - [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): What the pricing model does with the quantity the metric produced. - [Seat-based charges](https://app.relvoerp.com/docs/product/en/seat-based-charges.md): Quantities resolved from seats instead of reported events. - [Operational integrations](https://app.relvoerp.com/docs/product/en/integrations.md): How to connect your system to report usage. - [Idempotency](https://app.relvoerp.com/docs/product/guides/idempotency.md): The retry contract across the entire public API. --- # Charge calculations, pre-invoices and invoices > From the reviewed calculation to the financial document, and the four status axes that describe an invoice. Source: https://app.relvoerp.com/docs/product/en/invoicing-collections/ Between "the contract says X should be billed" and "a tax invoice for X exists" there are three distinct objects. Confusing them is the most common cause of billing errors. **From calculation to document:** Charge calculation → Pre-invoice → Issued invoice → Applied payment ## Charge calculation A **charge calculation** is the result of computing a period: contract + usage + prices + adjustments. It is not yet a document and has no tax effect. A charge calculation can be recomputed as many times as needed. If late usage arrives, an event is corrected or the contract is adjusted before issuing, the calculation is recomputed and reflects the current state. That is precisely the moment when corrections are cheap. ## Pre-invoice A **pre-invoice** is the detail of the charge calculation shared with the customer before issuing. It lets the customer validate it, issue their purchase order (OC, *orden de compra*) or obtain an internal approval. Issuing without a pre-invoice is normal for simple contracts. For contracts that require an OC or a service acceptance sheet (HES, *hoja de entrada de servicio*), the pre-invoice is the step that obtains that evidence. See [OC, HES and approvals](https://app.relvoerp.com/docs/product/en/approvals-commercial-references.md). ## Invoice An invoice is a financial record. Its status is not a single value: it is **four independent axes**, because an invoice can be accepted by the SII (Chile's tax authority), not yet delivered to the customer and partially paid, all at once. > **Shortcut: Four axes, not one combined status** > > Relvo never combines these axes into a single value like `EMITIDA_PENDIENTE_SII_IMPAGA`. Each axis advances on its own, and any valid combination can be represented without inventing new statuses. ### Axis 1 — Lifecycle Where the document is in its life as a document. | Status | Meaning | | --- | --- | | `upcoming` | The period has not closed yet | | `draft` | Draft. Editable, no tax effect | | `open` | Issued. A financial record, no longer editable | | `partially_voided` | Issued and partially reversed by a credit note | | `void` | Issued and then fully reversed | | `cancelled` | Discarded before issuance. Never had a fiscal footprint | > **Caution: `void` and `cancelled` are not synonyms** > > - **`cancelled`** — the document was never issued. It never existed for tax purposes and leaves no fiscal trail. > - **`void`** — the document **was** issued and then reversed with a credit note. The original document still exists and can still be looked up. > > Only a draft can be cancelled. An issued invoice can only be voided, and that means issuing a second document. The valid transitions are: ``` upcoming → draft → open → void open → partially_voided → void upcoming | draft → cancelled ``` ### Axis 2 — Fiscal status What the tax authority said about the document. | Status | Meaning | | --- | --- | | `not_submitted` | Not yet submitted | | `pending` | Submitted, no response yet | | `accepted` | Accepted by the authority | | `rejected` | Rejected. Requires correction and resubmission | > **Caution: `pending` is not an error, and retrying does not resolve it** > > An invoice in `pending` has already been submitted. Resubmitting it can produce a duplicate document with its own folio number, which then has to be voided. When an issuance is stuck in `pending`, the right path is to reconcile with the provider to find out what happened, not to retry blindly. ### Axis 3 — Delivery Whether the document reached the customer. | Status | Meaning | | --- | --- | | `not_sent` | Not sent | | `send_requested` | Sending requested, still queued | | `sent_to_provider` | Handed off to the email provider | | `delivered` | Confirmed as delivered | | `delivery_failed` | Sending failed | `send_requested` does not mean "sent": it means "queued". The difference matters when a customer claims they never received their invoice. ### Axis 4 — Payment How much has been collected. | Status | Meaning | | --- | --- | | `unpaid` | No payments applied | | `partially_paid` | Partly paid | | `paid` | Settled | > **Key rule: Overdue is not a payment status** > > An overdue invoice is an unsettled invoice whose due date has passed. Relvo **derives** this from the due date and the balance instead of storing it as a status. A stored status becomes a lie the moment someone pays: the balance says one thing and the column says another. A derived value never contradicts the data. ## Document types | Type | Use | SII code | | --- | --- | --- | | Domestic | Domestic sale | 33 (taxable, *afecta*) · 34 (exempt, *exenta*) | | Export | Sale abroad | 110 | | Receipt (*boleta*) | Sale to an end consumer | 39 · 41 (exempt) | ## Origin Every invoice records where it came from: a billing cycle (`billing_run`), a one-off issuance outside a contract (`one_off`), or an import of documents already issued in another system (`imported_issued_invoice`). The origin is what lets you distinguish what Relvo calculated from what Relvo only recorded. ## Editing before issuing A draft can be edited: add and remove lines, group them, adjust names, correct the currency conversion. Relvo records whether the draft body is the one **generated** by the calculation or was **edited by an operator**, so that a later recalculation does not silently overwrite a deliberate manual adjustment. **Example: Acme, July close** | Item | Amount | | --- | --- | | Platform (in advance) | USD 1,000.00 | | AI conversations — 8,420 tiered (in arrears) | USD 639.40 | | **Invoice total** | **USD 1,639.40** | One period, one document, two charges with opposite timing. A later payment of USD 1,000 leaves it `partially_paid` with a USD 639.40 balance. ## API Invoices live at `/api/v1/public/invoices` (scopes `invoices:read` and `invoices:write`). Actions are dedicated, named endpoints: `/issue`, `/cancel` and `/duplicate`. There are also subresources for `lines`, `line-groups`, `commercial-references`, `suppressed-lines` (with `/restore`) and `versions/{version}`, and downloads at `/pdf` and `/xml`. Every `POST` requires an `Idempotency-Key`, and every write to an existing invoice requires `If-Match`. Lists return `{items, next_cursor}`. - [Credit and debit notes](https://app.relvoerp.com/docs/product/en/credit-debit-notes.md): How an already-issued invoice is corrected. - [Payments and reconciliation](https://app.relvoerp.com/docs/product/en/payments-reconciliation.md): How money received is applied to documents. - [OC, HES and approvals](https://app.relvoerp.com/docs/product/en/approvals-commercial-references.md): The evidence that can block issuance. - [Messaging](https://app.relvoerp.com/docs/product/en/communications.md): How documents are sent to the customer. --- # Credit and debit notes > How an issued invoice is corrected without editing or deleting it. Source: https://app.relvoerp.com/docs/product/en/credit-debit-notes/ An issued invoice is a financial record. It is not edited and it is not deleted: it is **corrected by issuing a second document** that references it. That document is either a credit note (it reduces the amount) or a debit note (it increases it). > **Key rule: Correcting is not undoing** > > The original invoice still exists, can still be looked up and keeps its folio (the sequential tax document number). What changes is the net balance of the relationship with the customer, which is now invoice ± notes. An audit can reconstruct what was billed first, what was corrected afterwards and why. ## Which one to use | Situation | Document | | --- | --- | | The customer was overbilled | Credit note | | The customer was underbilled | Debit note | | The entire document should not have been issued | Credit note for the full amount | | The customer rejects the price and it was renegotiated | Credit note, then reinvoice | | A discount was applied that should not have been | Debit note | ## Types and SII codes | Document | Domestic | Export | | --- | --- | --- | | Credit note | 61 | 112 | | Debit note | 56 | 111 | The SII (Chile's tax authority) document code is neither chosen nor stored: Relvo **derives** it from the note type and from whether the transaction is domestic or export. A manually stored code can contradict the document; a derived code cannot. ## Scope of a credit note A credit note declares how much of the source document it reverses: | Scope | Effect | SII reference | | --- | --- | --- | | Full | Reverses the entire invoice | CodRef 1 — *Anula documento* (voids document) | | Partial | Corrects amounts | CodRef 3 — *Corrige montos* (corrects amounts) | > **Caution: The declared scope must match the amount** > > Relvo cross-checks what you declare against what the lines add up to. A **full** note whose lines add up to less than the invoice total is rejected, and so is a **partial** note that adds up to the full total. The inconsistency is stopped when the note is created, not after the SII has accepted it. > > The SII reference code is resolved on the server from the scope. It is never accepted from the client. ## Effect on the invoice A credit note modifies the lifecycle axis of the invoice it corrects: - **Partial** note → the invoice moves to `partially_voided`. It stays live, with a reduced balance. - **Full** note → the invoice moves to `void`. Issued and reversed. See [the four status axes](https://app.relvoerp.com/docs/product/en/invoicing-collections.md#invoice). ## Note lifecycle A note is itself a tax document with its own axes: ``` Lifecycle draft → open → void Fiscal pending → accepted | rejected Delivery not_sent → sent | failed ``` A draft note can be corrected. An issued note cannot: if a credit note went out wrong, it is corrected with a debit note. The chain of corrections remains intact in the record. **Example: Acme, July correction** The July invoice charges the fixed platform fee (USD 1,000) plus 8,420 conversations at USD 0.075 (USD 631.50). The customer shows that 420 of them were internal tests by its own team, not billable usage: 420 × USD 0.075 = USD 31.50. | Document | Amount | Effect | | --- | --- | --- | | Invoice 33 no. 1841 | USD 1,631.50 | `open` | | Credit note 61, partial | USD 31.50 | Invoice → `partially_voided` | | **Net balance** | **USD 1,600.00** | | The original invoice keeps its folio and its amount. It is not touched. The receivable balance is the sum of both documents. ## Usage corrected after issuance If a usage event is voided or replaced after the period has already been invoiced, the recalculation does **not** rewrite the invoice. Relvo flags that an adjustment is required, and that adjustment is a note. See [event corrections](https://app.relvoerp.com/docs/product/en/usage-billing.md#corrections). ## References Every note points to the document it corrects through a commercial reference with its type, folio and date. This is what allows the SII, the customer and accounting to link both documents. See [POs, HES and commercial references](https://app.relvoerp.com/docs/product/en/approvals-commercial-references.md). ## API Notes live at `/api/v1/public/credit-notes` and `/api/v1/public/debit-notes`, with the `invoices:read` and `invoices:write` scopes. They are created as drafts with a `POST` on the collection, which requires `Idempotency-Key` and an `If-Match` with the version of the source invoice. They are then issued with `/issue`, voided with `/void` and downloaded from `/pdf` and `/xml`. A draft is deleted with `DELETE`. Every `POST` requires `Idempotency-Key`, and every write to an existing note requires `If-Match`. - [Charge calculations, pre-invoices and invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md): The four status axes of an invoice. - [Usage and billable metrics](https://app.relvoerp.com/docs/product/en/usage-billing.md): How events already ingested are corrected. - [POs, HES and approvals](https://app.relvoerp.com/docs/product/en/approvals-commercial-references.md): Commercial references between documents. --- # Messaging > Operational emails for invoicing, approval and collections, with conversation threading and delivery traceability. Source: https://app.relvoerp.com/docs/product/en/communications/ ## Messaging Relvo is not an email client: it sends emails **with a declared business intent**. Every send is tied to the document or charge calculation that triggered it, and the customer's reply comes back into the same conversation, not into a loose inbox. ### Which emails Relvo sends The catalog of intents is closed. There are no generic sends without a recorded purpose: every email declares why it is being sent, and that determines the template, the recipient and what counts as a reply. | Intent | When it is used | | --- | --- | | **Charge approval** | The charge calculation is ready and needs the customer's sign-off before invoicing. Has a reminder version and an overdue version. | | **OC / HES request** | Ask for the commercial reference — purchase order (OC, *orden de compra*) or service acceptance sheet (HES, *hoja de entrada de servicio*) — that is blocking issuance. Also has reminder and overdue versions. | | **Invoice issued** | Deliver to the customer the invoice already stamped by the SII (Chile's tax authority). | | **Credit note issued** | Deliver the accepted credit note to the same audience that received the invoice. | | **XML delivery** | Send only the XML to the technical recipient who requires it. | | **Invoice coming due** | Advance notice, N days before the due date. | | **Payment reminder** | Collections on an invoice that is already past due. | | **Operator email** | A hand-written email, with recipients chosen by the sender. | > **Key rule: Who decides the recipient** > > In automated emails, the recipient is derived from the customer's registered contacts: nobody types an address by hand and nobody sends outside the organization by accident. Operator emails —reply, forward, compose— are the deliberate exception: there, the operator **is** the authority over who receives it. ### Drafts: nothing goes out half-written An email is prepared as a draft before it goes out, and the draft has its own lifecycle: **editable** while it is being composed, **sealed** once it is frozen for sending, and then **sent**, **cancelled** or **expired**. The last three are final. Sealing is what guarantees that the content a person reviewed is exactly the content that goes out, even if the send happens later on a schedule. ### Delivery: two axes, not one | Axis | Values | What it answers | | --- | --- | --- | | **Send** | requested · sent · failed · blocked by suppression | Did Relvo manage to hand it to the email provider? | | **Provider delivery** | unknown · sent · delayed · delivered · bounced · complained · failed · suppressed | What happened next, on the way to the customer's mailbox? | > **Caution: “Sent” is not “delivered”** > > An email can show as sent and still bounce. Before claiming that the customer "isn't responding", check the second axis: a hard bounce or a spam complaint adds the address to the **suppression list**, and from then on Relvo stops emailing it until someone explicitly removes it. ### Conversations Every email sent and every reply received is grouped into a conversation, rebuilt from the thread headers — so a reply forwarded three times still lands where it belongs. The conversation is classified along two independent axes: - **Impact**: whether it blocks invoice issuance, blocks collections, or is informational. - **Work status**: open · action required · waiting on customer · resolved. That lets you answer "which invoices are held up by a pending conversation?" without reading a single email. ### Email domain and templates Set the sender name, default CC recipients and Reply-to for the operation. From this configuration you also manage the sending domain and the email templates the platform uses. Relvo recommends registering a dedicated **subdomain** (for example `facturacion.tuempresa.com`) rather than the root domain: DNS changes stay contained, and the sending reputation of your corporate email is not exposed to collections. The domain goes through DNS verification before it is enabled, and only the **authenticated sending** capability is required; click tracking and reply receiving are optional. ## Collections communications Collections is not a one-off email: it is a **declared sequence** that runs on an open invoice. The sequence is defined once and versioned; each invoice in collections advances through its own copy of that definition, so changing the policy tomorrow does not rewrite what already happened. The available steps are deliberately few: | Step | What it does | | --- | --- | | **Wait until** | Pause until a date relative to the due date — negative to give notice before, positive to collect after. | | **Send reminder** | Send the email for the corresponding intent. | | **Ensure payment link** | Make a payment method available before following up again. | | **Retry with provider** | Retry the automatic charge, where one exists. | | **Require review** | Take the invoice off autopilot and hand it to a person. | | **Complete** | End the sequence. | > **Shortcut: Collections stops on its own when the balance changes** > > An invoice's payment status is derived from the payments applied to it, not set by hand. When the balance reaches zero, the sequence no longer makes sense and stops following up: nobody has to remember to turn it off. - [OC, HES and approvals](https://app.relvoerp.com/docs/product/en/approvals-commercial-references.md): Which commercial evidence is requested by email, and why it blocks issuance. - [Payments and reconciliation](https://app.relvoerp.com/docs/product/en/payments-reconciliation.md): What turns an open invoice into a paid invoice. --- # Payments and reconciliation > Match the money received to the right invoices, without applying the same payment twice. Source: https://app.relvoerp.com/docs/product/en/payments-reconciliation/ Issuing an invoice is not collecting it. Between the document and the money there are two objects: the **payment**, which is the fact that money came in, and the **application**, which is the decision about which documents it belongs to. ## Payments A payment records incoming money: amount, currency, date and where it came from. | Source | What it is | | --- | --- | | Manual | Recorded by an operator against **one** invoice | | Bank import | A bank statement line. Can be split across several invoices | | Point of sale | Received through a terminal | | External collection | Received through a collection provider | The payment status describes the incoming money, not the document: `pending` → `succeeded`, or else `failed` / `voided`. A payment being `succeeded` says nothing about whether any invoice was settled; that is told by the invoice's balance. They are two distinct axes, on purpose. > **Key rule: A manual payment is applied to a single invoice** > > Splitting a payment across several documents is a reconciliation decision, with its own evidence and traceability. Relvo does not allow it as a side effect of recording a payment by hand, because a split with no record of why it was made is impossible to audit six months later. When more money comes in than is owed, the surplus is kept as a **customer credit**: active until it is applied to a future document, or reversed if it is refunded. ## Reconciliation Reconciliation matches bank movements against receivable documents. Relvo proposes; a person confirms. **Reconciliation:** Transfer received → Proposal → Review → Confirmation → Balance updated A transfer rarely carries the invoice number. It carries a RUT (Chilean tax ID) in the description, an amount that almost matches, an abbreviated name. Relvo weighs those signals and publishes **proposals**: candidates with their evidence in view. ### Reconciliation groups A group is the workspace where you decide which movements pay which documents. | Status | Meaning | | --- | --- | | Draft | Editable. Has not moved any balance yet | | Confirmed | Applied. **No longer editable** | | Requires review | Something doesn't match and needs a person | | Reversed | Was confirmed and was undone, with a recorded reason | | Cancelled | Discarded before confirmation | > **Caution: Confirming is a financial fact, not a save** > > A confirmed group is not edited. If it was wrong, it is **reversed** with a record of the reason —wrong customer, wrong invoice, wrong amount, returned payment, duplicate— and a new one is built. The correction stays visible as a correction, not disguised as the original state. The reversal reason is not decoration. From each confirmation, Relvo learns which counterparty corresponds to which bank description, and **only** a "wrong customer" reversal unlearns that association. A returned payment or a mistyped amount says nothing about who the payer is, and erasing what was learned in those cases would throw away good information. **Example: Acme, July charge** Invoice for USD 1,639.40. A transfer of USD 1,000 comes in. | Moment | Invoice payment status | Balance | | --- | --- | ---: | | Issued | `unpaid` | USD 1,639.40 | | USD 1,000 applied | `partially_paid` | USD 639.40 | | Remainder applied | `paid` | USD 0.00 | Each application keeps its detail: which movement, which amount, against which document. That detail is what lets you explain the balance without recalculating it by hand. ## Due date An overdue invoice is an invoice with an outstanding balance whose due date has already passed. Relvo derives this; it does not store it. That is why the moment a payment is applied is also the moment the invoice stops being overdue, with no nightly process in between. - [Charges, pre-invoices and invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md): The payment axis within an invoice's status. - [Operational integrations](https://app.relvoerp.com/docs/product/en/integrations.md): Connect bank accounts and bank statements. - [Messaging](https://app.relvoerp.com/docs/product/en/communications.md): Reminders and collections follow-up. --- # Reporting and metrics > Questions about contracts, invoicing, collections and usage, with an explicit definition behind every number. Source: https://app.relvoerp.com/docs/product/en/reporting/ A revenue report is only useful if two people looking at it understand the same thing. That is why every Relvo metric has an explicit definition: what it adds up, what it excludes and **which date** it is counted against. ## The three ways to count time This is the distinction that prevents the most confusion. Every metric is one of these three types, and mixing them is what produces reports that don't reconcile. | Mode | Question | Examples | | --- | --- | --- | | **Flow** | How much happened *during* this period? | Invoiced, cash collected, usage events | | **Snapshot** | How much was there *as of this date*? | Active contracts, MRR, ARR, overdue | | **Projection** | How much *will be due* under the contracts? | Expected invoicing, accrued unbilled revenue | > **Caution: A flow accumulates; a snapshot does not** > > Adding up twelve monthly MRR snapshots does **not** give you the year's revenue: it counts the same contract twelve times. Adding up twelve months of invoicing does give you annual invoicing. If a figure looks inflated by an order of magnitude, it is almost always a snapshot summed as if it were a flow. ## The date you count against A single document has several dates, and choosing which one to use changes the result. Relvo treats them as distinct, named fields, never as just "the date": | Date | What it marks | | --- | --- | | Issuance | When the document was issued | | Draft | When it was generated, not yet issued | | Due date | When it was supposed to be paid | | Cash application | When money was applied to a document | | Service period | The period the charge covers | | Usage | When the usage event occurred | A contract invoiced on July 31 for July service and paid on August 12 shows up in July or in August depending on which of these dates you choose. Neither answer is wrong; what would be wrong is not knowing which one was used. ## What you can ask **Contracts** — created in the period, active as of a date, nearing expiry, contracted MRR, ARR, active customers. **Invoicing** — number and amount issued, net amount, taxes, credit notes and debit notes, net invoiced amount after corrections, unissued drafts. **Collections** — cash collected, overdue amount, overdue documents. **Usage** — number of events and aggregated usage per billable metric. **Projection** — expected invoicing for the period, expected accrued revenue, and accrued revenue not yet invoiced. > **Key rule: MRR and ARR are not 'all invoicing'** > > Contracted MRR adds up **only fixed charges from active contracts**, normalizing non-monthly cadences to their equivalent monthly rate. Variable usage is excluded: by definition it is not committed recurring revenue. > > That is the right way to measure the recurring base, and it is exactly why it will not match what was invoiced in a month with heavy usage. They are two different questions. ## Breakdowns Any metric can be broken down by customer, contract status, billing interval, currency, billable metric, charge type, pricing model or item. Relvo deliberately restricts some combinations, because they produce numbers with no commercial meaning: - Aggregated usage requires choosing **one** billable metric. Adding conversations to gigabytes means nothing. - Breaking down by item requires a metric that exists at line level. - A breakdown by a high-cardinality dimension—customers, for example—requires filtering or limiting first, instead of returning ten thousand unreadable series. ## Invoiced is not collected These are three different figures, and Relvo keeps them separate: | Figure | What it is | | --- | --- | | Invoiced | Documents issued in the period | | Collected | Money actually applied to documents | | Outstanding | Issued balance not yet collected | Cash collected counts only **current** applications of **successful** payments: if a reconciliation is reversed, that money stops counting, with no need to recalculate anything by hand. **Example: July in three figures** | Figure | Amount | | --- | ---: | | Contracted MRR as of July 31 (snapshot) | USD 12,400 | | Invoiced in July (flow) | USD 18,930 | | Collected in July (flow) | USD 15,200 | They do not contradict each other. Invoicing exceeds MRR because of variable usage and one-time charges; collections lag behind because of 30-day payment terms. ## API Reports are read with the `reports:read` scope under `/api/v1/public/reports/`: `mrr`, `arr`, `active-contracts`, `active-customers`, `average-revenue`, `invoice-count`, `invoiced-revenue`, `revenue-trend`, `revenue-concentration`, `top-revenue` and `receivables-aging/customers` (with the per-customer detail at `receivables-aging/customers/{customer_id}/invoices`, paginated with `limit`—50 by default, maximum 200—and `cursor`, and always limited to that customer's invoices). Amounts are transmitted as decimal strings with their currency's precision (for example, UF—Chile's inflation-indexed unit of account—with 4 decimal places and CLP with none). - [Revenue recognition](https://app.relvoerp.com/docs/product/en/revenue-recognition.md): When billed revenue becomes earned revenue, and the per-customer report. - [Payments and reconciliation](https://app.relvoerp.com/docs/product/en/payments-reconciliation.md): Where cash collected comes from. - [Charge calculations, pre-invoices and invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md): The statuses behind invoiced and outstanding. - [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): The basis for recurring metrics. --- # Revenue recognition > How Relvo decides when invoiced revenue is recognized, records it in an immutable accounting subledger, and reports it per customer. Source: https://app.relvoerp.com/docs/product/en/revenue-recognition/ Invoicing revenue and recognizing it are two different facts. An annual subscription charged up front is **invoiced** in January but **earned** month by month across the year. Relvo keeps the two apart following ASC 606 / IFRS 15: every invoiced line carries a recognition instruction, and that instruction produces balanced journal entries in a subledger that is never edited. ## Each line's recognition instruction Every invoice line states **how** its revenue is recognized. There are four methods: | Method | When revenue is recognized | Period | | --- | --- | --- | | `point_in_time` | All at once, on the issue date | None | | `straight_line` | Evenly per day across a period | Required (`recognition_period`) | | `usage` | As the service is consumed | None | | `milestone` | When the related milestone is completed | None | A line can also name the **performance obligation** its revenue is allocated to (`performance_obligation_id`). The instruction is frozen when the invoice is issued. Because an open invoice is immutable, so is the way it is recognized: changing it takes a credit or debit note, exactly as for the amount. ### When a line has no instruction A line without an explicit instruction is not left undefined. When the invoice is issued, Relvo freezes a default method using the first rule that applies: 1. If the line states its **service period**, it is recognized `straight_line` over that period. 2. If the line states no period but the invoice states a **billing period**, it is recognized `straight_line` over that period. 3. With no period at all, it is recognized `point_in_time` on the issue date. > **Key rule: The default is decided once** > > An explicit instruction is always kept. The default is computed once, at issuance, from the invoice itself — never from the contract — and is never reinterpreted afterwards: changing a contract's configuration does not rewrite how an already-issued invoice is recognized. ## From method to journal entry Every issued invoice produces a **recognition schedule**: the journal entries due and the date of each. - **`point_in_time`**: a single entry on the issue date, *Debit* accounts receivable / *Credit* revenue. - **`straight_line`**: an opening entry on the issue date that moves the full amount to deferred revenue (*Debit* accounts receivable / *Credit* deferred revenue), followed by one entry per calendar-month slice of the period, dated at the end of the slice, that releases the earned share (*Debit* deferred revenue / *Credit* revenue). The amount is split by the days in each slice and the last slice absorbs the rounding, so the entries add up exactly to the line. - **`usage`** and **`milestone`**: not recognized from the invoice. They need a separate event proving the obligation was satisfied. Every entry is balanced and in the invoice's original currency; the subledger does not convert currencies. **Example: An annual subscription charged up front** A USD 12,000 line, `straight_line` from January 1 to December 31, on an invoice issued January 1: | Date | Debit | Credit | Amount | | --- | --- | --- | ---: | | January 1 | Accounts receivable | Deferred revenue | 12,000.00 | | January 31 | Deferred revenue | Revenue | 1,019.18 | | February 28 | Deferred revenue | Revenue | 920.55 | | … | … | … | … | | December 31 | Deferred revenue | Revenue | the remainder | January has 31 of 365 days: 12,000 × 31 / 365 = 1,019.18. December receives whatever is left to reach exactly 12,000. ## A subledger that only grows Recognition entries live in an **append-only** subledger: they are never edited or deleted. A correction is a new reversing entry, visible next to the original. If an invoice's registration is replaced, the previous one is marked as superseded instead of disappearing, so you can always audit what was recorded and when. Relvo also tracks **coverage**: which invoices already have their recognition source registered and which do not. An invoice without a registration is never silently counted as zero; it shows up as a coverage gap. ### Closing the accounting month The accounting month is managed per legal issuer. A month with no decision is open. Closing it requires three conditions: the month has ended, no due entries remain unposted, and no invoice lacks a recognition source. Closing or reopening requires a written reason and is versioned. Closing a month changes no entry: it only records the decision. ## Recognition by customer in Reporting **Reporting** includes the **Revenue recognition by customer** report: a month-by-month waterfall of what each customer has recognized, been billed and has deferred, with a drill-down to their billing accounts. - The headline figures show, for the selected month, what was **Recognized**, what was **Billed**, and the deferred balance at month end. - The deferred roll-forward starts from **Opening deferred**, adds what was billed in the month, separates what was **Billed for earlier months** — service already delivered, recognized on issuance without passing through deferred — and subtracts what was recognized to reach **Closing deferred**. - Each column is a month. Months up to the selected one show what was recognized; the following months, in gray, show what is already billed and scheduled. The **Horizon** sets how many months are shown. - At the end, **Remaining** is the deferred revenue at the close of the selected month, **Later** is what remains to recognize after the last month shown, and **Total** is what was recognized plus everything still pending. - You can **Export CSV**. The report only includes what has already been invoiced: it does not project contracts. Accepted credit and debit notes adjust the month they are issued in. An amount in another currency with no exchange rate available is left out of the report and flagged: it is never counted as zero. Documents still pending acceptance by the SII (Chile's tax authority) are included, with a note saying so. > **Caution: This is a management report, not a journal entry** > > The waterfall answers "how much of what we billed have we earned?" to run the business. The accounting truth is the entries posted in the subledger. If the two figures differ, the subledger is the one that counts for accounting. ### Lines without a period An invoiced line that does not state the period it covers is recognized, in the report, on its issue date. That can concentrate revenue that really belongs to several months into one. When such lines exist, the report shows a notice with the link **Review lines without a period**. The **Lines without a period** queue lets you assign a period to a selection of lines, or accept the suggestion Relvo reads from the line's text (for example, "Servicio marzo 2026"), with high, medium or low confidence. Nothing counts until you confirm it. Assignments are kept as a history — the latest one wins — and **only affect the report**: they change neither the issued invoice nor the subledger entries. To decide which period a line falls in, the report uses the first available source: 1. The recognition period of a `straight_line` instruction. 2. The line's service period. 3. The latest assignment confirmed in the lines-without-a-period queue. 4. The invoice's billing period. 5. The issue date. ## Integration **Public API.** When you create an invoice through `/api/v1/public`, each line accepts a `revenue_recognition` object with `method`, `recognition_period` (only for `straight_line`) and an optional `performance_obligation_id`. If you omit it, the default method described above applies. Invoices read through the API always return each line's frozen `revenue_recognition`. **MCP server.** With the `reports:read` scope, an agent can audit recognition without writing anything: | Tool | What it answers | | --- | --- | | `relvo_report_posted_recognition_get` | **Posted** recognized and deferred revenue for a legal issuer, with paginated journal evidence (a range of up to 366 days) and coverage gaps | | `relvo_revenue_schedule_get` | An invoice's planned schedule, slot by slot, and whether each slot is unposted, posted or reversed. A plan is not recognized revenue | | `relvo_recognition_ledger_get` | An invoice's posted entries, with their reversals and whether the registration is current or superseded | | `relvo_recognition_period_get` | Whether an issuer's accounting month is open or closed, with the reason, the version and what is still missing to close it | - [Reporting and metrics](https://app.relvoerp.com/docs/product/en/reporting.md): Billed, collected and the other business metrics. - [Credit and debit notes](https://app.relvoerp.com/docs/product/en/credit-debit-notes.md): How an issued invoice is corrected, including its recognition. - [MCP server](https://app.relvoerp.com/docs/product/guides/mcp.md): Connect an agent with read-only scope. --- # Operational integrations > Connect the systems that issue, collect, pay and feed Relvo — and understand what happens when one fails. Source: https://app.relvoerp.com/docs/product/en/integrations/ Relvo is the system of record for your revenue, but it does not issue tax documents or move money on its own. For that it connects to external systems: the e-invoicing provider, the bank, the payment gateway and your own systems. Every connection is an explicit object with credentials, a status and a log. Nothing is ever "implicitly connected". ## E-invoicing In Chile, tax documents are issued with the SII (Chile's tax authority) through an authorized provider. Relvo prepares the document, sends it through the connected provider and stores the authority's response. Every fiscal connection declares its **environment**: `sandbox` or `producción` (production). This is not a display label — it is a safety boundary. Documents from one environment never mix with those from the other, whether querying or issuing. > **Caution: The authority rules the document, not your contract** > > If the SII rejects a document, the invoice moves to fiscal status `rejected` and must be corrected and resubmitted. If it stays `pending`, it has already been submitted: resubmitting it can produce a second document with its own folio number. The right path is to reconcile with the provider. See [the four axes of an invoice](https://app.relvoerp.com/docs/product/en/invoicing-collections.md#axis-2--fiscal-status). ### Fiscal sync Besides issuing, Relvo can **read** from the SII what your company has issued: documents created in another system, before Relvo or in parallel. This feeds the collections portfolio and reconciliation with documents Relvo did not calculate. Documents imported this way are tagged with their origin. That is what lets any report distinguish what Relvo calculated from what Relvo only recorded — and it is why a customer nobody created by hand may appear, flagged for review. ## Banks and movements Connect the bank accounts whose movements you want to bring into Relvo. Credential validation and MFA happen inside a provider widget: **bank credentials never pass through Relvo's frontend and are never stored in Relvo**. Once connected, the account is mapped to a ledger account and its movements feed reconciliation. If no connection is available, the alternative is to upload bank statements (*cartolas*) — the result in reconciliation is the same. ## Payment methods A customer's payment method declares **through which channel the money is expected**. There are two worlds: | Channel | Who executes the collection | | --- | --- | | Bank transfer, manual payment, self-collected | Relvo. There is no external system or credentials to connect. | | External gateway | A connected payment provider, which executes the charge and reports the result. | The distinction matters: only an external channel can become disconnected, require reconnection or fail because of credentials. A bank transfer does not "go down". ## Connection status A connection is not just "active or not". Its status tells you what to do: | Status | What it means | | --- | --- | | `active` | Operating | | `syncing` | Pulling data right now | | `auth_failed` · `requires_reconnect` | Invalid or expired credentials — requires human action | | `rate_limited` | The provider is throttling; Relvo retries on its own | | `disabled` · `inactive` | Deliberately turned off | | `error` | Provider failure, with no user action pending | `requires_reconnect` is the only one of these that halts the flow and does **not** resolve itself: someone has to re-authenticate. ## How data comes in | Channel | Typical use | | --- | --- | | **API** | Your systems send usage events or read documents | | **Inbound webhook** | The provider reports a change (payment received, document accepted) | | **File upload** | Bank statements, historical usage, migrations | | **Manual** | One-off entry from the interface | Every ingestion is recorded as a run with its result — complete, partial or failed — and row-by-row detail. A partial upload is never silently lost: the rows that failed are identified so they can be corrected and reprocessed. ## API and tokens API tokens are issued from Developers and carry **scopes** of the form `resource:action` — for example `usage_events:write`, `invoices:read`, `contracts:write`, `catalog:read`, `charging:read` (prices) or `customers:write`. Write implies read on the same resource: a token with `invoices:write` can also read invoices. Every operation in the reference declares the scopes it accepts in `x-required-scopes`, and having any one of them is enough. The token is sent as `Authorization: Bearer …` (`BearerAuth` scheme). > **Caution: `full_access` is almost never the right token** > > `full_access` passes any scope check. It is fine for a quick test, not for a production system and **never** for an MCP client. Issue the narrowest scope the integrator needs: it is the difference between a leaked credential that reads usage and one that issues invoices. A token is revoked, not edited. See the [authentication guide](https://app.relvoerp.com/docs/product/guides/authentication.md) and the [API reference](https://app.relvoerp.com/docs). ## Outbound webhooks Relvo can notify your systems when something relevant happens. The available events are a closed, versioned catalog: | Event | When it fires | | --- | --- | | `invoice.drafted` | An invoice draft was generated | | `invoice.issued` | An invoice was issued | | `invoice.fiscal_rejected` | The authority rejected the invoice | | `credit_note.issued` · `debit_note.issued` | A note was issued | | `credit_note.fiscal_rejected` · `debit_note.fiscal_rejected` | The authority rejected a note | | `message.received` | An email arrived from a customer: a reply to a Relvo email or a new message | Each endpoint has its own signing secret: **verify the signature before trusting the message body**. A newly created endpoint stays pending verification until it responds correctly, and it can be disabled (`/disable`) and re-enabled (`/enable`) without losing its configuration. The secret is rotated with `/rotate-secret`, and a failed delivery is resent with `/redeliver`. See the [webhooks guide](https://app.relvoerp.com/docs/product/guides/webhooks.md). - [Integration guides](https://app.relvoerp.com/docs/product/guides/introduction.md): Authentication, idempotency, errors and webhooks, with examples. - [MCP server](https://app.relvoerp.com/docs/product/guides/mcp.md): Connect an AI client to your Relvo data with narrowly scoped access. - [Payments and reconciliation](https://app.relvoerp.com/docs/product/en/payments-reconciliation.md): What Relvo does with the bank movements it pulls in. - [Charge calculations, pre-invoices and invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md): The statuses that change when the tax authority responds. --- # Security and trust > How Relvo protects your organization's financial data — hosting, isolation between organizations, access, API, backups, immutable records and how to report a vulnerability. Source: https://app.relvoerp.com/docs/product/en/security/ Relvo is the system of record for contracts, usage, invoices and collections. This page summarizes how that data is protected, for a vendor review or a security questionnaire. Each point describes how the platform works today, not an intention. ## Hosting and infrastructure - The platform runs on **Google Cloud Platform**, with its primary region in **Santiago, Chile** (`southamerica-west1`). The database and application files live in that region. - All traffic is encrypted with **HTTPS (TLS)**, and data at rest is encrypted by the Google Cloud platform. - Some processors, such as the email delivery provider, process data outside Chile. The [privacy policy](https://app.relvoerp.com/privacy) lists them. ## Isolation between organizations Each Relvo customer is an **organization**. Every record belongs to exactly one organization and every query is scoped to it: a user or a token from one organization cannot read or change another organization's data. API tokens and MCP connections are issued **per organization**. Each organization also has a separate [sandbox](https://app.relvoerp.com/docs/product/guides/sandbox.md) to build and test integrations without touching real data. ## User access - Sign in with **Google** or with email and password. Passwords are stored only as **bcrypt** hashes, never in plain text. - An account is **temporarily locked** after repeated failed sign-in attempts. - The session travels in `httpOnly`, `Secure` and `SameSite` cookies that page scripts cannot read. - Each member has a **role** in their organization, and that role decides what they can see and do. ## API, webhooks and AI agents - **API tokens** carry scopes of the form `resource:action`, such as `invoices:read`. Issue the narrowest one your integration needs. Relvo stores only a cryptographic hash of each token, never the token itself. See [Authentication](https://app.relvoerp.com/docs/product/guides/authentication.md). - Every write accepts an `Idempotency-Key`, so a retry never duplicates an invoice, a payment or a usage event. See [Idempotency](https://app.relvoerp.com/docs/product/guides/idempotency.md). - Outbound **webhooks** are HMAC-signed and timestamped. Your endpoint can verify that a delivery came from Relvo and reject replays. See [Webhooks](https://app.relvoerp.com/docs/product/guides/webhooks.md). - AI agents connect through the [MCP server](https://app.relvoerp.com/docs/product/guides/mcp.md) with OAuth 2.1 and PKCE, or with a scoped token. AI assists, but it never overrides the deterministic financial rules: what the domain rejects is rejected for an agent too. ## Integrity of financial records > **Key rule: What is issued is never edited** > > An issued invoice is immutable. It is corrected with a credit or debit note, which is a separate document that references the original. The [revenue recognition](https://app.relvoerp.com/docs/product/en/revenue-recognition.md) subledger is append-only: a mistake is reversed with a new entry and never deleted. - Amounts are computed with exact decimal arithmetic, never floating point, and the same contract with the same usage always produces the same result. - Exchange rates are timestamped and frozen on the document that used them. - Each invoice keeps its activity history: who issued, sent or corrected it, or recorded a payment against it. ## Backups and continuity - The database has **automated daily backups** and **point-in-time recovery**. - There is a documented disaster-recovery procedure. ## Personal data Relvo processes personal data under Chile's **Law No. 19,628**. Data subjects can exercise their rights of access, rectification, cancellation and objection by writing to [contacto@relvoerp.com](mailto:contacto@relvoerp.com). Processing of your customers' data is governed by the data processing agreement in your contract with Relvo. Details are in the [privacy policy](https://app.relvoerp.com/privacy) and the [terms of service](https://app.relvoerp.com/terms). ## Report a vulnerability If you find a vulnerability, email [contacto@relvoerp.com](mailto:contacto@relvoerp.com) with the steps to reproduce it. While you investigate, do not access or change other organizations' data and do not degrade the service. We answer good-faith reports and keep you updated on the fix. The contact is also published in standard form (RFC 9116) at [`/.well-known/security.txt`](https://app.relvoerp.com/.well-known/security.txt). Does your procurement process need a security questionnaire or a data processing agreement? Write to the same address. --- # Onboarding > A guided process to set up contracts, usage and invoicing in Relvo. Source: https://app.relvoerp.com/docs/product/en/onboarding/ Onboarding onto Relvo usually takes between 1 and 2 days, depending on the number and complexity of your contracts. We start from the information that already exists in your CRM or current system. We can connect directly to your CRM or work with a small template to map customers, contracts, pricing, items and billable metrics. **Your rollout:** 1. Setup → 2. Customers → 3. Contracts → 4. Items and metrics → 5. Usage → 6. Test → 7. Go live ## 1. Initial setup We define the basic structure of the operation and the sources the commercial information will be imported from. - CRM or system to connect. - Primary data source. - Entities to import. - Currencies in use and countries of operation. - Onboarding owners. - Usage loading mechanism. If there is no direct integration, we use a simple template for the initial mapping. ## 2. Customers and billing accounts We import your customer base from the CRM or from the onboarding template. Each customer is linked to a billing account and to the contacts involved in the operation. | Information | Example | | --- | --- | | Customer code | `acme` | | Name | Acme | | Billing account | Acme SpA | | Tax ID | RUT / RFC / NIT | | Legal name | Acme SpA | | Owners | Finance / Invoicing | | Billing emails | billing@acme.com | The customer code is what ties contracts, usage, charge calculations and invoices to the same company. ## 3. Contracts and pricing We import each customer's commercial terms from the CRM, a structured template or the existing contract PDFs. | Information | Example | | --- | --- | | Customer | Acme | | Term | 01/01/2026 – 12/31/2026 | | Currency | USD | | Frequency | Monthly | | Fixed charge | USD 1,000 / month | | Variable charge | AI conversations | | Pricing | Tiered | | Payment terms | 30 days | | Invoicing condition | Requires purchase order (OC, *orden de compra*) | | Commercial reference | OC / HES (service acceptance sheet) | Relvo can structure contracts with multiple charges, phases and different commercial terms per customer. ## 4. Items and billable metrics Based on your contracts' pricing, we configure what you sell and how each variable component is measured. | Item | Billable metric | Model | | --- | --- | --- | | Platform subscription | — | Fixed monthly | | AI conversations | Completed conversations | Usage-based | | Active users | Active users in the period | Seat-based | | Transactions | Processed transactions | Per unit | **From activity to billable quantity:** conversation.completed → Metric: AI conversations → Monthly count → Billable quantity ## 5. Usage and operational integrations We configure how the information needed to calculate variable charges will reach Relvo, and we connect the systems involved in the operation. ### Usage loading methods | Method | Use | | --- | --- | | API | Automatic integration from your product | | Bulk CSV upload | Periodic loads or monthly processes | During this stage we load a sample of usage to validate that customer codes and billable metrics are mapped correctly. ### Operational integrations Where applicable, we configure: - **SII** (Chile's tax authority), for issuing tax documents. - **Bank**, for payments and reconciliation. - **Email**, for sending pre-invoices, approvals, requesting and receiving OC / HES, customer communications and collections. ## 6. First test cycle We run a test billing cycle on a set of customers and review the results before issuing real documents. **Test charge calculation:** Customers → Contracts → Pricing → Metrics → Usage → Charge calculation We use Acme as the main example. For the test period, **8,420 conversations** are reported. **Example: Test charge calculation: Acme** | Line | Calculation | Amount | | --- | ---: | ---: | | Platform subscription | monthly | USD 1,000.00 | | First 1,000 conversations | included | USD 0.00 | | Next 4,000 | 4,000 × USD 0.10 | USD 400.00 | | Remaining 3,420 | 3,420 × USD 0.07 | USD 239.40 | | **Total** | | **USD 1,639.40** | The test cycle runs on real data but without issuing any tax document: you can review the period's usage, the tier breakdown, the fixed charge and the calculated total, and rerun it as many times as needed until the result matches what you expect to bill. Issuance is enabled only once you approve it. The full walkthrough of this same contract, from usage to reconciled payment, is in [From contract to payment](https://app.relvoerp.com/docs/product/en/contract-to-payment.md). ## 7. Go live Once the test cycle is validated, Relvo is ready to run the real operation. **Live operation:** Usage → Charge calculation → Pre-invoice → Approval / OC / HES → Invoice → Collections → Payment → Reconciliation Our team accompanies the first cycle to make sure contracts, usage, charge calculations and invoicing conditions are working correctly. **Example: Optional mirroring** If you already have an invoicing process running, we can run Relvo in parallel over a past period or during your next cycle. During mirroring we compare: - Customers and billing accounts. - Contracts and pricing. - Items and billable metrics. - Usage and calculated amounts. - Expected documents. Once both processes match, Relvo can take over running the cycle directly. ## Related - [Contracts](https://app.relvoerp.com/docs/product/en/contracts.md) - [Events, metrics and calculation](https://app.relvoerp.com/docs/product/en/usage-billing.md) - [From contract to payment](https://app.relvoerp.com/docs/product/en/contract-to-payment.md)