API reference
Volledige reference van alle Corlega API v1 endpoints. request en response shapes.
Complete reference van elke endpoint onder https://api.corlega.com/v1/. Voor de basics (auth, errors, rate limits) zie API overview.
Authenticatie & rate limits
Elke request:
- Header
Authorization: Bearer corlega_... - Header
Content-Type: application/jsonvoor POST/PATCH - 120 requests/minuut per key (sliding window)
- Bij overschrijding:
429+Retry-After-header
Scopes
| Resource | Scopes |
|---|---|
| me / organization | organization.read, organization.write, organization.* |
| contacts | contacts.read, contacts.write, contacts.* |
| quotes | quotes.read, quotes.write, quotes.* |
| invoices | invoices.read, invoices.write, invoices.* |
| agents | agents.read, agents.write, agents.trigger, agents.* |
| requests | requests.read, requests.write, requests.* |
| webhooks | webhooks.read, webhooks.write, webhooks.* |
| alles | * (admin-keys. gebruik spaarzaam) |
/v1/me
Info over de huidige API-key en welke organisatie hij heeft toegang.
GET /v1/me
Scope: organization.read
curl https://api.corlega.com/v1/me \
-H "Authorization: Bearer corlega_..."Response:
{
"data": {
"apiKeyId": "01HE...",
"organizationId": "01HD...",
"scopes": ["contacts.*", "quotes.read"],
"prefix": "corlega_abc12345…"
}
}/v1/organization
GET /v1/organization
Scope: organization.read · Geeft alle organisatie-instellingen terug.
PATCH /v1/organization
Scope: organization.write
Updatebare velden: legalName, kvkNumber, vatNumber, iban, defaultCurrency (ISO-4217, 3 letters), defaultVatPercentage (0–100), defaultPaymentTermsDays, invoiceFooter, invoiceNumberPrefix, quoteNumberPrefix.
curl -X PATCH https://api.corlega.com/v1/organization \
-H "Authorization: Bearer corlega_..." \
-H "Content-Type: application/json" \
-d '{"defaultPaymentTermsDays": 30, "invoiceNumberPrefix": "INV-"}'/v1/contacts
GET /v1/contacts
Scope: contacts.read · Paginated lijst.
Query params: page (default 1), pageSize (default 25, max 100).
GET /v1/contacts/{id}
Scope: contacts.read
POST /v1/contacts
Scope: contacts.write
curl -X POST https://api.corlega.com/v1/contacts \
-H "Authorization: Bearer corlega_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Bouwbedrijf De Vries B.V.",
"email": "info@devries-bouw.nl",
"phone": "06 12345678",
"kvkNumber": "12345678",
"billingCountry": "NL"
}'PATCH /v1/contacts/{id}
Scope: contacts.write · Stuur alleen de velden die je wilt wijzigen.
DELETE /v1/contacts/{id}
Scope: contacts.write · Hard-delete. Niet ongedaan te maken.
/v1/quotes
GET /v1/quotes
Scope: quotes.read
GET /v1/quotes/{id}
Scope: quotes.read
POST /v1/quotes
Scope: quotes.write · Maakt een concept-offerte (status: draft).
curl -X POST https://api.corlega.com/v1/quotes \
-H "Authorization: Bearer corlega_..." \
-H "Content-Type: application/json" \
-d '{
"contactId": "con_01HC...",
"items": [
{"name": "Service call", "quantity": 1, "unitPrice": 89.00, "vatPercentage": 21}
],
"validUntil": "2026-07-01T00:00:00Z"
}'PATCH /v1/quotes/{id}
Scope: quotes.write · Update content of zet status (draft → sent, sent → approved, etc.).
DELETE /v1/quotes/{id}
Scope: quotes.write · Alleen voor draft of canceled quotes.
/v1/invoices
Zelfde structuur als quotes. Statussen: draft, finalized, sent, viewed, paid, overdue, in_collection, written_off.
GET /v1/invoices · GET /v1/invoices/{id}
Scope: invoices.read
POST /v1/invoices
Scope: invoices.write
PATCH /v1/invoices/{id}
Scope: invoices.write · Status-update triggert webhook-events (invoice.sent, invoice.paid).
DELETE /v1/invoices/{id}
Scope: invoices.write · Alleen voor draft-invoices.
/v1/agents
GET /v1/agents
Scope: agents.read · Paginated lijst van geïnstalleerde agents.
Query params: status (active/paused/uninstalled), agentType (QuoteAgent/InvoiceAgent/PlanningAgent/CustomerCareAgent).
GET /v1/agents/{id}
Scope: agents.read · Agent + counts (runs, connectors, examples).
PATCH /v1/agents/{id}
Scope: agents.write · Update naam.
POST /v1/agents/{id}/pause
Scope: agents.write · Pauseer een actieve agent.
POST /v1/agents/{id}/resume
Scope: agents.write · Hervat een gepauzeerde agent.
GET /v1/agents/{id}/autonomy
Scope: agents.read · Huidige autonomy-config (default mode + per-action overrides).
PATCH /v1/agents/{id}/autonomy
Scope: agents.write · Wijzig autonomy-mode.
curl -X PATCH https://api.corlega.com/v1/agents/{id}/autonomy \
-H "Authorization: Bearer corlega_..." \
-H "Content-Type: application/json" \
-d '{
"defaultMode": "auto_after_approvals",
"autoAfterApprovalsCount": 10,
"actionOverrides": {
"send_invoice": { "mode": "manual" }
}
}'Modes:
manual. alle agent-acties wachten op user-goedkeuringauto_after_approvals. automatisch na N user-goedkeuringen op deze action-typeauto_instant. direct doorvoeren zonder review
GET /v1/agents/{id}/runs
Scope: agents.read · Run-historie van een agent.
Query params: status (running/success/failed).
GET /v1/agents/{id}/runs/{runId}
Scope: agents.read · Volledige run-details incl. input + output JSON.
/v1/requests
De "developer-input" endpoint. laat een eigen klantvraag of intake-formulier door de juiste agent verwerken.
GET /v1/requests
Scope: requests.read
Query params: status (new/processing/processed/failed/archived).
POST /v1/requests
Scope: requests.write · Dien een aanvraag programmatisch in.
curl -X POST https://api.corlega.com/v1/requests \
-H "Authorization: Bearer corlega_..." \
-H "Content-Type: application/json" \
-d '{
"fromEmail": "klant@voorbeeld.nl",
"fromName": "Jan de Klant",
"subject": "Offerte voor CV-onderhoud",
"bodyText": "Goedendag, kunnen jullie een prijs geven voor jaarlijks CV-onderhoud aan mijn woning?",
"externalRef": "crm-ticket-42",
"processImmediately": true
}'Response: 201 + de aangemaakte request. Set processImmediately: false als je later handmatig wil triggeren.
Luister naar de request.received en quote.created events via webhooks voor de output.
GET /v1/requests/{id}
Scope: requests.read · Inclusief agent-run output (als die er is).
/v1/webhooks
GET /v1/webhooks
Scope: webhooks.read · Alle subscriptions.
POST /v1/webhooks
Scope: webhooks.write
curl -X POST https://api.corlega.com/v1/webhooks \
-H "Authorization: Bearer corlega_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Slack-notificaties",
"url": "https://hooks.slack.com/services/...",
"events": ["invoice.paid", "quote.approved"]
}'Response bevat eenmalig signingSecret voor HMAC-verificatie. Bewaar direct. wordt niet opnieuw getoond.
GET /v1/webhooks/{id} · PATCH /v1/webhooks/{id} · DELETE /v1/webhooks/{id}
Scope: webhooks.read (GET), webhooks.write (PATCH/DELETE)
PATCH: name, url, events, active (pause/resume).
POST /v1/webhooks/{id}/test
Scope: webhooks.write · Stuurt een test-event naar de webhook-URL.
curl -X POST https://api.corlega.com/v1/webhooks/{id}/test \
-H "Authorization: Bearer corlega_..." \
-H "Content-Type: application/json" \
-d '{"eventType": "quote.approved"}'GET /v1/webhooks/events
Scope: webhooks.read · Lijst van beschikbare event-types (voor dynamic UIs).
Volgende stap
- Recipes. werkende voorbeelden van veelvoorkomende workflows
- Webhooks. payload-structuur + signature-verificatie
- Troubleshooting