# 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/"<version>"`. 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.
