# API

> Connect your own scripts, systems and AI agents to Moniary.

The Moniary API reads and edits documents, issues and sends invoices, matches payments and uploads documents for AI extraction. Every request runs as you, in one company, with the same permissions you have in the app.

## At a glance

| Item           | Value                                                                                                             |
| -------------- | ----------------------------------------------------------------------------------------------------------------- |
| Base URL       | `https://moniary.com/api/v1`                                                                                      |
| Authentication | `Authorization: Bearer <key>`                                                                                     |
| Format         | JSON, UTF-8                                                                                                       |
| Rate limit     | 300 requests a minute per key                                                                                     |
| Reference      | [API reference](/api-reference), machine-readable as [`/api/v1/openapi.json`](/api/v1/openapi.json) (OpenAPI 3.1) |

## Your first request

Create an API key in **Settings → API and CLI** (see [API keys and sign-in](/docs/api-klice)) and check it works:

```bash
curl https://moniary.com/api/v1/me \
  -H "Authorization: Bearer $MONIARY_API_KEY"
```

```json
{
  "key": {
    "id": "…",
    "name": "Export",
    "prefix": "mny_RTE5jErA",
    "scope": "read"
  },
  "user": { "id": "…", "email": "jana@example.com" },
  "workspace": { "id": "…", "name": "Example s.r.o." }
}
```

Then run your first action, for example totals of your received documents:

```bash
curl -X POST https://moniary.com/api/v1/actions/invoices.getInvoiceStats \
  -H "Authorization: Bearer $MONIARY_API_KEY"
```

Prefer the terminal? The [CLI](/docs/cli) signs in through your browser and does the same in one line.

## How the API works

The API is built from **actions** such as `invoices.getInvoiceStats`, `tags.create` or `issuedInvoices.issueInvoice`. They are all called the same way: `POST /actions/<name>` with the input as a JSON body, and the result comes back in `data`. See [Actions](/docs/api-akce).

Besides actions there are a few fixed endpoints: `GET /me`, action discovery, [document uploads](/docs/api-nahravani-dokladu) and the [CLI](/docs/cli) sign-in. The [API reference](/api-reference) describes every endpoint, generated from a single OpenAPI document.

## Stability

Actions are stable. We don't rename them or change their input in a way that breaks your code. New actions and optional fields are added over time. If a breaking change is ever unavoidable, we announce it in advance.

## What the API covers

Received and issued documents, contacts, bank transactions, tags, categories, and previews of the VAT return (přiznání k DPH), VAT control statement (kontrolní hlášení) and EC sales list (souhrnné hlášení). More areas will follow. Deleting, buying credit, managing keys and company settings stay in the app.
