# Bilnex Partner API > REST API for embedding e-invoicing into an ERP: send sales invoices as Estonian operator-channel e-invoices, Peppol, or PDF-by-email; receive purchase e-invoices by polling; AI-digitize PDF purchase invoices; confirm ERP imports with mark-exported. Self-serve sandbox at https://sandbox.bilnex.io, no account needed. The canonical agent entry point is https://sandbox.bilnex.io/agents.md — a 13-step happy path where every step is a runnable curl with a full response and the verification check it satisfies. Sandbox and production expose identical paths; only the base URL and key prefix differ. Every documentation page is plain markdown (append `.md`). ## Instructions for LLM Agents API version: `2026-08-01`. Base URLs: sandbox `https://sandbox.bilnex.io`, production `https://api.app.bilnex.io`. Provision a sandbox key with one call, no account: `POST https://sandbox.bilnex.io/partner/v1/sandbox` with `{"email":"dev@erp.example","erpName":"AwesomeERP","ref":"agent"}` — the response contains the API key (shown once), two test companies, and three fixture counterparties. Hard rules: 1. Never assume a customer can receive e-invoices — always call `GET /partner/v1/customers/{regCode}/e-invoice-capability` first and branch to the `EMAIL` channel when `eInvoiceCapable` is `false`. 2. Never wait for a `DELIVERED` status — `SENT` is terminal for `E_INVOICE` and `PEPPOL`, and only `EMAIL` invoices ever reach `SEEN`. 3. Never expect webhooks — receiving purchase invoices is pull-based via `GET /partner/v1/purchase-invoices?since=...` polling, deduplicated by `id`. 4. Never poll faster than once every 2 seconds, and always honor the `Retry-After` header on a 429 response. 5. Never re-send an e-invoice as a retry — one invoice equals one send, and corrections are issued as credit notes, not duplicate sends. 6. Never recompute invoice header totals (`netAmount`, `vatAmount`, `totalAmount`, `vatSummary`) from line items — the server's values are authoritative. 7. Never skip `POST /partner/v1/purchase-invoices/{id}/mark-exported` after importing a purchase invoice into the ERP — it is idempotent and mandatory. 8. Never put the API key in frontend code, mobile code, or the repository — it is shown once at provisioning and belongs in server-side configuration only. 9. Never use a `blx_sbx_` key against `api.app.bilnex.io` or a `blx_live_` key against `sandbox.bilnex.io` — keys are host-bound and the wrong host returns 401. 10. Never call `/partner/v1/sandbox/*` endpoints from production code paths — they return 404 in production, so gate them behind an environment flag. Stopping condition: do not report the integration complete until `GET /partner/v1/sandbox/verification` returns `"readyForProduction": true` (all 12 required checks `pass`). If a check is `fail` or `pending`, read its `fixHint` and `docsUrl`, fix the integration code, and re-run verification. Checks are sticky until `POST /partner/v1/sandbox/reset`. ## Docs - [Quickstart](https://sandbox.bilnex.io/docs/quickstart.md): The whole happy path in 13 ordered curl steps, from key provisioning to a passing verification run. - [Authentication](https://sandbox.bilnex.io/docs/authentication.md): Bearer/X-API-Key headers, host-bound key prefixes, acting company via X-Company-Id, key storage rules. - [Sandbox](https://sandbox.bilnex.io/docs/sandbox.md): Self-serve provisioning, test companies, fixture counterparties, state, reset, claim (TTL extension), event triggers, intercepted email. - [Sending invoices](https://sandbox.bilnex.io/docs/sending-invoices.md): Capability check, invoice creation, the three send channels, DRAFT→SAVED→SENT→SEEN lifecycle, idempotency keys, totals contract. - [Receiving invoices](https://sandbox.bilnex.io/docs/receiving-invoices.md): since-cursor polling, NEW→SEEN→EXPORTED statuses, fetching the original XML/PDF, mandatory mark-exported. - [Peppol](https://sandbox.bilnex.io/docs/peppol.md): Peppol participant IDs (0191:regCode), sending via the PEPPOL channel, receiving Peppol purchase invoices. - [Digitization](https://sandbox.bilnex.io/docs/digitization.md): Multipart PDF upload, DIGITIZED_PENDING status, extraction confidence, flowing digitized documents into the ERP. - [Email invoices](https://sandbox.bilnex.io/docs/email-invoices.md): EMAIL channel as the fallback rail, SEEN via tracking pixel, sandbox email interception at /sandbox/emails. - [Errors](https://sandbox.bilnex.io/docs/errors.md): The error envelope (code, message, hint, docsUrl), full error-code table with retryability. - [Rate limits](https://sandbox.bilnex.io/docs/rate-limits.md): X-RateLimit-* headers on every response, 429 + Retry-After handling, sandbox usage caps. - [Verification](https://sandbox.bilnex.io/docs/verification.md): All 16 checks (12 required, 4 optional), exactly which API interaction flips each to pass, and the readyForProduction rule. - [Go-live](https://sandbox.bilnex.io/docs/go-live.md): Production key issuance, real channel activation (registry verification, operator election, Peppol registration, bank account), sandbox-vs-production differences, smoke tests, key rotation. - [API reference](https://sandbox.bilnex.io/docs/api-reference.md): Every endpoint, header, and response shape on one page. - [Changelog](https://sandbox.bilnex.io/docs/changelog.md): Dated record of API changes, starting 2026-08-01. - [Versioning policy](https://sandbox.bilnex.io/docs/versioning-policy.md): Additive-only guarantee for /partner/v1; breaking changes go to /partner/v2; clients must tolerate unknown fields. ## Machine-readable - [agents.md](https://sandbox.bilnex.io/agents.md): Canonical agent entry point with the copy-paste integration prompt. - [OpenAPI 3.1 spec](https://sandbox.bilnex.io/partner/v1/openapi.json): Full machine-readable schema for /partner/v1. - [Agent-skills index](https://sandbox.bilnex.io/.well-known/agent-skills/index.json): Skill discovery manifest; install with `npx skills add https://sandbox.bilnex.io`. - [SKILL.md](https://sandbox.bilnex.io/skills/bilnex-erp-integration/SKILL.md): The bilnex-erp-integration skill (build procedure + reference files). ## Optional - [Estonian e-invoicing context](https://sandbox.bilnex.io/skills/bilnex-erp-integration/references/estonia-einvoicing-context.md): Background on operator-channel e-invoices, the registry, Peppol IDs, reg codes, VAT, and IBANs — useful, not required for integration.