Prof API v1.0.0

Connect your CRM, website, automations and AI agents to your Prof account. · الدليل بالعربي · openapi.json · llms-full.txt

Quick start

  1. 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.
  2. 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.

Same rules as the app

A token is its own user with its own permissions and branches, chosen when it is made (view / add & edit / delete per section). It is never an administrator. Every write runs through the same checks as the Prof screens: stock never goes below zero, price limits, unique phones and product names, the vault must hold the money, a bill line cannot be deleted on its own (delete the whole bill), a customer with bills cannot be deleted, and so on. Purchase costs and balances are hidden unless the token was given the permission to see them.

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

HTTPcodeMeaning
400INVALID_JSONThe body is not a JSON object.
400INVALID_PARAMETER / INVALID_DATE / INVALID_CODEA query value or path code is not valid (dates are YYYY-MM-DD).
400INVALID_IDEMPOTENCY_KEYIdempotency-Key must be 8–100 characters of letters, digits, "-" or "_".
401MISSING_TOKENNo "Authorization: Bearer <token>" header.
401INVALID_TOKENUnknown token.
401TOKEN_EXPIREDThe token passed its expiry date. Extend it in Prof.
401TOKEN_REVOKEDSomeone revoked the token in Prof.
403IP_NOT_ALLOWEDThe token is limited to other IP addresses.
403FORBIDDENThe token lacks a permission; details.missing_permission names it when known.
403BRANCH_ACCESS_DENIEDThe token is limited to other branches.
403PLAN_NOT_PREMIUMThe account is not on a paid plan.
403API_DISABLED / DOMAIN_SUSPENDEDThe API or the account is switched off. Contact support.
404NOT_FOUNDNo such endpoint, or no such record (or not visible to this token).
405METHOD_NOT_ALLOWEDThe path exists with another method.
409SIMILAR_RECORDS_EXISTA 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.
409IDEMPOTENCY_IN_PROGRESSThe first request with this key is still running. Retry in a moment.
413BODY_TOO_LARGEBodies are limited to 256 KB.
422VALIDATION_FAILEDThe request breaks one of the account's rules (stock, prices, missing data...); message says which.
422INSUFFICIENT_FUNDSThe vault or payment method does not hold enough money.
422BRANCH_REQUIREDSay which branch (the token works in more than one).
422IDEMPOTENCY_KEY_REUSEDThe 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.
429RATE_LIMITEDOver the per-minute budget. Wait Retry-After seconds.
429DAILY_LIMIT_REACHEDOver the per-day budget; resets at midnight Cairo time.
429TOKEN_PAUSEDWent over the limit repeatedly; paused for 15 minutes.
500SERVER_ERROROur fault. Safe to retry with the same Idempotency-Key.
503MAINTENANCE / API_UNAVAILABLETry 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-IdThe event id. You may get an event twice: ignore ids you already handled.
Prof-Event-Typee.g. sales_bill.created
Prof-Delivery-Attempt1 for the first try.
Prof-Signaturet=<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.

Cost: 1 · Returns: Me

curl https://prof-api.silverthinking.net/v1/me \
  -H "Authorization: Bearer $PROF_TOKEN"

GET /v1/branches

The branches this token may work in.

Cost: 1 (3 when limit > 50) · Returns: Branch list

curl https://prof-api.silverthinking.net/v1/branches \
  -H "Authorization: Bearer $PROF_TOKEN"

GET /v1/warehouses

Warehouses, with the branches each one serves.

Cost: 1 (3 when limit > 50) · Returns: Warehouse list

curl https://prof-api.silverthinking.net/v1/warehouses \
  -H "Authorization: Bearer $PROF_TOKEN"

GET /v1/vaults

Vaults (cash boxes) per branch. No balances.

Cost: 1 (3 when limit > 50) · Returns: Vault list

curl https://prof-api.silverthinking.net/v1/vaults \
  -H "Authorization: Bearer $PROF_TOKEN"

GET /v1/payment-methods

Payment methods (InstaPay, wallets, cards...).

Cost: 1 (3 when limit > 50) · Returns: PaymentMethod list

curl https://prof-api.silverthinking.net/v1/payment-methods \
  -H "Authorization: Bearer $PROF_TOKEN"

GET /v1/categories

Product categories.

Cost: 1 (3 when limit > 50) · Returns: Category list

curl https://prof-api.silverthinking.net/v1/categories \
  -H "Authorization: Bearer $PROF_TOKEN"

GET /v1/customers

Customers, newest first, with what each one owes.

Cost: 1 (3 when limit > 50) · Permissions: view_customers · Returns: Customer list

NameInTypeDescription
searchquerystringName, phone, company or code.
limitqueryintegerRows per page, 1–100 (default 25). More than 50 costs 3 units.
offsetqueryintegerRows to skip (default 0).
curl https://prof-api.silverthinking.net/v1/customers \
  -H "Authorization: Bearer $PROF_TOKEN"

GET /v1/customers/{code}

One customer.

Cost: 1 · Permissions: view_customers · Returns: 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.

Cost: 2 · Permissions: add_customer, view_customers · Returns: Customer

NameInTypeDescription
namebodystringThe name. Required.
phonebodystringMobile number, e.g. 01012345678.
phone2bodystringA second mobile number.
companybodystringCompany.
addressbodystringAddress.
genderbodystring (male | female)Gender (some accounts require it).
opening_balancebodynumberWhat the customer already owes from before (0 if nothing).
notesbodystringNotes.
allow_similarbodybooleanfalse (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.

Cost: 2 · Permissions: edit_customer, view_customers · Returns: Customer

NameInTypeDescription
namebodystringName.
phonebodystringPhone.
phone2bodystringSecond phone.
companybodystringCompany.
addressbodystringAddress.
genderbodystring (male | female)Gender.
notesbodystringNotes.
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.

Cost: 2 · Permissions: delete_customer · Returns: Customer

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.

Cost: 1 (3 when limit > 50) · Permissions: view_suppliers · Returns: Supplier list

NameInTypeDescription
searchquerystringName, phone, company or code.
limitqueryintegerRows per page, 1–100 (default 25). More than 50 costs 3 units.
offsetqueryintegerRows to skip (default 0).
curl https://prof-api.silverthinking.net/v1/suppliers \
  -H "Authorization: Bearer $PROF_TOKEN"

GET /v1/suppliers/{code}

One supplier.

Cost: 1 · Permissions: view_suppliers · Returns: 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.

Cost: 2 · Permissions: add_supplier, view_suppliers · Returns: Supplier

NameInTypeDescription
namebodystringThe name. Required.
phonebodystringMobile number.
phone2bodystringA second mobile number.
addressbodystringAddress.
fieldbodystringLine of business.
allow_similarbodybooleanSee 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.

Cost: 2 · Permissions: edit_supplier, view_suppliers · Returns: Supplier

NameInTypeDescription
namebodystringName.
phonebodystringPhone.
phone2bodystringSecond phone.
companybodystringCompany.
addressbodystringAddress.
fieldbodystringLine of business.
notesbodystringNotes.
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.

Cost: 2 · Permissions: delete_supplier · Returns: Supplier

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.

Cost: 1 (3 when limit > 50) · Permissions: view_warehouses · Returns: Product list

NameInTypeDescription
searchquerystringPart of the name.
categoryquerystringA category code.
barcodequerystringExact product code / barcode.
limitqueryintegerRows per page, 1–100 (default 25). More than 50 costs 3 units.
offsetqueryintegerRows 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).

Cost: 1 · Permissions: view_warehouses · Returns: Product

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.

Cost: 1 · Permissions: view_warehouses · Returns: StockRow

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.

Cost: 2 · Permissions: edit_warehouse · Returns: Product

NameInTypeDescription
namebodystringProduct name. Required.
sale_pricebodynumberRetail price. Required.
wholesale_pricebodynumberWholesale price.
unitbodystringUnit (piece, box, kilo...).
barcodebodystringBarcode; empty = given automatically.
specsbodyarraySpecifications, 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).

Cost: 2 · Permissions: edit_warehouse · Returns: Product

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).

Cost: 1 (3 when limit > 50) · Permissions: view_warehouses · Returns: StockRow list

NameInTypeDescription
warehousequerystringA warehouse code.
product_codequerystringA product code.
in_stockquerybooleanOnly batches with quantity above zero.
limitqueryintegerRows per page, 1–100 (default 25). More than 50 costs 3 units.
offsetqueryintegerRows 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).

Cost: 1 (3 when limit > 50) · Permissions: view_sales · Returns: SalesBill list

NameInTypeDescription
customerquerystringA customer code.
searchquerystringBill code, customer name or phone.
fromquerystringOnly rows on or after this date (YYYY-MM-DD).
toquerystringOnly rows on or before this date (YYYY-MM-DD).
limitqueryintegerRows per page, 1–100 (default 25). More than 50 costs 3 units.
offsetqueryintegerRows 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.

Cost: 1 · Permissions: view_sales · Returns: SalesBill

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.

Cost: 2 · Permissions: add_sales_bill · Returns: SalesBill

NameInTypeDescription
branchbodystringThe branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch.
customer_codebodystringThe customer (every bill needs one). Required.
warehouse_codebodystringThe warehouse the goods leave; empty if the branch has one.
sale_typebodystring (retail | wholesale)Price list used when unit_price is 0.
itemsbodyarray1–30 lines. Required.
Each item: product_code: string, quantity: number, unit_price: number (0 = the product&#039;s own price)
paymentbodystring (cash | credit)cash = paid in full now; credit = the rest stays on the account.
paid_amountbodynumberCredit only: what is paid now (0 if nothing).
discountbodynumberA discount amount on the whole bill (0 if none).
notesbodystringNotes saved with the bill.
vault_codebodystringThe 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_codebodystringA 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.

Cost: 2 · Permissions: delete_sales_bill · Returns: SalesBill

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.

Cost: 1 (3 when limit > 50) · Permissions: view_procurement · Returns: PurchaseBill list

NameInTypeDescription
supplierquerystringA supplier code.
searchquerystringBill code or supplier name.
fromquerystringOnly rows on or after this date (YYYY-MM-DD).
toquerystringOnly rows on or before this date (YYYY-MM-DD).
limitqueryintegerRows per page, 1–100 (default 25). More than 50 costs 3 units.
offsetqueryintegerRows 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.

Cost: 1 · Permissions: view_procurement · Returns: PurchaseBill

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.

Cost: 2 · Permissions: add_purchase_bill · Returns: PurchaseBill

NameInTypeDescription
branchbodystringThe branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch.
supplier_codebodystringThe supplier. Required.
warehouse_codebodystringThe warehouse the goods enter; empty if the branch has one.
itemsbodyarray1–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
paymentbodystring (cash | credit)cash = paid in full now; credit = the rest stays on the account.
paid_amountbodynumberCredit only: what is paid now (0 if nothing).
discountbodynumberA discount amount on the whole bill (0 if none).
notesbodystringNotes saved with the bill.
vault_codebodystringThe 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_codebodystringA 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.

Cost: 2 · Permissions: delete_purchase_bill · Returns: PurchaseBill

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.

Cost: 1 (3 when limit > 50) · Permissions: view_customers, view_suppliers · Returns: Payment list

NameInTypeDescription
accountquerystringWhich side (required).
codequerystringA customer / supplier code.
fromquerystringOnly rows on or after this date (YYYY-MM-DD).
toquerystringOnly rows on or before this date (YYYY-MM-DD).
limitqueryintegerRows per page, 1–100 (default 25). More than 50 costs 3 units.
offsetqueryintegerRows 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).

Cost: 2 · Permissions: collect_from_customer, view_customers · Returns: Payment

NameInTypeDescription
branchbodystringThe branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch.
customer_codebodystringThe customer. Required.
amountbodynumberThe amount. Required.
notesbodystringNotes.
vault_codebodystringThe 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_codebodystringA 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.

Cost: 2 · Permissions: pay_supplier, view_suppliers · Returns: Payment

NameInTypeDescription
branchbodystringThe branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch.
supplier_codebodystringThe supplier. Required.
amountbodynumberThe amount. Required.
notesbodystringNotes.
vault_codebodystringThe 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_codebodystringA 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.

Cost: 1 (3 when limit > 50) · Permissions: view_expenses · Returns: Expense list

NameInTypeDescription
searchquerystringDescription or code.
fromquerystringOnly rows on or after this date (YYYY-MM-DD).
toquerystringOnly rows on or before this date (YYYY-MM-DD).
limitqueryintegerRows per page, 1–100 (default 25). More than 50 costs 3 units.
offsetqueryintegerRows 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.

Cost: 2 · Permissions: add_expense · Returns: Expense

NameInTypeDescription
branchbodystringThe branch the operation belongs to (a code from GET /v1/branches). Optional when the token is limited to one branch.
descriptionbodystringWhat it was for. Required.
amountbodynumberThe amount. Required.
categorybodystring (electricity | water | gas | internet_phone | rent | salaries | maintenance | transport | packaging | marketing | cleaning | other)Category.
vault_codebodystringThe 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_codebodystringA 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).

Cost: 2 · Permissions: delete_expense · Returns: Expense

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.

Cost: 1 (3 when limit > 50) · Returns: Event list

NameInTypeDescription
afterqueryintegerReturn events with an id greater than this (0 = from the oldest kept).
typequerystringFilter, e.g. sales_bill or sales_bill.deleted.
limitqueryinteger1–100 (default 50).
curl https://prof-api.silverthinking.net/v1/events \
  -H "Authorization: Bearer $PROF_TOKEN"

Objects

Me

FieldTypeDescription
tokenobject
permissionsarrayThe permission keys this token holds.
branchesarray | nullBranch codes the token may work in; null = all.
rate_limitobject
api_versionstring

Branch

FieldTypeDescription
codestring
namestring
addressstring | null
phonestring | null
default_warehousestring | null
default_vaultstring | null

Warehouse

FieldTypeDescription
codestring
namestring
branchesarray
default_branchstring | null

Vault

FieldTypeDescription
codestring
namestring
branchstringBranch name.

PaymentMethod

FieldTypeDescription
codestring
namestring
deferredbooleanMoney arrives later (e.g. a card settlement).

Category

FieldTypeDescription
codestring
namestring
parent_codestring | null

Customer

FieldTypeDescription
codestring
namestring
phonestring | null
phone2string | null
emailstring | null
companystring | null
addressstring | null
genderstring | nullmale | female
notesstring | null
branchstring | null
blacklistedbooleanMarked as not committed (غير ملتزم).
credit_limitnumber | null
balancenumber | nullWhat the customer owes (positive) — null without permission to see balances.
net_balancenumber | nullBalance netted with a linked supplier account.
created_bystring | nullWho created it: a user name, or "API · <token name>" when made through the API.
edited_bystring | nullWho last edited it (same form as created_by).

Supplier

FieldTypeDescription
codestring
namestring
phonestring | null
phone2string | null
phone3string | null
companystring | null
addressstring | null
fieldstring | nullLine of business.
notesstring | null
balancenumber | nullWhat you owe the supplier — null without permission to see balances.
net_balancenumber | null
created_bystring | nullWho created it: a user name, or "API · <token name>" when made through the API.
edited_bystring | nullWho last edited it (same form as created_by).

Product

FieldTypeDescription
codestring
namestring
specsarraySpecifications.
unitstring | null
category_codestring | null
retail_pricenumber | null
wholesale_pricenumber | null
compare_at_pricenumber | nullPrice before discount.
min_pricenumber | nullLowest price allowed on a bill.
max_pricenumber | nullHighest price allowed on a bill.
low_stock_alertnumber | null
variant_groupstring | nullProducts sharing it are variants of one item.
imagestring | null
descriptionstring | nullHTML.
hiddenboolean
created_bystring | nullWho created it: a user name, or "API · <token name>" when made through the API.
edited_bystring | nullWho last edited it (same form as created_by).

StockRow

One stock batch.

FieldTypeDescription
product_codestring
namestring
specsarraySpecifications.
warehousestringWarehouse code.
batch_codestring | null
quantitynumber
expiry_datestring | null
supply_datestring | nullISO 8601 UTC.
unit_costnumber | nullOnly with view_purchase_prices.

SalesLine

FieldTypeDescription
product_codestring
namestring
specsarraySpecifications.
quantitynumber | null
unit_pricenumber | nullPrice sold at.
list_pricenumber | null
sale_typestring | nullretail | wholesale
giftbooleanGiven free.
returned_quantitynumber | null
warehousestring | null
notesstring | null
unit_costnumber | nullOnly with view_purchase_prices.

SalesBill

FieldTypeDescription
codestring
datestring | nullISO 8601 UTC.
typestringBILL, ORDER (sales order), RETURN...
customer_codestring | null
customer_namestring | null
branchstring | nullBranch code.
warehousestring | null
subtotalnumber | null
discountnumber | null
totalnumber | null
paidnumber | null
remainingnumber | null
is_creditbooleanOn account (آجل).
returnedboolean
return_ofstring | nullFor a return: the original bill.
sale_typestring | null
sales_channelstring | null
payment_methodstring | null
vaultstring | null
shippingobject | null
store_orderstring | nullOnline-store order it came from.
notesstring | null
cashierstring | null
linesarray of SalesLineOnly on single-bill reads.
created_bystring | nullWho created it: a user name, or "API · <token name>" when made through the API.
edited_bystring | nullWho last edited it (same form as created_by).

PurchaseLine

FieldTypeDescription
product_codestring
namestring
specsarraySpecifications.
quantitynumber | null
retail_pricenumber | null
wholesale_pricenumber | null
expiry_datestring | null
batch_codestring | null
returned_quantitynumber | null
unit_costnumber | nullOnly with view_purchase_prices.

PurchaseBill

FieldTypeDescription
codestring
datestring | nullISO 8601 UTC.
typestring
supplier_codestring | null
warehousestring | null
subtotalnumber | null
discountnumber | null
totalnumber | null
paidnumber | null
is_creditboolean
returnedboolean
return_ofstring | null
notesstring | null
linesarray of PurchaseLineOnly on single-bill reads.
created_bystring | nullWho created it: a user name, or "API · <token name>" when made through the API.
edited_bystring | nullWho last edited it (same form as created_by).

Payment

FieldTypeDescription
codestring
datestring | nullISO 8601 UTC.
accountstringcustomer | supplier
party_codestring
amountnumber
bill_codestring | nullThe bill it settled, if any.
branchstring | null
notesstring | null
created_bystring | nullWho created it: a user name, or "API · <token name>" when made through the API.
edited_bystring | nullWho last edited it (same form as created_by).

Expense

FieldTypeDescription
codestring
datestring | nullISO 8601 UTC.
descriptionstring
amountnumber
categorystring | null
branchstring | nullBranch name.
created_bystring | nullWho created it: a user name, or "API · <token name>" when made through the API.
edited_bystring | nullWho last edited it (same form as created_by).

Event

The same object is the body of a webhook call.

FieldTypeDescription
idintegerIncreasing. Use it as the cursor (after=) and to ignore repeats.
typestring<entity>.<created|updated|deleted>, e.g. sales_bill.deleted
entitystringcustomer, supplier, product, sales_bill, purchase_bill, payment, expense
codestringThe record code. Read the record itself for its current state.
sourcestringapp (someone in Prof), api (a token) or system (Prof itself: store sync, workers).
actorstringThe user, or "API · <token name>".
occurred_atstringISO 8601 UTC.
deletedobject | nullDeletes only: the record as it was (same shape as the resource).

Generated from the server's route table by tool/public_api/build_openapi.php · API v1.0.0