# 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.
