REST API
Celerp の画面で行える操作は、すべて REST エンドポイントとして用意されています。UI が内部で使っているのと同じ API です。業務フローを自動化したり、他のシステムとつないだり、独自のツールを作ったりできます。API はお客様のデータとともにローカルで動き、クラウドには何も送信されません。
🔗 ベース URL
pip でインストールした場合は http://localhost:8000。デスクトップアプリは自分でポートを選びます。celerp-data/api-port を参照してください。
🔑 認証
/auth/login で取得する Bearer JWT
📦 フォーマット
JSON を受け取り、JSON を返す
📖 仕様
GET /openapi.json (OpenAPI 3.1)
どちらのポートを使いますか pip install celerp でインストールした場合、API サーバーは localhost:8000 で動きます(--api-port で変更できます)。ポート 8080 は人が操作する Web UI で、API ではありません。デスクトップアプリは起動のたびに空いているポートを選び、API のポート番号を celerp-data フォルダ内の api-port ファイルに書き込みます。ポートを固定するには、起動前に CELERP_API_PORT を設定してください。
認証
Celerp は有効期限の短い JSON Web Token を使います。Celerp のメールアドレスとパスワードでログインしてアクセストークンを取得し、すべてのリクエストに Bearer ヘッダーとして付けて送信してください。
1. ログイン
curl -X POST http://localhost:8000/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "your-password"}'
レスポンスには 2つのトークンが含まれます。
{
"access_token": "eyJhbGciOiJI...",
"refresh_token": "eyJhbGciOiJI..."
}
2. トークンを使って API を呼び出す
curl http://localhost:8000/items \
-H "Authorization: Bearer eyJhbGciOiJI..."
- トークンにはユーザー、役割、会社の情報が含まれるため、リクエストは自動的にその会社の範囲に限定されます。追加のヘッダーは要りません。
- アクセストークンの有効期間は最長24時間です。期限が切れたら、
refresh_tokenを/auth/token/refreshに POST して新しいトークンの組を取得してください。 - 複数の会社に所属している場合は、
GET /auth/my-companiesで一覧を取得し、POST /auth/switch-company/{company_id}で別の会社に紐づくトークンを取得できます。
トークンには権限が紐づきます。 viewer のトークンは読み取りのみで、書き込みはできません。原価の情報を扱うには manager 以上の役割が必要です。トークンはパスワードと同じように扱ってください。持っている人は誰でも、お客様本人として操作できてしまいます。
リクエストを送る
すべてのエンドポイントは API サーバーのアドレス(pip でインストールした場合は http://localhost:8000。以下の例もこのアドレスを使います)以下にあり、JSON を返します。一覧系のエンドポイントは items 配列と件数 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
}
ページ送り: ?limit=(既定値50)と ?offset= を指定します。ほとんどの一覧エンドポイントは、検索語 q= と列ごとの絞り込み(例:?status=available)も受け付けます。
データの作成
レコードを作成するには JSON を POST します。書き込みに成功すると、新しいエンティティの id が返ります。あわせて元になった event_id も返ります。Celerp では、あらゆる変更がイベントとして記録されます。
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"
}'
冪等性: 書き込みには idempotency_key を付けてください。同じキーで再送されたリクエストが重複を作ることはありません。通信が不安定な環境やバッチ処理でも安全です。
共通の決まりごと
- エラー 2xx 以外のレスポンスは、標準の HTTP ステータスコードとともに
{"detail": "..."}を返します。 - レート制限 既定では IP あたり毎分60リクエスト、ログインは毎分10回までです。上限を超えると
429が返ります。 - 権限 エンドポイントは役割によって制限されます:
viewer → operator → manager → admin → owner。 - 会社スコープ リクエストはすべて、トークンに紐づく会社に対して実行されます。別の会社を操作するには会社を切り替えてください。
主なエンドポイント
まず使いはじめるための、ごく一部です。モジュールごとに独自のエンドポイントが追加されます。全体は下の OpenAPI スキーマで確認できます。
| メソッド | パス | 説明 |
|---|---|---|
POST | /auth/login | アクセストークンを取得(認証不要) |
GET | /health | サービスの稼働状況(認証不要) |
GET | /items | 在庫品目を一覧取得 |
POST | /items | 品目を作成 |
GET | /docs | 書類を一覧取得(請求書、発注書、仕入先請求書 など) |
POST | /docs | 書類を作成 |
GET | /crm/contacts | 顧客・仕入先を一覧取得 |
POST | /crm/contacts | 連絡先を作成 |
GET | /dashboard/kpis | 経営 KPI |
分野別の完全なリファレンス
稼働中の API が提供するすべてのエンドポイントを分野別に整理しています。各ページには メソッド、パス、パラメーター、リクエストとレスポンスの形式、呼び出し例を掲載しています。
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
API の全体像を見る
完全で常に最新のリファレンスは、お客様自身のインスタンスが生成する OpenAPI 3.1 スキーマです。
GET http://localhost:8000/openapi.json
OpenAPI に対応したツール(Postman、Insomnia、Swagger UI、クライアント生成ツールなど)に読み込めば、すべてのエンドポイントとモデルを確認し、リクエストを試し、お使いのプログラミング言語で型付きのクライアントを生成できます。Celerp はホスト型のドキュメントページではなくスキーマそのものを提供するため、API の内容が外部に出ることはありません。
普段の言葉で指示したい場合は AI アシスタント(Connect)が、この同じ API をお客様に代わって呼び出します。レポートの取得や書類の作成を、普段の言葉で頼めます。なお、API が行えることに特別な権限は使われません。サインインした利用者ができることと、まったく同じ範囲です。