canonical: https://jentic.com/apis/alegra.com/alegra

# Alegra API

Jentic publishes the only available OpenAPI specification for Alegra API, keeping it validated and agent-ready. Alegra is an accounting and invoicing platform widely used by SMBs across Latin America and Spain. The REST API exposes invoices, items, contacts (customers and suppliers), payments, estimates, credit notes, bank accounts, and chart-of-accounts categories. Authentication uses HTTP basic auth with the user's Alegra email and an API token from the Alegra account.

## For AI agents

Create and manage invoices, items, contacts, estimates, and payments inside an Alegra accounting account through 33 REST endpoints.

## Scope

Does not handle payment processing, payroll, or tax filing - use for invoicing, contacts, items, payments, and credit note bookkeeping inside Alegra only.

## Capabilities

- Create, list, update, and delete Alegra invoices and email them to a customer with /invoices/{id}/email
- Manage the product and service items used as invoice line items
- Maintain customer and supplier contact records via /contacts
- Record payments against invoices and reconcile bank account activity
- Generate and update estimates that can later be converted into invoices
- Issue credit notes against existing invoices for refunds and adjustments

## Use cases

### Automated invoicing from a billing system

A SaaS billing system creates an invoice in Alegra each time a subscription renews by calling POST /invoices with the customer contact id, line items, and dates. The same workflow then calls POST /invoices/{id}/email to deliver the invoice straight to the customer. Bookkeeping stays in Alegra while the system of record stays in the SaaS app.

Example prompt: POST /invoices with the contact id and items array, then POST /invoices/{id}/email with the recipient address

### Two-way contact sync between a CRM and Alegra

An ops engineer mirrors customers from a CRM into Alegra by listing /contacts, comparing against CRM records by email, and creating or updating contacts as needed. Keeping contact metadata aligned lets the accounting team produce invoices without re-entering names and tax IDs.

Example prompt: GET /contacts to list existing entries, then POST /contacts for missing CRM customers and PUT /contacts/{id} for changed records

### Payment reconciliation and credit notes

An AR clerk reconciles incoming bank transfers against Alegra invoices by listing /payments and matching amounts to invoice ids. When a refund is required, the clerk issues a credit note via the credit notes resource, keeping the ledger consistent without manual journal entries.

Example prompt: GET /payments for the period, match each row to an invoice by amount and contact, and POST a credit note for any refunds

### Agent-driven invoice lookup and dispatch

A Jentic agent answers requests like 'send the latest invoice to client X' by listing the contact, finding the most recent invoice, and emailing it via POST /invoices/{id}/email. The agent never sees the basic auth credentials and never has to compose Spanish-language email templates manually.

Example prompt: Search Jentic for 'create and email an Alegra invoice', execute POST /invoices for the contact, then chain POST /invoices/{id}/email with the recipient

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /invoices | Create an invoice |
| GET | /invoices/{id} | Retrieve an invoice |
| POST | /invoices/{id}/email | Email an invoice to a contact |
| POST | /contacts | Create a contact |
| POST | /items | Create a product or service item |
| POST | /payments | Record a payment |
| POST | /estimates | Create an estimate |

## Key resources

- **Invoices** — Create, retrieve, update, delete, and email invoices
- **Items** — Manage product and service items used as invoice line items
- **Contacts** — Customer and supplier records used on invoices and estimates
- **Payments** — Record and retrieve payments against invoices
- **Estimates** — Create, update, and delete estimates that can convert into invoices
- **Credit Notes** — Issue credit notes against existing invoices
- **Bank Accounts** — List and manage configured bank accounts
- **Categories** — Chart-of-accounts categories used to classify transactions
- **Company** — Read company-level configuration for the Alegra account

## Why Jentic

- **Setup:** Wiring Alegra by hand means encoding its HTTP basic credentials, targeting the api.alegra.com v1 base, and handling paging and error retries for invoices, contacts, items, and payments yourself. Through Jentic you install once, import the Alegra API from the API Directory, store the basic credential once, and your agent calls it.
- **Permission scoping:** Alegra puts the invoice id in the URL path (/invoices/{id}, /invoices/{id}/email), so a rule can pin your agent to one invoice for reads and emailing. You choose the operations it may call, so creating contacts, items, or payments is not included unless you add them.
- **Credential handling:** Your Alegra basic credential is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'create an invoice in Alegra' or 'email an invoice to a contact', and Jentic returns the matching Alegra operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Xero Accounting API** — Use Xero for English-speaking SMB accounting outside Alegra's Latin America and Spain footprint
- **Stripe API** — Pair with Alegra so Stripe handles card collection while Alegra produces the legal invoice
- **Airtable API** — Source line item data from an Airtable base to drive Alegra invoice creation

## FAQ

### Why is there no official OpenAPI spec for Alegra API?

Alegra does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Alegra API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Alegra API use?

Alegra uses HTTP basic auth, where the username is the account email and the password is the API token from the Alegra account settings. Jentic stores both encrypted and injects the Authorization header at execution time so the credentials never enter the agent's prompt context.

### Can I create and email an invoice with the Alegra API?

Yes. POST /invoices with the contact id, items, and dates to create the invoice, then POST /invoices/{id}/email with the recipient address to send it. The same id can be retrieved later with GET /invoices/{id} for audits.

### What are the rate limits for the Alegra API?

The OpenAPI spec does not declare rate limits. Alegra enforces plan-based limits server-side (commonly a few requests per second per token), so batch high-volume invoice or contact sync jobs accordingly.

### How do I record a payment against an invoice through Jentic?

Search Jentic for 'record an alegra payment', load the schema for POST /payments, and execute it with the invoice id, amount, and bank account id. Jentic returns the payment record so an agent can confirm reconciliation.

### Can I issue a credit note for a refund using the Alegra API?

Yes. The credit notes resource lets you issue a credit against an existing invoice. The credit note keeps the ledger consistent without manual journal entries and is visible in the same Alegra account as the original invoice.

### Can I limit what my agent is allowed to do with the Alegra API?

Yes. Because you run Jentic One yourself, your own rules decide which Alegra operations and credentials the agent may use. Since Alegra puts the invoice id in the URL path (/invoices/{id} and /invoices/{id}/email), a rule can pin the agent to reading and emailing a single invoice. You pick the operations it can call, so creating contacts, items, or payments stays off unless you explicitly allow those endpoints.
