> ## Documentation Index
> Fetch the complete documentation index at: https://alguna.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Base URLs, authentication, versioning, filtering, pagination and errors for the Alguna Public API.

The Alguna Public API is a JSON-over-HTTPS API for the whole quote-to-revenue flow: customers, products and plans, subscriptions and their versions, usage events and metrics, credits and wallets, invoices, payments, refunds, tax and revenue schedules. Use it when you want your own systems to drive billing rather than the dashboard — provisioning customers on signup, metering usage, opening checkout, or reading revenue. How those objects relate is described in [How Alguna works](https://alguna.com/docs/concepts/how-alguna-works.md); the endpoint pages in this section are generated from the current OpenAPI spec.

## Base URLs

| Environment | Base URL | Dashboard |
| - | - | - |
| Production | `https://api.alguna.io` | [app.alguna.io](https://app.alguna.io) |
| Sandbox | `https://api.sandbox.alguna.io` | [app.sandbox.alguna.io](https://app.sandbox.alguna.io) |

Sandbox is a separate environment with its own data and its own API keys; a key issued in one environment is rejected by the other. All requests must be made over HTTPS.

## Authentication

Every request carries an API key as a Bearer token:

```
Authorization: Bearer <API-KEY>
```

Create and manage keys in the dashboard under **Settings → Connections → Developers → [API Keys](https://app.alguna.io/settings/connections/developers/api-keys)**. Keys are secrets — keep them server-side, never in a browser or mobile app. A missing or invalid key returns `401`.

## Versioning

The API is date-versioned. Send the `Alguna-Version` header on every request to pin the version your integration is written against; the current version is `2026-04-01`. Upgrading is a deliberate change to that header, never a side effect of time passing.

```bash cURL theme={null}
curl "https://api.alguna.io/customers?limit=20&offset=0&sort=name:asc" \
  -H "Authorization: Bearer $ALGUNA_API_KEY" \
  -H "Alguna-Version: 2026-04-01"
```

```python Python theme={null}
import os

import requests

response = requests.get(
    "https://api.alguna.io/customers",
    params={"limit": 20, "offset": 0, "sort": "name:asc"},
    headers={
        "Authorization": f"Bearer {os.environ['ALGUNA_API_KEY']}",
        "Alguna-Version": "2026-04-01",
    },
    timeout=10,
)
response.raise_for_status()
customers = response.json()["data"]
```

```typescript TypeScript SDK theme={null}
import { Alguna } from "@alguna/sdk";

const alguna = new Alguna({
  apiKey: process.env.ALGUNA_API_KEY,
  apiVersion: "2026-04-01",
});

const { data: customers } = await alguna.customers.list({
  limit: 20,
  offset: 0,
  sort: "name:asc",
});
```

Use the version selector in the sidebar to browse the endpoints of a specific version. The [SDKs and the CLI](https://alguna.com/docs/api-reference/v2/sdks/overview.md) set the header for you, and each lets you set the version you pin.

## Request and response format

* Request and response bodies are JSON with **snake\_case** field names (`customer_id`, `plan_id`). Webhook payloads are the exception — they are camelCase; see [Webhooks](https://alguna.com/docs/api-reference/v2/webhooks.md).
* Monetary amounts are decimal **strings** (`"99.00"`), never floats.
* Timestamps are RFC 3339 (`2026-04-01T10:00:00Z`); dates are `YYYY-MM-DD`.
* Send `Content-Type: application/json` on requests with a body.
* Every response carries an `X-Request-Id` header — a UUID for that request. Log it and quote it when you contact support.

## Filtering and sorting

List endpoints take filters as individual query parameters. Pass one value for an exact match, or comma-separated values for IN-style matching:

```bash theme={null}
GET /invoices?limit=20&offset=0&sort=issue_date:desc&status=issued&customer_id=cust_abc123
GET /customers?limit=20&offset=0&sort=name:asc&tag_ids=tag_foo,tag_bar
```

Tag IDs can be looked up with [List tags](https://alguna.com/docs/api-reference/v2/2026-04-01/tags/list-tags.md). The filter parameters each endpoint accepts are documented on its page.

Sorting uses `sort=<field>:<asc|desc>`, for example `name:asc`.

## Pagination

List endpoints require `limit` and `offset`, and most require `sort`. Send all three on every list request. Responses wrap the page in `data` and describe it in `pagination`:

```json theme={null}
{
  "data": [ ... ],
  "pagination": { "per_page": 20, "total_pages": 5 }
}
```

To walk a collection, increase `offset` by `limit` until `offset / limit + 1` reaches `total_pages`.

## Idempotency

Mutating endpoints (`POST`, `PATCH`, `PUT`, `DELETE`) accept an `Idempotency-Key` header so a retried request is applied at most once. `POST /events` is the exception: each event carries its own `unique_id`. See [Idempotency](https://alguna.com/docs/api-reference/v2/idempotency.md).

## Errors

Failed requests return a JSON body with the HTTP `status` and a human-readable `detail`:

```json theme={null}
{
  "status": 400,
  "detail": "Validation failed: name is required"
}
```

| Status | Meaning |
| - | - |
| `400` | Bad request — malformed parameters |
| `401` | Unauthorized — missing or invalid API key |
| `404` | Not found — the resource does not exist in this environment |
| `409` | Conflict — a request with this idempotency key is still being processed |
| `422` | Unprocessable — well-formed, but violates a rule for the current state |
| `429` | Rate limited — back off and retry |
| `500` | Internal error — safe to retry with the same idempotency key |

Branch on the status code, not on the text of `detail`. See [Errors](https://alguna.com/docs/api-reference/v2/errors.md) for typed SDK errors, request IDs and retry guidance.

## Other ways in

* **[SDKs and CLI](https://alguna.com/docs/api-reference/v2/sdks/overview.md)** — [TypeScript](https://alguna.com/docs/api-reference/v2/sdks/typescript.md), [Python](https://alguna.com/docs/api-reference/v2/sdks/python.md), [Go](https://alguna.com/docs/api-reference/v2/sdks/go.md) and [Rust](https://alguna.com/docs/api-reference/v2/sdks/rust.md) clients with one typed method per endpoint, and the [`alguna` CLI](https://alguna.com/docs/api-reference/v2/sdks/cli) with one command per endpoint.
* **[Webhooks](https://alguna.com/docs/api-reference/v2/webhooks.md)** — push notifications for subscription, invoice, payment, checkout and credit events.
* **[MCP server](https://alguna.com/docs/ai/mcp.md)** — the same operations exposed as tools for AI assistants.
* **[Developer quick start](https://alguna.com/docs/quickstarts/developers.md)** — first request to first invoice, end to end.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.