Quick start
- In Prof open Settings → API & integrations and press New token. Choose what it may see and do, its branches and its expiry. Copy the token: it is shown only once.
- Call the API with it:
curl https://prof-api.silverthinking.net/v1/me -H "Authorization: Bearer prof_live_…"
Every answer is JSON. Success: {"data": …} (lists add "pagination"). Failure: {"error": {"code", "message", "details", "request_id"}} with the right HTTP status. Money is a number in the account's currency; dates are ISO 8601 in UTC; inputs take YYYY-MM-DD.
Authentication
Send the token in the Authorization: Bearer header over HTTPS. Never put it in a URL or in code that runs in a browser or a phone app: the API is for servers and agents. Prof stores only a fingerprint of the token.
- Expiry: 30, 90 (default) or 365 days, a date, or never (the account owner accepts that risk explicitly). Prof sends a reminder 7 days before.
- IP allow-list: a token can be limited to your server's addresses (IPs or CIDR ranges). Strongly recommended.
- Revoke a token in Prof at any moment; it stops at once.
Same rules as the app
Rate limits
Each token has a budget of 60 units a minute and 20000 a day (the account may have other values; GET /v1/me shows them). A read costs 1, a list with limit above 50 costs 3, a write costs 2. Every answer carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix time). Over the budget you get 429 with Retry-After. A token that keeps going over the limit is paused for 15 minutes and the account's administrators are told.
Polling is the expensive way to stay in sync: use events and webhooks.
Pagination
Lists take limit (1–100, default 25) and offset, newest first, and answer "pagination": {"limit", "offset", "has_more", "next_offset"}. Pass next_offset as offset until has_more is false.
Idempotency
Send a unique Idempotency-Key header (a UUID) with every POST. If the network fails and you retry with the same key and body, the bill or payment is made only once and you get the first answer again. The same key with a different body is refused (IDEMPOTENCY_KEY_REUSED). Keys are kept 24 hours per token.
Errors
| HTTP | code | Meaning |
|---|---|---|
| 400 | INVALID_JSON | The body is not a JSON object. |
| 400 | INVALID_PARAMETER / INVALID_DATE / INVALID_CODE | A query value or path code is not valid (dates are YYYY-MM-DD). |
| 400 | INVALID_IDEMPOTENCY_KEY | Idempotency-Key must be 8–100 characters of letters, digits, "-" or "_". |
| 401 | MISSING_TOKEN | No "Authorization: Bearer <token>" header. |
| 401 | INVALID_TOKEN | Unknown token. |
| 401 | TOKEN_EXPIRED | The token passed its expiry date. Extend it in Prof. |
| 401 | TOKEN_REVOKED | Someone revoked the token in Prof. |
| 403 | IP_NOT_ALLOWED | The token is limited to other IP addresses. |
| 403 | FORBIDDEN | The token lacks a permission; details.missing_permission names it when known. |
| 403 | BRANCH_ACCESS_DENIED | The token is limited to other branches. |
| 403 | PLAN_NOT_PREMIUM | The account is not on a paid plan. |
| 403 | API_DISABLED / DOMAIN_SUSPENDED | The API or the account is switched off. Contact support. |
| 404 | NOT_FOUND | No such endpoint, or no such record (or not visible to this token). |
| 405 | METHOD_NOT_ALLOWED | The path exists with another method. |
| 409 | SIMILAR_RECORDS_EXIST | A customer/supplier with this phone (or name) exists; details.existing lists them. A phone can never be reused; for the same name with another phone send "allow_similar": true. |
| 409 | IDEMPOTENCY_IN_PROGRESS | The first request with this key is still running. Retry in a moment. |
| 413 | BODY_TOO_LARGE | Bodies are limited to 256 KB. |
| 422 | VALIDATION_FAILED | The request breaks one of the account's rules (stock, prices, missing data...); message says which. |
| 422 | INSUFFICIENT_FUNDS | The vault or payment method does not hold enough money. |
| 422 | BRANCH_REQUIRED | Say which branch (the token works in more than one). |
| 422 | IDEMPOTENCY_KEY_REUSED | The same key was used with a different request. |
| 422 | <business codes> | The same refusals the app gives, e.g. CUSTOMER_HAS_BILLS, SUPPLIER_HAS_BILLS, INSUFFICIENT_STOCK, BILL_HAS_RETURNS, SUPPLY_BILL_GOODS_SOLD. |
| 429 | RATE_LIMITED | Over the per-minute budget. Wait Retry-After seconds. |
| 429 | DAILY_LIMIT_REACHED | Over the per-day budget; resets at midnight Cairo time. |
| 429 | TOKEN_PAUSED | Went over the limit repeatedly; paused for 15 minutes. |
| 500 | SERVER_ERROR | Our fault. Safe to retry with the same Idempotency-Key. |
| 503 | MAINTENANCE / API_UNAVAILABLE | Try again shortly (Retry-After). |
Events & webhooks
Every create, edit and delete — made in the app, through the API or by Prof itself — becomes an Event. Event types: customer.created, customer.updated, customer.deleted, supplier.created, supplier.updated, supplier.deleted, product.created, product.updated, product.deleted, sales_bill.created, sales_bill.updated, sales_bill.deleted, purchase_bill.created, purchase_bill.updated, purchase_bill.deleted, payment.created, payment.updated, payment.deleted, expense.created, expense.updated, expense.deleted.
Pull: GET /v1/events?after=<last id you saw> returns the next events, oldest first; keep pagination.next_after for the next call. Deletes are kept a year, other events 90 days.
Push: in Prof → API & integrations → Webhooks add your HTTPS address and the events you want. Prof POSTs the event JSON to it with these headers:
| Header | |
|---|---|
Prof-Event-Id | The event id. You may get an event twice: ignore ids you already handled. |
Prof-Event-Type | e.g. sales_bill.created |
Prof-Delivery-Attempt | 1 for the first try. |
Prof-Signature | t=<unix time>,v1=<hex HMAC-SHA256 of "<t>.<raw body>" with your webhook secret> |
Answer any 2xx within 5 seconds (do slow work afterwards). Anything else is retried after 30 s, 1 min, 2 min… up to 6 h between tries, 12 tries in all; 50 failures in a row switch the webhook off. Check the signature and reject old timestamps:
// Node.js (Express: use express.raw() so the body stays raw)
const crypto = require('crypto');
function verify(rawBody, header, secret) {
const { t, v1 } = Object.fromEntries(header.split(',').map(p => p.split('=')));
if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
const mac = crypto.createHmac('sha256', secret).update(t + '.' + rawBody).digest('hex');
return crypto.timingSafeEqual(Buffer.from(mac), Buffer.from(v1));
}
# Python
import hmac, hashlib, time
def verify(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(p.split('=', 1) for p in header.split(','))
if abs(time.time() - int(parts['t'])) > 300:
return False
mac = hmac.new(secret.encode(), parts['t'].encode() + b'.' + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(mac, parts['v1'])
// PHP
function verify(string $raw, string $header, string $secret): bool {
parse_str(str_replace(',', '&', $header), $p);
if (abs(time() - (int) $p['t']) > 300) return false;
return hash_equals(hash_hmac('sha256', $p['t'] . '.' . $raw, $secret), $p['v1']);
}
The event says what changed; read the record (GET by its code) for its current state. An event's source tells you whether your own program made the change (api), so it can skip echoes.
The API marker
Whatever a token creates or edits is stored with created_by / edited_by = API · <token name>, and the Prof app shows a purple API badge on it everywhere. Nobody can fake that marker from the app. Every delete, from anywhere, is kept in the account's change log with the deleted data.
MCP for AI agents
Agents that speak the Model Context Protocol can use Prof directly: every endpoint here is also an MCP tool (customers_list, sales_bills_create…). The server is https://prof-api.silverthinking.net/mcp (Streamable HTTP, JSON answers, no session) with the same Bearer token, so the same permissions, branches, limits, logs and rules apply. An agent is shown only the tools its token can use; records it writes say API · <token name> (MCP), and its calls show in the request log with (MCP).
# Claude Code
claude mcp add --transport http prof https://prof-api.silverthinking.net/mcp --header "Authorization: Bearer $PROF_TOKEN"
// Clients configured with JSON (Cursor, VS Code, …)
{ "mcpServers": { "prof": { "url": "https://prof-api.silverthinking.net/mcp", "headers": { "Authorization": "Bearer prof_live_…" } } } }
Write tools take an optional idempotency_key. A refused call comes back as a tool result with isError: true and the same error object as the REST API; a missing or wrong token answers HTTP 401. Give the agent its own token with only what it needs (view only, if it must never change anything).
GET /v1/me
The token itself: its name, permissions, branches, expiry and rate limits.
curl https://prof-api.silverthinking.net/v1/me \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/branches
The branches this token may work in.
curl https://prof-api.silverthinking.net/v1/branches \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/warehouses
Warehouses, with the branches each one serves.
curl https://prof-api.silverthinking.net/v1/warehouses \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/vaults
Vaults (cash boxes) per branch. No balances.
curl https://prof-api.silverthinking.net/v1/vaults \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/payment-methods
Payment methods (InstaPay, wallets, cards...).
curl https://prof-api.silverthinking.net/v1/payment-methods \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/categories
Product categories.
curl https://prof-api.silverthinking.net/v1/categories \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/customers
Customers, newest first, with what each one owes.
| Name | In | Type | Description |
|---|---|---|---|
search | query | string | Name, phone, company or code. |
limit | query | integer | Rows per page, 1–100 (default 25). More than 50 costs 3 units. |
offset | query | integer | Rows to skip (default 0). |
curl https://prof-api.silverthinking.net/v1/customers \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/customers/{code}
One customer.
curl https://prof-api.silverthinking.net/v1/customers/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"POST /v1/customers
Add a customer. The code is given automatically. A phone another customer or supplier already has is refused.
| Name | In | Type | Description |
|---|---|---|---|
name | body | string | The name. Required. |
phone | body | string | Mobile number, e.g. 01012345678. |
phone2 | body | string | A second mobile number. |
company | body | string | Company. |
address | body | string | Address. |
gender | body | string (male | female) | Gender (some accounts require it). |
opening_balance | body | number | What the customer already owes from before (0 if nothing). |
notes | body | string | Notes. |
allow_similar | body | boolean | false (default): a customer with the same name is reported (409 SIMILAR_RECORDS_EXIST) instead of added. true: add anyway. |
curl -X POST https://prof-api.silverthinking.net/v1/customers \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"name":"Mona Adel"}'PATCH /v1/customers/{code}
Change a customer. Only the fields sent change; an empty string clears a field.
| Name | In | Type | Description |
|---|---|---|---|
name | body | string | Name. |
phone | body | string | Phone. |
phone2 | body | string | Second phone. |
company | body | string | Company. |
address | body | string | Address. |
gender | body | string (male | female) | Gender. |
notes | body | string | Notes. |
curl -X PATCH https://prof-api.silverthinking.net/v1/customers/CL7 \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-d '[]'DELETE /v1/customers/{code}
Delete a customer. Refused (CUSTOMER_HAS_BILLS) once the customer has any bill, like in the app.
curl -X DELETE https://prof-api.silverthinking.net/v1/customers/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/suppliers
Suppliers, newest first, with what is owed to each one.
| Name | In | Type | Description |
|---|---|---|---|
search | query | string | Name, phone, company or code. |
limit | query | integer | Rows per page, 1–100 (default 25). More than 50 costs 3 units. |
offset | query | integer | Rows to skip (default 0). |
curl https://prof-api.silverthinking.net/v1/suppliers \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/suppliers/{code}
One supplier.
curl https://prof-api.silverthinking.net/v1/suppliers/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"POST /v1/suppliers
Add a supplier. The code is given automatically.
| Name | In | Type | Description |
|---|---|---|---|
name | body | string | The name. Required. |
phone | body | string | Mobile number. |
phone2 | body | string | A second mobile number. |
address | body | string | Address. |
field | body | string | Line of business. |
allow_similar | body | boolean | See POST /v1/customers. |
curl -X POST https://prof-api.silverthinking.net/v1/suppliers \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"name":"Mona Adel"}'PATCH /v1/suppliers/{code}
Change a supplier. Only the fields sent change; an empty string clears a field.
| Name | In | Type | Description |
|---|---|---|---|
name | body | string | Name. |
phone | body | string | Phone. |
phone2 | body | string | Second phone. |
company | body | string | Company. |
address | body | string | Address. |
field | body | string | Line of business. |
notes | body | string | Notes. |
curl -X PATCH https://prof-api.silverthinking.net/v1/suppliers/CL7 \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-d '[]'DELETE /v1/suppliers/{code}
Delete a supplier. Refused (SUPPLIER_HAS_BILLS) once the supplier has any bill.
curl -X DELETE https://prof-api.silverthinking.net/v1/suppliers/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/products
Products (not deleted), newest first. Purchase cost only with view_purchase_prices.
| Name | In | Type | Description |
|---|---|---|---|
search | query | string | Part of the name. |
category | query | string | A category code. |
barcode | query | string | Exact product code / barcode. |
limit | query | integer | Rows per page, 1–100 (default 25). More than 50 costs 3 units. |
offset | query | integer | Rows to skip (default 0). |
curl https://prof-api.silverthinking.net/v1/products \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/products/{code}
One product (every variant sharing the code).
curl https://prof-api.silverthinking.net/v1/products/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/products/{code}/stock
Quantity of one product per warehouse.
curl https://prof-api.silverthinking.net/v1/products/CL7/stock \
-H "Authorization: Bearer $PROF_TOKEN"POST /v1/products
Register a new product (quantity comes with a purchase bill or a stock-take). The same name and specs twice is refused.
| Name | In | Type | Description |
|---|---|---|---|
name | body | string | Product name. Required. |
sale_price | body | number | Retail price. Required. |
wholesale_price | body | number | Wholesale price. |
unit | body | string | Unit (piece, box, kilo...). |
barcode | body | string | Barcode; empty = given automatically. |
specs | body | array | Specifications, e.g. [{"name":"Size","value":"1 L"}]. Each item: name: string, value: string |
curl -X POST https://prof-api.silverthinking.net/v1/products \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"name":"Mona Adel","sale_price":120}'DELETE /v1/products/{code}
Delete a product (soft delete, like the app: old bills and batches keep it).
curl -X DELETE https://prof-api.silverthinking.net/v1/products/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/stock
Stock batches (product, warehouse, quantity, expiry).
| Name | In | Type | Description |
|---|---|---|---|
warehouse | query | string | A warehouse code. |
product_code | query | string | A product code. |
in_stock | query | boolean | Only batches with quantity above zero. |
limit | query | integer | Rows per page, 1–100 (default 25). More than 50 costs 3 units. |
offset | query | integer | Rows to skip (default 0). |
curl https://prof-api.silverthinking.net/v1/stock \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/sales-bills
Sales bills, newest first (headers only).
| Name | In | Type | Description |
|---|---|---|---|
customer | query | string | A customer code. |
search | query | string | Bill code, customer name or phone. |
from | query | string | Only rows on or after this date (YYYY-MM-DD). |
to | query | string | Only rows on or before this date (YYYY-MM-DD). |
limit | query | integer | Rows per page, 1–100 (default 25). More than 50 costs 3 units. |
offset | query | integer | Rows to skip (default 0). |
curl https://prof-api.silverthinking.net/v1/sales-bills \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/sales-bills/{code}
One sales bill with its lines.
curl https://prof-api.silverthinking.net/v1/sales-bills/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"POST /v1/sales-bills
Create a sales bill. Stock, price limits, selling-at-loss and the account's rules are checked exactly like the bill screen; the bill, its lines, the stock movement and the payment are saved together or not at all.
| Name | In | Type | Description |
|---|---|---|---|
branch | body | string | The branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch. |
customer_code | body | string | The customer (every bill needs one). Required. |
warehouse_code | body | string | The warehouse the goods leave; empty if the branch has one. |
sale_type | body | string (retail | wholesale) | Price list used when unit_price is 0. |
items | body | array | 1–30 lines. Required. Each item: product_code: string, quantity: number, unit_price: number (0 = the product's own price) |
payment | body | string (cash | credit) | cash = paid in full now; credit = the rest stays on the account. |
paid_amount | body | number | Credit only: what is paid now (0 if nothing). |
discount | body | number | A discount amount on the whole bill (0 if none). |
notes | body | string | Notes saved with the bill. |
vault_code | body | string | The vault the money goes into / comes out of (GET /v1/vaults). Empty when the branch has one vault or a payment method is used. |
payment_method_code | body | string | A payment method (GET /v1/payment-methods) instead of a vault: InstaPay, a wallet... |
curl -X POST https://prof-api.silverthinking.net/v1/sales-bills \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"branch":"BR1","customer_code":"CL7","warehouse_code":"WH1","items":[{"product_code":"PR12","quantity":2,"unit_price":0}],"payment":"cash","vault_code":"VT1"}'DELETE /v1/sales-bills/{code}
Delete a whole sales bill (its lines, stock and payments go back). A single line can never be deleted; a bill with returns or a closed shipment is refused, like in the app.
curl -X DELETE https://prof-api.silverthinking.net/v1/sales-bills/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/purchase-bills
Purchase (supply) bills, newest first.
| Name | In | Type | Description |
|---|---|---|---|
supplier | query | string | A supplier code. |
search | query | string | Bill code or supplier name. |
from | query | string | Only rows on or after this date (YYYY-MM-DD). |
to | query | string | Only rows on or before this date (YYYY-MM-DD). |
limit | query | integer | Rows per page, 1–100 (default 25). More than 50 costs 3 units. |
offset | query | integer | Rows to skip (default 0). |
curl https://prof-api.silverthinking.net/v1/purchase-bills \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/purchase-bills/{code}
One purchase bill with its lines.
curl https://prof-api.silverthinking.net/v1/purchase-bills/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"POST /v1/purchase-bills
Create a purchase bill into one warehouse. A line with an empty product_code registers a new product.
| Name | In | Type | Description |
|---|---|---|---|
branch | body | string | The branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch. |
supplier_code | body | string | The supplier. Required. |
warehouse_code | body | string | The warehouse the goods enter; empty if the branch has one. |
items | body | array | 1–30 lines. Required. Each item: product_code: string (empty = new product), name: string (new product), quantity: number, cost_price: number, sale_price: number (new product), wholesale_price: number, unit: string, expiry_date: YYYY-MM-DD |
payment | body | string (cash | credit) | cash = paid in full now; credit = the rest stays on the account. |
paid_amount | body | number | Credit only: what is paid now (0 if nothing). |
discount | body | number | A discount amount on the whole bill (0 if none). |
notes | body | string | Notes saved with the bill. |
vault_code | body | string | The vault the money goes into / comes out of (GET /v1/vaults). Empty when the branch has one vault or a payment method is used. |
payment_method_code | body | string | A payment method (GET /v1/payment-methods) instead of a vault: InstaPay, a wallet... |
curl -X POST https://prof-api.silverthinking.net/v1/purchase-bills \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"branch":"BR1","supplier_code":"CL7","warehouse_code":"WH1","items":[{"product_code":"PR12","quantity":10,"cost_price":40}],"payment":"cash","vault_code":"VT1"}'DELETE /v1/purchase-bills/{code}
Delete a whole purchase bill. Refused when its goods were already sold, like in the app.
curl -X DELETE https://prof-api.silverthinking.net/v1/purchase-bills/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/payments
Money collected from customers or paid to suppliers.
| Name | In | Type | Description |
|---|---|---|---|
account | query | string | Which side (required). |
code | query | string | A customer / supplier code. |
from | query | string | Only rows on or after this date (YYYY-MM-DD). |
to | query | string | Only rows on or before this date (YYYY-MM-DD). |
limit | query | integer | Rows per page, 1–100 (default 25). More than 50 costs 3 units. |
offset | query | integer | Rows to skip (default 0). |
curl https://prof-api.silverthinking.net/v1/payments \
-H "Authorization: Bearer $PROF_TOKEN"POST /v1/customer-payments
Collect money from a customer (lowers what they owe).
| Name | In | Type | Description |
|---|---|---|---|
branch | body | string | The branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch. |
customer_code | body | string | The customer. Required. |
amount | body | number | The amount. Required. |
notes | body | string | Notes. |
vault_code | body | string | The vault the money goes into / comes out of (GET /v1/vaults). Empty when the branch has one vault or a payment method is used. |
payment_method_code | body | string | A payment method (GET /v1/payment-methods) instead of a vault: InstaPay, a wallet... |
curl -X POST https://prof-api.silverthinking.net/v1/customer-payments \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"branch":"BR1","customer_code":"CL7","amount":250,"vault_code":"VT1"}'POST /v1/supplier-payments
Pay money to a supplier (lowers what is owed to them). The vault or payment method must hold enough.
| Name | In | Type | Description |
|---|---|---|---|
branch | body | string | The branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch. |
supplier_code | body | string | The supplier. Required. |
amount | body | number | The amount. Required. |
notes | body | string | Notes. |
vault_code | body | string | The vault the money goes into / comes out of (GET /v1/vaults). Empty when the branch has one vault or a payment method is used. |
payment_method_code | body | string | A payment method (GET /v1/payment-methods) instead of a vault: InstaPay, a wallet... |
curl -X POST https://prof-api.silverthinking.net/v1/supplier-payments \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"branch":"BR1","supplier_code":"CL7","amount":250,"vault_code":"VT1"}'GET /v1/expenses
Expenses, newest first.
| Name | In | Type | Description |
|---|---|---|---|
search | query | string | Description or code. |
from | query | string | Only rows on or after this date (YYYY-MM-DD). |
to | query | string | Only rows on or before this date (YYYY-MM-DD). |
limit | query | integer | Rows per page, 1–100 (default 25). More than 50 costs 3 units. |
offset | query | integer | Rows to skip (default 0). |
curl https://prof-api.silverthinking.net/v1/expenses \
-H "Authorization: Bearer $PROF_TOKEN"POST /v1/expenses
Record an expense paid from a vault or a payment method.
| Name | In | Type | Description |
|---|---|---|---|
branch | body | string | The branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch. |
description | body | string | What it was for. Required. |
amount | body | number | The amount. Required. |
category | body | string (electricity | water | gas | internet_phone | rent | salaries | maintenance | transport | packaging | marketing | cleaning | other) | Category. |
vault_code | body | string | The vault the money goes into / comes out of (GET /v1/vaults). Empty when the branch has one vault or a payment method is used. |
payment_method_code | body | string | A payment method (GET /v1/payment-methods) instead of a vault: InstaPay, a wallet... |
curl -X POST https://prof-api.silverthinking.net/v1/expenses \
-H "Authorization: Bearer $PROF_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"branch":"BR1","description":"Office supplies","amount":250,"vault_code":"VT1"}'DELETE /v1/expenses/{code}
Delete an expense (its vault movement goes with it).
curl -X DELETE https://prof-api.silverthinking.net/v1/expenses/CL7 \
-H "Authorization: Bearer $PROF_TOKEN"GET /v1/events
What was created, changed or deleted, oldest first after a cursor — sync incrementally instead of re-reading everything. Only entities the token may read.
| Name | In | Type | Description |
|---|---|---|---|
after | query | integer | Return events with an id greater than this (0 = from the oldest kept). |
type | query | string | Filter, e.g. sales_bill or sales_bill.deleted. |
limit | query | integer | 1–100 (default 50). |
curl https://prof-api.silverthinking.net/v1/events \
-H "Authorization: Bearer $PROF_TOKEN"Objects
Me
| Field | Type | Description |
|---|---|---|
token | object | |
permissions | array | The permission keys this token holds. |
branches | array | null | Branch codes the token may work in; null = all. |
rate_limit | object | |
api_version | string |
Branch
| Field | Type | Description |
|---|---|---|
code | string | |
name | string | |
address | string | null | |
phone | string | null | |
default_warehouse | string | null | |
default_vault | string | null |
Warehouse
| Field | Type | Description |
|---|---|---|
code | string | |
name | string | |
branches | array | |
default_branch | string | null |
Vault
| Field | Type | Description |
|---|---|---|
code | string | |
name | string | |
branch | string | Branch name. |
PaymentMethod
| Field | Type | Description |
|---|---|---|
code | string | |
name | string | |
deferred | boolean | Money arrives later (e.g. a card settlement). |
Category
| Field | Type | Description |
|---|---|---|
code | string | |
name | string | |
parent_code | string | null |
Customer
| Field | Type | Description |
|---|---|---|
code | string | |
name | string | |
phone | string | null | |
phone2 | string | null | |
email | string | null | |
company | string | null | |
address | string | null | |
gender | string | null | male | female |
notes | string | null | |
branch | string | null | |
blacklisted | boolean | Marked as not committed (غير ملتزم). |
credit_limit | number | null | |
balance | number | null | What the customer owes (positive) — null without permission to see balances. |
net_balance | number | null | Balance netted with a linked supplier account. |
created_by | string | null | Who created it: a user name, or "API · <token name>" when made through the API. |
edited_by | string | null | Who last edited it (same form as created_by). |
Supplier
| Field | Type | Description |
|---|---|---|
code | string | |
name | string | |
phone | string | null | |
phone2 | string | null | |
phone3 | string | null | |
company | string | null | |
address | string | null | |
field | string | null | Line of business. |
notes | string | null | |
balance | number | null | What you owe the supplier — null without permission to see balances. |
net_balance | number | null | |
created_by | string | null | Who created it: a user name, or "API · <token name>" when made through the API. |
edited_by | string | null | Who last edited it (same form as created_by). |
Product
| Field | Type | Description |
|---|---|---|
code | string | |
name | string | |
specs | array | Specifications. |
unit | string | null | |
category_code | string | null | |
retail_price | number | null | |
wholesale_price | number | null | |
compare_at_price | number | null | Price before discount. |
min_price | number | null | Lowest price allowed on a bill. |
max_price | number | null | Highest price allowed on a bill. |
low_stock_alert | number | null | |
variant_group | string | null | Products sharing it are variants of one item. |
image | string | null | |
description | string | null | HTML. |
hidden | boolean | |
created_by | string | null | Who created it: a user name, or "API · <token name>" when made through the API. |
edited_by | string | null | Who last edited it (same form as created_by). |
StockRow
One stock batch.
| Field | Type | Description |
|---|---|---|
product_code | string | |
name | string | |
specs | array | Specifications. |
warehouse | string | Warehouse code. |
batch_code | string | null | |
quantity | number | |
expiry_date | string | null | |
supply_date | string | null | ISO 8601 UTC. |
unit_cost | number | null | Only with view_purchase_prices. |
SalesLine
| Field | Type | Description |
|---|---|---|
product_code | string | |
name | string | |
specs | array | Specifications. |
quantity | number | null | |
unit_price | number | null | Price sold at. |
list_price | number | null | |
sale_type | string | null | retail | wholesale |
gift | boolean | Given free. |
returned_quantity | number | null | |
warehouse | string | null | |
notes | string | null | |
unit_cost | number | null | Only with view_purchase_prices. |
SalesBill
| Field | Type | Description |
|---|---|---|
code | string | |
date | string | null | ISO 8601 UTC. |
type | string | BILL, ORDER (sales order), RETURN... |
customer_code | string | null | |
customer_name | string | null | |
branch | string | null | Branch code. |
warehouse | string | null | |
subtotal | number | null | |
discount | number | null | |
total | number | null | |
paid | number | null | |
remaining | number | null | |
is_credit | boolean | On account (آجل). |
returned | boolean | |
return_of | string | null | For a return: the original bill. |
sale_type | string | null | |
sales_channel | string | null | |
payment_method | string | null | |
vault | string | null | |
shipping | object | null | |
store_order | string | null | Online-store order it came from. |
notes | string | null | |
cashier | string | null | |
lines | array of SalesLine | Only on single-bill reads. |
created_by | string | null | Who created it: a user name, or "API · <token name>" when made through the API. |
edited_by | string | null | Who last edited it (same form as created_by). |
PurchaseLine
| Field | Type | Description |
|---|---|---|
product_code | string | |
name | string | |
specs | array | Specifications. |
quantity | number | null | |
retail_price | number | null | |
wholesale_price | number | null | |
expiry_date | string | null | |
batch_code | string | null | |
returned_quantity | number | null | |
unit_cost | number | null | Only with view_purchase_prices. |
PurchaseBill
| Field | Type | Description |
|---|---|---|
code | string | |
date | string | null | ISO 8601 UTC. |
type | string | |
supplier_code | string | null | |
warehouse | string | null | |
subtotal | number | null | |
discount | number | null | |
total | number | null | |
paid | number | null | |
is_credit | boolean | |
returned | boolean | |
return_of | string | null | |
notes | string | null | |
lines | array of PurchaseLine | Only on single-bill reads. |
created_by | string | null | Who created it: a user name, or "API · <token name>" when made through the API. |
edited_by | string | null | Who last edited it (same form as created_by). |
Payment
| Field | Type | Description |
|---|---|---|
code | string | |
date | string | null | ISO 8601 UTC. |
account | string | customer | supplier |
party_code | string | |
amount | number | |
bill_code | string | null | The bill it settled, if any. |
branch | string | null | |
notes | string | null | |
created_by | string | null | Who created it: a user name, or "API · <token name>" when made through the API. |
edited_by | string | null | Who last edited it (same form as created_by). |
Expense
| Field | Type | Description |
|---|---|---|
code | string | |
date | string | null | ISO 8601 UTC. |
description | string | |
amount | number | |
category | string | null | |
branch | string | null | Branch name. |
created_by | string | null | Who created it: a user name, or "API · <token name>" when made through the API. |
edited_by | string | null | Who last edited it (same form as created_by). |
Event
The same object is the body of a webhook call.
| Field | Type | Description |
|---|---|---|
id | integer | Increasing. Use it as the cursor (after=) and to ignore repeats. |
type | string | <entity>.<created|updated|deleted>, e.g. sales_bill.deleted |
entity | string | customer, supplier, product, sales_bill, purchase_bill, payment, expense |
code | string | The record code. Read the record itself for its current state. |
source | string | app (someone in Prof), api (a token) or system (Prof itself: store sync, workers). |
actor | string | The user, or "API · <token name>". |
occurred_at | string | ISO 8601 UTC. |
deleted | object | null | Deletes only: the record as it was (same shape as the resource). |