API Reference
REST API for integrations with external systems.
Interactive documentation available via Swagger UI at /api/docs — test endpoints directly in the browser.
Authentication
All API requests require an API key in the X-API-Key header. Create a key via Settings > API keys.
curl -X GET "https://your-project.supabase.co/functions/v1/api/contacts" \
-H "X-API-Key: ftj_your_api_key_here"Contacts
Full CRUD for customers.
| Method | Path | Description |
|---|---|---|
GET | /contacts | List all contacts |
POST | /contacts | Create contact |
GET | /contacts/{id} | Get contact |
PUT | /contacts/{id} | Update contact |
DELETE | /contacts/{id} | Delete contact |
Products
Full CRUD for products.
| Method | Path | Description |
|---|---|---|
GET | /products | List all products |
POST | /products | Create product |
GET | /products/{id} | Get product |
PUT | /products/{id} | Update product |
DELETE | /products/{id} | Delete product |
Invoices
Create, retrieve, filter and update invoices. Ideal for external systems that register invoices.
| Method | Path | Description |
|---|---|---|
POST | /invoices | Create invoice with lines (auto calculation) |
GET | /invoices | List with filters: status, contact_id, limit, offset |
GET | /invoices/{id} | Invoice with lines and contact data |
PATCH | /invoices/{id} | Update status, due date or note |
Create invoice example
POST /invoices
X-API-Key: ftj_...
{
"contact_id": "uuid-of-customer",
"status": "verzonden",
"invoice_date": "2026-04-11",
"due_date": "2026-05-11",
"lines": [
{
"description": "Spont POS Licentie",
"quantity": 1,
"unit_price_incl": 89.00,
"tax_percentage": 21,
"product_id": "uuid-of-product"
},
{
"description": "Installatie",
"quantity": 2,
"unit_price_incl": 125.00,
"tax_percentage": 21
},
{
"description": "Notitie: Levering binnen 5 werkdagen",
"is_text_line": true
}
]
}
→ Invoice created with auto-calculated totalsRegister payment
After creating an invoice you can register a payment. The invoice status is automatically updated to 'partially paid' or 'paid'.
POST /payments
X-API-Key: ftj_...
{
"invoice_id": "uuid-of-invoice",
"amount": 339.00,
"payment_date": "2026-04-11",
"external_method": "bank_transfer",
"external_reference": "TXN-12345",
"note": "Betaling ontvangen via extern systeem"
}
→ Invoice status updated to "betaald"Quotes
| Method | Path | Description |
|---|---|---|
GET | /quotes | List with filters |
GET | /quotes/{id} | Quote with lines |
PATCH | /quotes/{id} | Update status |
Subscriptions
| Method | Path | Description |
|---|---|---|
GET | /subscriptions | List with filters |
GET | /subscriptions/{id} | Subscription with lines |
PATCH | /subscriptions/{id} | Update status |
Payments
| Method | Path | Description |
|---|---|---|
GET | /payments | List payments |
POST | /payments | Register payment (updates invoice amount_paid) |
GET | /payments/{id} | Get payment |
Client portal endpoint
The /client-portal/{external_id} endpoint returns all data for a customer in one request. Ideal for chatbot integrations.
GET /client-portal/CRM-12345
{
"contact": { "name": "Acme BV", "email": "info@acme.nl", ... },
"summary": {
"open_invoice_count": 2,
"open_invoice_amount": 850.00,
"active_subscriptions": 1,
"balance": 125.50
},
"invoices": [...],
"quotes": [...],
"subscriptions": [...],
"recent_payments": [...]
}Query parameters
The list endpoints support these filters:
| Parameter | Type | Description |
|---|---|---|
status | string | Filter by status (e.g. 'verzonden', 'betaald') |
contact_id | UUID | Filter by customer ID |
limit | integer | Maximum results (default 100, max 500) |
offset | integer | Skip first N results (for pagination) |
Webhook events
The API triggers webhooks for these events:
contact.created,contact.updated,contact.deletedproduct.created,product.updated,product.deletedinvoice.updated,quote.updated,subscription.updatedpayment.created
OpenAPI / Swagger
The full API specification is available as OpenAPI 3.0 JSON at /openapi.json. Interactive Swagger UI is available at /docs.