REST API

Setiap tindakan di antarmuka Celerp adalah endpoint REST - API yang sama yang digunakan UI secara internal. Otomatiskan alur kerja, hubungkan sistem lain, atau bangun alat Anda sendiri. API berjalan secara lokal dengan data Anda; tidak ada yang dikirim ke cloud.

🔗 URL Dasar

http://localhost:8000 pada instalasi pip. Aplikasi desktop memilih port sendiri: lihat celerp-data/api-port.

🔑 Autentikasi

Bearer JWT dari /auth/login

📦 Format

JSON masuk, JSON keluar

📖 Spesifikasi

GET /openapi.json (OpenAPI 3.1)

Port mana? Dengan pip install celerp, server API berjalan di localhost:8000 (ubah dengan --api-port) dan port 8080 adalah UI web untuk pengguna, bukan API. Aplikasi desktop memilih port yang kosong setiap kali dijalankan dan menulis port API ke file api-port di folder celerp-data. Untuk menetapkan port, atur CELERP_API_PORT sebelum menjalankannya.

Autentikasi

Celerp menggunakan JSON Web Token berumur pendek. Masuk dengan email dan kata sandi Celerp Anda untuk mendapatkan access token, lalu kirimkan sebagai header Bearer pada setiap permintaan.

1. Masuk

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

Respons berisi dua token:

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

2. Panggil API dengan token

curl http://localhost:8000/items \
  -H "Authorization: Bearer eyJhbGciOiJI..."
  • Token mengidentifikasi pengguna, peran, dan perusahaan Anda, sehingga permintaan secara otomatis dibatasi ke perusahaan tersebut - tidak perlu header tambahan.
  • Access token berlaku hingga 24 jam. Saat kedaluwarsa, dapatkan pasangan baru dengan melakukan POST refresh_token ke /auth/token/refresh.
  • Tergabung di lebih dari satu perusahaan? Tampilkan daftarnya dengan GET /auth/my-companies, lalu ambil token untuk perusahaan lain dengan POST /auth/switch-company/{company_id}.

Token membawa izin Anda. Token viewer hanya bisa membaca, tidak menulis; data biaya membutuhkan peran manager atau lebih tinggi. Perlakukan token seperti kata sandi - siapa pun yang memegangnya dapat bertindak sebagai Anda.

Membuat permintaan

Semua endpoint berada di bawah alamat server API Anda (http://localhost:8000 pada instalasi pip, seperti pada contoh di bawah) dan mengembalikan JSON. Endpoint daftar mengembalikan array items dan jumlah 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
}

Paginasi: kirim ?limit= (default 50) dan ?offset=. Sebagian besar endpoint daftar juga menerima kata kunci pencarian q= dan filter kolom (mis. ?status=available).

Membuat data

Kirim POST berisi JSON untuk membuat data. Operasi tulis mengembalikan id entitas baru (dan event_id yang mendasarinya - setiap perubahan di Celerp adalah sebuah event).

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"
  }'

Idempotensi: sertakan idempotency_key pada setiap penulisan. Permintaan yang dicoba ulang dengan kunci yang sama tidak akan membuat duplikat - aman untuk jaringan tidak stabil dan pekerjaan batch.

Konvensi

  • Kesalahan respons non-2xx mengembalikan {"detail": "..."} dengan kode status HTTP standar.
  • Batas laju permintaan 60 permintaan/menit per IP secara default; login dibatasi 10/menit. Melebihi batas mengembalikan 429.
  • Izin endpoint dikontrol oleh peran Anda: viewer → operator → manager → admin → owner.
  • Cakupan perusahaan setiap permintaan bertindak pada perusahaan dalam token Anda; ganti perusahaan untuk bertindak pada yang lain.

Endpoint umum

Sebagian kecil untuk memulai. Setiap modul menambahkan miliknya sendiri - daftar lengkap ada di skema OpenAPI di bawah.

MetodePathDeskripsi
POST/auth/loginDapatkan access token (tidak perlu autentikasi)
GET/healthStatus layanan (tidak perlu autentikasi)
GET/itemsDaftar item persediaan
POST/itemsBuat item
GET/docsDaftar dokumen (faktur, PO, tagihan, …)
POST/docsBuat dokumen
GET/crm/contactsDaftar pelanggan & pemasok
POST/crm/contactsBuat kontak
GET/dashboard/kpisKPI bisnis

Referensi lengkap per area

Setiap endpoint yang disediakan API yang sedang berjalan, dikelompokkan per area. Setiap halaman mencantumkan method, path, parameter, bentuk request dan response, serta contoh pemanggilan.

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

Jelajahi API lengkap

Referensi lengkap dan selalu terkini adalah skema OpenAPI 3.1 yang dihasilkan oleh instance Anda sendiri:

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

Muat ke alat OpenAPI apa pun - Postman, Insomnia, Swagger UI, atau generator client - untuk menelusuri setiap endpoint dan model, mencoba permintaan, dan menghasilkan client bertipe dalam bahasa Anda. Celerp memberikan skemanya sendiri, bukan halaman dokumentasi yang dihosting, sehingga cakupan API Anda tetap privat di instance Anda.

Lebih suka bahasa alami? Asisten AI (Connect) memanggil API yang sama ini untuk Anda - minta untuk menarik laporan atau membuat dokumen dalam bahasa alami. Dan ingat: apa pun yang bisa dilakukan API, dilakukan tanpa akses khusus - persis seperti yang bisa dilakukan pengguna yang masuk.