Sapientia ERP
Developers
A plain JSON API over HTTPS, two ways in. Your own systems: create a key under Settings → API keys, choose its scopes and optionally bind it to one company; keys look like sk_live_erp_… (or sk_test_erp_… for test keys, which are accepted but flagged). Apps for other companies: register in the developer console and use OAuth 2.0; your app is listed in the marketplace once approved.
Authentication
curl https://erp.sapientiainformationsolutions.com/api/v1/companies \ -H "Authorization: Bearer sk_live_erp_…" # or an app's access token: sat_…
Every response is { "data": … } or { "error": { "code", "message" } }. Codes: unauthenticated (401), forbidden (403, missing scope or wrong company), rate_limited (429, apps only: per connected company, 120 calls a minute unless agreed otherwise), not_found, invalid_request (400/422), query_failed (500). Dates are YYYY-MM-DD; timestamps ISO 8601; money is PHP with two decimals.
Scopes
accounts:read· see your companies and chart of accountsjournals:read· see journal entries and their linesjournals:write· create journal entries and submit, post or reverse themreports:read· read reports such as the trial balanceinvoices:read· see your sales invoices and what is still unpaidbills:read· see your supplier bills and what you still owepayments:read· see payments you received and madeparties:read· see your customers and suppliers (names, tin, contact details)parties:write· add customers and suppliersitems:read· see your products, prices and stock on handorders:read· see online orders from your sales channelsorders:write· send in online orders (they become invoices and receipts) and mark them shippedpostings:write· post daily sales summaries and pos shift closes into your bookstickets:write· open helpdesk ticketswebhooks:manage· receive notices when entries post or orders change
Idempotency
Daily summaries are keyed by company + app + date; channel orders by channel + external_id; tickets by channel + external_ref; journals accept an idempotency_key. Re-sending returns the original with replayed: true and HTTP 200.
Companies and accounts
/api/v1/companiesscope accounts:readCompanies the key can post to.
{ "data": [{ "id", "name", "tin", "base_currency" }] }/api/v1/accountsscope accounts:readChart of accounts of a company.
Query: company (required unless the key is bound to one)
Journals
/api/v1/journalsscope journals:readList journals.
Query: company · status=draft|submitted|posted|cancelled · from, to (posting_date) · limit (≤500)
/api/v1/journalsscope journals:writeCreate a journal (draft, or posted when post=true and the key may post). If the company tracks stock (Inventory → Stock tracking), a line on a stock-tracked purchase account posts to its inventory account; send "skip_stock_map": true on a line (or "stock_map": false on the journal) to keep the account as sent.
{ "company": "<uuid>", "posting_date": "2026-10-12", "memo": "…", "reference": "…", "idempotency_key": "…", "post": true, "lines": [{ "account": "1010", "debit": 1000 }, { "account": "4010", "credit": 1000, "memo": "…" }] }/api/v1/journals/{id}scope journals:readOne journal with lines.
/api/v1/journals/{id}/transitionscope journals:writeMove a journal through its workflow.
{ "action": "submit" | "post" | "reverse", "note": "…" }App feeds (postings)
/api/v1/postings/daily-summaryscope postings:writeOne call per business day: movements by bucket become one posted journal through the company's mapping; balances are kept for the sub-ledger report. Same day twice returns the same journal.
{ "company": "<uuid>", "app": "shop_daily", "date": "2026-10-11", "movements": { "sales": 12500, "fees": 1250, "payouts": 9800 }, "balances": { "escrow_held": 431, "wallet_balances": 3500 } }/api/v1/postings/shift-closescope postings:writePOS shift close: sales by payment method, discounts, tips, cash drawer variance, pay ins/outs, partner goods, (optional) cost of the shop's own goods sold and customer accounts (pay later charges and payments), posted as one journal. cogs = { business key: amount at cost } with the same keys as sales; each posts Dr cost of sales / Cr inventory per the mapping's cogs block ("*" = fallback); zero or absent posts nothing, a negative amount reverses. Partner goods are not included in cogs. Customer accounts (pay later): on_account = [{ customer_id, customer_name, amount, receipt_no? }] are sales charged to a customer (at gross after discounts; already in sales, NOT in tenders), each posting Dr the mapping's on_account.account (receivable) with the customer; account_payments = [{ customer_id, customer_name, amount, method }] are customers paying their account (NOT in sales nor tenders), each posting Dr the tender's account (same tenders mapping, method = tender key) / Cr the receivable with the customer. The customer is matched by the POS customer id (party custom.pos_customer_id), else by name, else created as a customer; their charges and payments show on the customer's page, statement and the AR aging (payments pay the oldest charge first). Amounts must be > 0 and ids, names (and method) are required (400 invalid_request).
{ "company": "<uuid>", "idempotency_key": "kk-2026-10-16-pm", "business_date": "2026-10-16", "sales": { "cafe": 2095, "beantol": 850 }, "tenders": { "cash": 1652, "gcash": 2019 }, "partner_sales": [{ "key": "keto-kakanin", "name": "Keto Kakanin", "gross": 726 }], "cogs": { "cafe": 812.40, "beantol": 1540.00 }, "on_account": [{ "customer_id": "<pos customer uuid>", "customer_name": "YDG", "amount": 3200, "receipt_no": "000412" }], "account_payments": [{ "customer_id": "<pos customer uuid>", "customer_name": "Cakes by Grace", "amount": 1500, "method": "unionbank" }] }{ "data": { "id", "number", "status": "posted" }, "summary": { "gross_sales", "tenders", "over_short", "cost_of_sales", "on_account", "account_payments", … }, "replayed": false } (422 mapping_incomplete when cogs is sent but the mapping has no cogs rule for a key and no "*", or on_account / account_payments are sent and the mapping has no on_account: { "account": "1100" })Orders and catalogue (e-commerce)
/api/v1/ordersscope orders:writePush a shop order to a sales channel. Deduped on channel + external_id (replayed: true). Becomes customer, sales order, invoice and receipt per the channel's settings.
{ "company": "<uuid>", "channel": "shopify", "order": { "external_id": "1001", "number": "#1001", "ordered_at": "2026-10-12T10:00:00+08:00", "customer": { "name": "Ana Cruz", "email": "ana@example.com", "phone": "0917…" }, "ship_to": "12 Mango Ave, Cebu City", "payment_method": "gcash", "paid": true, "discount": 50, "shipping_fee": 80, "platform_fee": 0, "lines": [{ "sku": "BEANS-250", "name": "House blend 250g", "qty": 2, "unit_price": 450 }] } }{ "data": { "channel_order_id", "status": "invoiced", "sales_order_id", "invoice_id", "payment_id", "total", "warning" }, "replayed": false } (422 with status "failed" and error when a SKU is unknown)/api/v1/ordersscope orders:readList channel orders.
Query: company · channel (key) · status · from · limit
/api/v1/orders/{id}scope orders:readOne channel order with its raw payload and links.
/api/v1/orders/{id}/shipscope orders:writeMark shipped; creates the shipment (and the delivery when stock has not left yet).
{ "tracking_no": "JT123", "carrier": "J&T Express" }/api/v1/itemsscope items:readCatalogue for a storefront: sku, barcode, name, price (party price list when party is given), stock on hand.
Query: company · party (optional customer id for its price list) · updated_since (ISO timestamp)
Sales and purchases
/api/v1/invoicesscope invoices:readSales invoices with totals, paid and balance.
Query: company · status=draft|posted|paid|cancelled · from, to (invoice_date) · party · updated_since · limit (≤500)
/api/v1/billsscope bills:readSupplier bills with totals, paid and balance.
Query: company · status · from, to (bill_date) · party · updated_since · limit (≤500)
/api/v1/paymentsscope payments:readReceipts (kind=receipt) and payments (kind=payment).
Query: company · status · from, to (payment_date) · party · updated_since · limit (≤500)
/api/v1/partiesscope parties:readCustomers and suppliers this company deals with.
Query: company · kind=customer|supplier · q (name contains) · updated_since · limit (≤1000)
/api/v1/partiesscope parties:writeAdd a customer or supplier. The same TIN (or name, without a TIN) among the company's parties returns the existing one with replayed: true.
{ "company": "<uuid>", "kind": "customer", "name": "Dela Cruz Trading", "tin": "123-456-789-000", "email": "…", "phone": "…", "terms_days": 30 }Support
/api/v1/ticketsscope tickets:writeOpen a helpdesk ticket from an app. Same external_ref returns the existing ticket.
{ "company": "<uuid>", "subject": "Order late", "body": "…", "priority": "high", "channel": "api", "external_ref": "order-77", "contact": { "name", "email", "phone" }, "category": "Delivery", "tags": ["delivery"] }Reports
/api/v1/reports/trial-balancescope reports:readTrial balance for a range.
Query: company · from · to
Webhooks
/api/v1/webhooksscope webhooks:manageYour subscriptions.
/api/v1/webhooksscope webhooks:manageSubscribe a URL to events. Deliveries are signed with HMAC-SHA256 of the body using the subscription secret (header X-Sapientia-Signature) and retried with back-off.
{ "url": "https://example.com/hook", "events": ["journal.posted", "order.received", "order.shipped", "order.cancelled"], "description": "…" }/api/v1/webhooks/{id}scope webhooks:manageRemove a subscription.
Webhook events
journal.posted (journals:read), order.received (orders:read), order.shipped (orders:read), order.cancelled (orders:read). Each delivery is a POST with JSON { "id", "event", "created_at", "data" } and headers X-ERP-Event, X-ERP-Timestamp and X-ERP-Signature: v1=<hex>, where hex = HMAC-SHA256(secret, timestamp + "." + body). Reject timestamps older than five minutes. Failed deliveries retry after 1, 5, 15, 60, 240 and 720 minutes. An app's subscriptions only carry events of the company it is connected to, and only events whose read scope it holds.
Apps for other companies: OAuth 2.0
Authorization code flow with PKCE (S256 only) and a client secret. A company owner or admin approves your app for one company on a Sapientia consent screen that lists your scopes in plain words; they can disconnect it any time, which revokes every token at once. Every API call an app makes is written to the company's app activity log.
Quick start
- Sign in (any Sapientia account, or start a trial) and open the developer console. Registering creates your developer organisation and a sandbox tenant with sample customers, items, invoices and bills.
- Register an app: name, redirect URIs (matched exactly; https, or http on localhost), scopes, optional webhook URL and events, logo and pricing. Copy the client secret: it is shown once and stored hashed.
- Switch to your sandbox from the company menu and run the flow below. Until Sapientia approves the app, only your sandbox can connect it.
- Submit for review. Once approved it is listed in the marketplace and any company can install it. Asking for more scopes later sends the app back to review; companies keep the approved scopes and re-consent to new ones.
1. Send the user to the consent screen
code_verifier = base64url(32 random bytes) # keep it server-side code_challenge = base64url(sha256(code_verifier)) GET https://erp.sapientiainformationsolutions.com/oauth/authorize ?response_type=code &client_id=app_… &redirect_uri=https%3A%2F%2Fyourapp.example%2Fcallback &scope=invoices:read%20parties:read &state=<random, check it on return> &code_challenge=<code_challenge> &code_challenge_method=S256
The user signs in if needed, picks the company and approves. You get ?code=sac_…&state=… on your redirect URI, or ?error=access_denied. Codes expire after two minutes and work once; using one twice revokes the tokens it issued.
2. Exchange the code
curl https://erp.sapientiainformationsolutions.com/oauth/token \
-u "app_…:scs_…" \
-d grant_type=authorization_code \
-d code=sac_… \
-d redirect_uri=https://yourapp.example/callback \
-d code_verifier=<code_verifier>
{ "access_token": "sat_…", "token_type": "Bearer", "expires_in": 3600,
"refresh_token": "srt_…", "scope": "invoices:read parties:read",
"company_id": "<uuid>", "installation_id": "<uuid>" }3. Call the API
curl "https://erp.sapientiainformationsolutions.com/api/v1/invoices?status=posted" -H "Authorization: Bearer sat_…"
An access token is bound to the one company it was granted for (the company parameter may be left out). Each call needs its endpoint's scope; you get 403 forbidden otherwise.
4. Refresh, and revoke
curl https://erp.sapientiainformationsolutions.com/oauth/token -u "app_…:scs_…" -d grant_type=refresh_token -d refresh_token=srt_… curl https://erp.sapientiainformationsolutions.com/oauth/revoke -u "app_…:scs_…" -d token=srt_…
Refresh tokens last 60 days and rotate: every refresh returns a new pair and the old refresh token stops working. Presenting a used refresh token again is treated as theft and revokes the whole chain, so store the newest one atomically. A refresh may pass a narrower scope, never a wider one. Revoking a refresh token revokes its chain. Client credentials may also be sent in the body as client_id and client_secret. Errors follow RFC 6749: { "error": "invalid_grant", "error_description": "…" }.
Scopes in plain words
accounts:read· shown as “See your companies and chart of accounts” · GET /api/v1/companies, GET /api/v1/accountsjournals:read· shown as “See journal entries and their lines” · GET /api/v1/journals, GET /api/v1/journals/{id}journals:write· shown as “Create journal entries and submit, post or reverse them” · POST /api/v1/journals, POST /api/v1/journals/{id}/transitionreports:read· shown as “Read reports such as the trial balance” · GET /api/v1/reports/trial-balanceinvoices:read· shown as “See your sales invoices and what is still unpaid” · GET /api/v1/invoicesbills:read· shown as “See your supplier bills and what you still owe” · GET /api/v1/billspayments:read· shown as “See payments you received and made” · GET /api/v1/paymentsparties:read· shown as “See your customers and suppliers (names, TIN, contact details)” · GET /api/v1/partiesparties:write· shown as “Add customers and suppliers” · POST /api/v1/partiesitems:read· shown as “See your products, prices and stock on hand” · GET /api/v1/itemsorders:read· shown as “See online orders from your sales channels” · GET /api/v1/orders, GET /api/v1/orders/{id}orders:write· shown as “Send in online orders (they become invoices and receipts) and mark them shipped” · POST /api/v1/orders, POST /api/v1/orders/{id}/shippostings:write· shown as “Post daily sales summaries and POS shift closes into your books” · POST /api/v1/postings/daily-summary, POST /api/v1/postings/shift-closetickets:write· shown as “Open helpdesk tickets” · POST /api/v1/ticketswebhooks:manage· shown as “Receive notices when entries post or orders change” · GET /api/v1/webhooks, POST /api/v1/webhooks, DELETE /api/v1/webhooks/{id}
Webhooks for apps
Set a webhook URL and events on the app: each connected company gets a subscription signed with your app's webhook secret (developer console → Show webhook signing secret). Apps can also manage extra subscriptions with webhooks:manage; they see and delete only their own.
Pricing and review
Apps are free, included in the plan, or paid per connected company per month. Paid apps are billed on the company's Sapientia invoice; your revenue share is recorded per invoice and settled with Sapientia separately. Review checks the listing, the scopes against what the app does, the privacy policy and the support link.