REST API

Ogni azione dell'interfaccia di Celerp è un endpoint REST: la stessa API che l'interfaccia usa internamente. Automatizza i flussi di lavoro, collega altri sistemi o costruisci i tuoi strumenti. L'API gira in locale sui tuoi dati; nulla viene inviato al cloud.

🔗 URL di base

http://localhost:8000 con un'installazione pip. L'app desktop sceglie la propria porta: vedi celerp-data/api-port.

🔑 Autenticazione

Bearer JWT da /auth/login

📦 Formato

JSON in ingresso, JSON in uscita

📖 Specifica

GET /openapi.json (OpenAPI 3.1)

Quale porta? Con pip install celerp il server API gira su localhost:8000 (puoi cambiarlo con --api-port) e la porta 8080 è l'interfaccia web per le persone, non l'API. L'app desktop sceglie porte libere a ogni avvio e scrive la porta dell'API nel file api-port della sua cartella celerp-data. Per fissare la porta, imposta CELERP_API_PORT prima di avviarla.

Autenticazione

Celerp usa JSON Web Token di breve durata. Accedi con e-mail e password Celerp per ottenere un token di accesso, poi invialo come header Bearer in ogni richiesta.

1. Accedi

curl -X POST http://localhost:8000/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "your-password"}'

La risposta contiene due token:

{
  "access_token": "eyJhbGciOiJI...",
  "refresh_token": "eyJhbGciOiJI..."
}

2. Chiama l'API con il token

curl http://localhost:8000/items \
  -H "Authorization: Bearer eyJhbGciOiJI..."
  • Il token identifica utente, ruolo e azienda, quindi le richieste sono automaticamente circoscritte a quell'azienda: non serve alcun header aggiuntivo.
  • I token di accesso durano fino a 24 ore. Quando uno scade, ottieni una coppia nuova inviando il tuo refresh_token con una POST a /auth/token/refresh.
  • Appartieni a più di un'azienda? Elencale con GET /auth/my-companies, poi ottieni un token circoscritto a un'altra con POST /auth/switch-company/{company_id}.

I token contengono i tuoi permessi. Un token viewer può leggere ma non scrivere; i dati di costo richiedono il ruolo manager o superiore. Tratta i token come password: chiunque ne possieda uno può agire al posto tuo.

Effettuare le richieste

Tutti gli endpoint stanno sotto l'indirizzo del tuo server API (http://localhost:8000 con un'installazione pip, come negli esempi qui sotto) e restituiscono JSON. Gli endpoint di elenco restituiscono un array items e un conteggio total:

curl "http://localhost:8000/items?limit=20&offset=0" \
  -H "Authorization: Bearer $TOKEN"
{
  "items": [
    { "id": "item:...", "sku": "WIDGET-001", "name": "Widget", "quantity": 42 }
  ],
  "total": 142
}

Paginazione: passa ?limit= (predefinito 50) e ?offset=. Quasi tutti gli endpoint di elenco accettano anche un termine di ricerca q= e filtri di colonna (es. ?status=available).

Creare dati

Invia JSON in POST per creare record. Le scritture restituiscono l'id della nuova entità (e l'event_id sottostante: in Celerp ogni modifica è un evento).

curl -X POST http://localhost:8000/crm/contacts \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Corp",
    "email": "[email protected]",
    "contact_type": "customer",
    "idempotency_key": "acme-2026-06-21"
  }'

Idempotenza: includi una idempotency_key in ogni scrittura. Una richiesta ripetuta con la stessa chiave non crea un duplicato: al sicuro con reti instabili e job batch.

Convenzioni

  • Errori le risposte non 2xx restituiscono {"detail": "..."} con un codice di stato HTTP standard.
  • Limiti di frequenza 60 richieste al minuto per IP per impostazione predefinita; il login è limitato a 10 al minuto. Superare un limite restituisce 429.
  • Permessi l'accesso agli endpoint dipende dal tuo ruolo: viewer → operator → manager → admin → owner.
  • Ambito aziendale ogni richiesta agisce sull'azienda nel tuo token; cambia azienda per agire su un'altra.

Endpoint comuni

Una piccola selezione per iniziare. Ogni modulo aggiunge i propri: l'elenco completo è nello schema OpenAPI qui sotto.

MetodoPercorsoDescrizione
POST/auth/loginOttiene un token di accesso (nessuna autenticazione richiesta)
GET/healthStato del servizio (nessuna autenticazione richiesta)
GET/itemsElenca gli articoli di inventario
POST/itemsCrea un articolo
GET/docsElenca i documenti (fatture, ordini d'acquisto, fatture d'acquisto, …)
POST/docsCrea un documento
GET/crm/contactsElenca clienti e fornitori
POST/crm/contactsCrea un contatto
GET/dashboard/kpisKPI aziendali

Riferimento completo per area

Tutti gli endpoint esposti dall’API in esecuzione, raggruppati per area. Ogni pagina elenca metodo, path, parametri, strutture di request e response e una chiamata di esempio.

Auth

Authentication API for Celerp users, login, logout, password recovery, company switching, and API access. (13 endpoints)

Companies

Company settings and administration API for users, roles, locations, taxes, payment terms, price lists, modules, and company preferences. (70 endpoints)

Items

Inventory API for products and stock items, quantities, pricing, locations, barcodes, valuation, imports, reservations, transfers, transformations, and stock status. (39 endpoints)

Docs

Business document API for invoices, bills, purchase orders, quotations, credit notes, shipping documents, payments, fulfillment, PDF output, and document lifecycle operations. (52 endpoints)

Lists

Inventory list API for stock audits, transfers, write-offs, manifests, scans, reservations, notes, exports, and list lifecycle operations. (38 endpoints)

Accounting

Celerp accounting REST API for the chart of accounts, journal entries, general ledger, bank reconciliation, financial statements, transfers, and fiscal period controls. (59 endpoints)

Ledger

Event ledger API for reading Celerp business events and rebuilding derived application data. (3 endpoints)

Reports

ERP reporting API for accounts receivable and payable aging, sales, purchases, and expiring inventory. (5 endpoints)

Manufacturing

Manufacturing API for production orders, recipes, work centers, workflows, material requirements, costing, scheduling, component issue, and finished-goods receipt. (32 endpoints)

Labels

Inventory label and barcode API for label templates, single-item labels, bulk label sheets, and printable PDFs. (7 endpoints)

Crm

CRM REST API for customers, suppliers, contacts, addresses, people, notes, tags, files, imports, exports, and contact management. (25 endpoints)

Subscriptions

Recurring document and subscription API for invoice and purchase-order templates, scheduling, activation, pausing, resuming, cancellation, and on-demand generation. (6 endpoints)

Connectors

Integration API for connecting Celerp ERP to external commerce and business platforms, managing connector credentials, and running data synchronization. (9 endpoints)

Payments

Payment integration API for connecting payment processing, checking payment availability, and reading connection status. (7 endpoints)

Backup

Backup and restore API for exporting, importing, listing, creating, and restoring Celerp ERP backups. (8 endpoints)

Notifications

User notification API for listing notifications and marking individual or all notifications as read. (3 endpoints)

Events

Real-time server-sent events API for Celerp notifications and live application events. (1 endpoint)

System

System health, readiness, restart, and factory reset endpoints for a Celerp ERP installation. (10 endpoints)

Admin

Administrative diagnostics and system status endpoints for maintaining a Celerp ERP installation. (2 endpoints)

Ai

Celerp AI API for ERP assistant conversations, document extraction, batch jobs, memory, usage, and user-confirmed business actions. (22 endpoints)

Attachments

Inventory attachment API for uploading, downloading, tagging, previewing, and deleting item files and product images. (12 endpoints)

Dashboard

Dashboard API for ERP KPIs, recent business activity, and searchable activity history. (3 endpoints)

Payments Public

Public payment endpoints for customer payment links and payment-provider return handling. (2 endpoints)

Received

Received documents API for documents other Celerp users shared with you: list and review them, book one as your own draft, and bring a booked draft up to date with the sender's latest revision. (5 endpoints)

Search

Global Celerp ERP search API for finding permitted records across modules from a single query. (1 endpoint)

Settings

System settings and Celerp Connect API for account setup, cloud connection state, billing, backups, connectors, and partner configuration. (17 endpoints)

Share

Document sharing API for creating, inspecting, updating, and revoking public share links for Celerp documents and lists. (4 endpoints)

Share Public

Public document sharing and import endpoints for viewing shared Celerp documents and downloading or importing portable document bundles. (4 endpoints)

Stars

Supporter badge and Celerp community recognition API for badge verification, display, opt-out, and prompts. (6 endpoints)

Verticals

Industry preset and category schema API for configuring Celerp ERP fields and defaults by business vertical. (5 endpoints)

Company Backups

16 endpoints

Migrations

22 endpoints

Esplora l'API completa

Il riferimento completo e sempre aggiornato è lo schema OpenAPI 3.1 che genera la tua istanza:

GET http://localhost:8000/openapi.json

Caricalo in un qualsiasi strumento OpenAPI – Postman, Insomnia, Swagger UI o un generatore di client – per sfogliare ogni endpoint e ogni modello, provare le richieste e generare un client tipizzato nel tuo linguaggio. Celerp distribuisce lo schema anziché una pagina di documentazione ospitata, così la superficie della tua API resta privata alla tua istanza.

Preferisci il linguaggio naturale? L'assistente AI (Connect) chiama questa stessa API per te: chiedigli di estrarre un report o di creare un documento in linguaggio naturale. E ricorda: tutto quello che l'API può fare, lo fa senza accessi privilegiati – esattamente quello che potrebbe fare un utente autenticato.