Which company and key
The company this key belongs to, what it may do, and the branches it reaches. Their ids are the branchId other calls take.
Takes nothing.
Answers 200: { company, key, branches }
Developers
Record sales, payments and stock in a company's Ivahi books, read its trial balance, profit and loss and balance sheet, or run Ivahi as the accounting behind your own app. Every call runs the same checks as Ivahi's own screens, so the books come out the same however a sale was made.
The owner opens Settings, API keys, makes a key for your software and gives it to you. You call the company's own address, such as yourcompany.ivahi.com/api/v1. The owner can revoke it at any time.
Sign up as an Ivahi owner and make a developer key on your account page. With it you create companies for your own customers, which you own and are billed for, and make each one's company key.
With a company key (ivk_…), three calls take you from nothing to a sale in the books.
# 1. Which company, and which branches this key reaches
curl https://yourcompany.ivahi.com/api/v1/me \
-H "Authorization: Bearer ivk_…"
# 2. The prices a sale can name (prices[].id)
curl "https://yourcompany.ivahi.com/api/v1/products?search=rice" \
-H "Authorization: Bearer ivk_…"
# 3. Record a sale: Ivahi prices it, charges the company's VAT and posts the books
curl https://yourcompany.ivahi.com/api/v1/sales \
-H "Authorization: Bearer ivk_…" \
-H "Idempotency-Key: order-10452" \
-H "Content-Type: application/json" \
-d '{ "branchId": 3, "items": [{ "priceId": 17, "quantity": 2 }],
"payment": { "method": "cash", "amountReceived": 5000 } }'With a developer key (ivd_…), on ivahi.com itself.
# Create a company you own (a Cloud company, billed to you)
curl https://ivahi.com/api/v1/companies \
-H "Authorization: Bearer ivd_…" -H "Content-Type: application/json" \
-d '{ "name": "Glow Salon", "address": "glow-salon", "category": "beauty" }'
# Ask until its status is "active" (about a minute)
curl https://ivahi.com/api/v1/companies/glow-salon -H "Authorization: Bearer ivd_…"
# Then make its company key, and use it on https://glow-salon.ivahi.com/api/v1
curl https://ivahi.com/api/v1/companies/glow-salon/keys \
-H "Authorization: Bearer ivd_…" -H "Content-Type: application/json" \
-d '{ "name": "Booking app" }'A company key (ivk_…) works only on its company's address and reaches only the Cloud branches the owner chose, read only or read and write. A developer key (ivd_…) works only on ivahi.com, for /companies. Send either as Authorization: Bearer. A key is shown once and kept only as a fingerprint.
Every write needs an Idempotency-Key header: your own name for that one operation. Sending it again returns the first answer and records nothing twice; the same key with a different request is refused. A refused write frees its key, so you can fix the cause and send it again.
A sale names a price and a number of packs, never an amount: Ivahi sells at the branch's list price and charges the company's VAT. A return refunds what the lines sold for. Your software cannot change a price.
Short stock, a closed month, a credit limit, a branch on Simple accounting: each is refused in plain words, exactly as Ivahi's screens refuse it, and nothing is recorded. Branches run by an Ivahi Tab or PC are written only by that device, so a key cannot reach them.
Each key may make 120 calls a minute. Beyond that a call is refused with 429 and a Retry-After header saying how many seconds to wait, and does nothing.
There is no charge for the API itself: a Cloud branch costs ₦10,000 a month however it is used, in the browser or through the API. Companies you create are billed to you per branch.
The same company key connects an AI assistant to the company's books through the Model Context Protocol. It gets 17 tools, one for each company endpoint below; a read-only key gets only the 9 that read. The same limits and rules apply, and a refusal comes back in words the assistant can act on.
# Claude Code claude mcp add --transport http ivahi https://yourcompany.ivahi.com/api/mcp \ --header "Authorization: Bearer ivk_…" # Any MCP client that speaks Streamable HTTP URL: https://yourcompany.ivahi.com/api/mcp Header: Authorization: Bearer ivk_…
Tools: ivahi_whoami, ivahi_list_products, ivahi_create_product, ivahi_list_categories, ivahi_list_customers, ivahi_create_customer, ivahi_list_suppliers, ivahi_record_sale, ivahi_return_sale, ivahi_void_sale, ivahi_record_customer_payment, ivahi_record_purchase, ivahi_record_expense, ivahi_trial_balance, ivahi_profit_and_loss, ivahi_balance_sheet, ivahi_journal.
Every refusal is { "error": { "code", "message" } }: branch on the code in your software, show the message to a person.
| Code | Status | Meaning |
|---|---|---|
| no_company | 404 | The call reached no company: call the company's own address (or ivahi.com for /companies). |
| missing_key | 401 | No key was sent. |
| key_not_recognised | 401 | The key is not one Ivahi knows, or is the wrong kind for this address. |
| key_revoked | 401 | The owner revoked the key. |
| read_only_key | 403 | A read-only key tried to write. |
| branch_not_allowed | 403 | The key does not reach that branch. |
| branch_unavailable | 409 | The branch is closed, or run by its device. |
| payment_overdue | 402 | The company or branch is read-only until its Ivahi payment is made. |
| invalid_request | 400 | The request is not what the endpoint takes; the message names the field. |
| server_error | 500 | Ivahi could not finish the call; nothing was changed by it. |
| idempotency_conflict | 409 | The Idempotency-Key was used for a different request, or is still running. |
| key_owner_inactive | 403 | The owner who made the key is no longer an active owner. |
| refused | 422 | The books' own rules refused it (short stock, a closed month, a credit limit…); nothing was recorded. |
| not_found | 404 | No such record in the branches the key reaches (the same answer either way). |
| books_not_shown | 409 | The branch uses Simple accounting, so its books are not shown. |
| rate_limited | 429 | More than 120 calls in a minute by this key; wait Retry-After seconds. |
Company calls: https://yourcompany.ivahi.com/api/v1. Company creation: https://ivahi.com/api/v1. Amounts are naira to the kobo; dates are YYYY-MM-DD, Lagos days. A field marked ? may be left out; a nested field without one is needed whenever its parent is sent.
The company this key belongs to, what it may do, and the branches it reaches. Their ids are the branchId other calls take.
Takes nothing.
Answers 200: { company, key, branches }
Products with each price a sale can name (prices[].id is the priceId a sale takes), the branches each price is for, and the units on each branch's shelf. Cost prices are never listed.
| Name | In | Type | Notes |
|---|---|---|---|
| page? | query | integer | Default 1. |
| limit? | query | integer | Default 50. |
| search? | query | string |
Answers 200: { products, page, limit, total }
A new product with its prices, made exactly as the product form makes it. Prices go on the price lists of branches the key reaches (GET /me shows each branch's priceListId), each by the base unit or the pack; the first on each list is its default unless another is marked. The cost per base unit is a fact you state. No opening stock: record goods received with POST /purchases. No image: add one on the web.
Needs an Idempotency-Key header.
| Name | In | Type | Notes |
|---|---|---|---|
| name | body | string | |
| categoryId | body | integer | |
| barcode? | body | string | |
| manufacturer? | body | string | |
| description? | body | string | |
| baseUnit | body | string | |
| packagingUnit? | body | string | |
| unitsPerPack? | body | integer | Default 1. |
| costPerBaseUnit | body | number | |
| lowStockThreshold? | body | integer | |
| prices | body | object[] | At least 1. At most 20. |
| prices[].priceListId | body | integer | |
| prices[].name | body | string | |
| prices[].unit | body | base | pack | |
| prices[].price | body | number | |
| prices[].default? | body | boolean |
Answers 201: { product } with its prices (their ids are the priceId a sale takes)
The company's product categories; their ids are the categoryId a new product takes.
Takes nothing.
Answers 200: { categories }
Customers with what each owes, holds as credit, and may owe (their limit) at each branch the key reaches.
| Name | In | Type | Notes |
|---|---|---|---|
| page? | query | integer | Default 1. |
| limit? | query | integer | Default 50. |
| search? | query | string |
Answers 200: { customers, page, limit, total }
A new customer: their details, their home branch (one the key reaches) and their credit limit there. A name already in use is refused.
Needs an Idempotency-Key header.
| Name | In | Type | Notes |
|---|---|---|---|
| name | body | string | |
| contactName? | body | string | |
| phone? | body | string | |
| email? | body | string | |
| address? | body | string | |
| homeBranchId | body | integer | |
| creditLimit? | body | number | Default 0. |
| notes? | body | string |
Answers 201: { customer }
Suppliers with what each branch the key reaches owes them, or has paid ahead.
| Name | In | Type | Notes |
|---|---|---|---|
| page? | query | integer | Default 1. |
| limit? | query | integer | Default 50. |
| search? | query | string |
Answers 200: { suppliers, page, limit, total }
A sale in a Cloud branch. Lines name a priceId and a number of packs: Ivahi prices them from the branch's list and charges the company's VAT, so a sale never carries a price of its own. Payment is cash, electronic (name the branch's bank account), split, or credit (needs a customerId).
Needs an Idempotency-Key header.
| Name | In | Type | Notes |
|---|---|---|---|
| branchId | body | integer | |
| customerId? | body | integer | |
| customerName? | body | string | |
| items | body | object[] | At least 1. At most 200. |
| items[].priceId | body | integer | |
| items[].quantity | body | integer | |
| discount? | body | number | Default 0. |
| payment | body | object | |
| payment.method | body | cash | electronic | split | credit | |
| payment.amountReceived | body | number | |
| payment.bankAccountId? | body | integer or null | |
| payment.split? | body | object[] | At least 2. At most 4. |
| payment.split[].method | body | cash | electronic | |
| payment.split[].amount | body | number | |
| payment.split[].bankAccountId? | body | integer or null | |
| notes? | body | string |
Answers 201: { sale }: number, lines, totals, amount paid, balance
Goods coming back from a sale, by its line ids and packs. The refund is what those lines sold for, back through the sale's own payment or onto the customer's account; no more than is left can come back.
Needs an Idempotency-Key header.
| Name | In | Type | Notes |
|---|---|---|---|
| items | body | object[] | At least 1. At most 200. |
| items[].lineId | body | integer | |
| items[].quantity | body | integer | |
| items[].reason | body | string | |
| items[].restock? | body | boolean | Default true. |
| refund | body | original_payment | account | |
| returnDate | body | string | |
| bankAccountId? | body | integer or null | |
| notes? | body | string | |
| saleId | path | integer | The sale's id, as POST /sales answered it. |
Answers 201: { return, sale }
Void a sale, with a reason. A sale that already had goods returned cannot be voided: return the rest instead.
Needs an Idempotency-Key header.
| Name | In | Type | Notes |
|---|---|---|---|
| reason | body | string | |
| saleId | path | integer | The sale's id, as POST /sales answered it. |
Answers 200: { sale } now voided
Money a customer paid at a branch. It settles their invoices there first; anything beyond is held as their credit.
Needs an Idempotency-Key header.
| Name | In | Type | Notes |
|---|---|---|---|
| customerId | body | integer | |
| branchId | body | integer | |
| amount | body | number | |
| method | body | cash | electronic | |
| bankAccountId? | body | integer or null | |
| date | body | string | |
| reference? | body | string | |
| notes? | body | string |
Answers 201: { payment }
Goods received from a supplier into a branch, with each line's packs, pack size, cost and expiry date as delivered. A branch on Simple accounting pays on arrival (send payment); a Full branch owes the supplier.
Needs an Idempotency-Key header.
| Name | In | Type | Notes |
|---|---|---|---|
| branchId | body | integer | |
| supplierId | body | integer | |
| date | body | string | |
| invoiceNumber? | body | string | |
| notes? | body | string | |
| items | body | object[] | At least 1. At most 200. |
| items[].productId | body | integer | |
| items[].quantity | body | integer | |
| items[].unitsPerPack | body | integer | |
| items[].packagingUnit | body | string | |
| items[].costPerPack | body | number | |
| items[].expiryDate | body | string | |
| payment? | body | object | |
| payment.method | body | cash | electronic | |
| payment.bankAccountId? | body | integer or null |
Answers 201: { purchase }
An expense a branch paid, in cash or from one of its bank accounts, posted to the account its category maps to.
Needs an Idempotency-Key header.
| Name | In | Type | Notes |
|---|---|---|---|
| branchId | body | integer | |
| categoryId | body | integer | |
| description | body | string | |
| amount | body | number | |
| date | body | string | |
| method | body | cash | electronic | |
| bankAccountId? | body | integer or null | |
| paidTo? | body | string | |
| reference? | body | string | |
| notes? | body | string |
Answers 201: { expense }
One branch's trial balance on a day (today if asOf is left out), exactly as the Ivahi Finance screen shows it. The branch must use Full accounting.
| Name | In | Type | Notes |
|---|---|---|---|
| branchId | query | integer | |
| asOf? | query | string |
Answers 200: { branchId, branch, asOf, accounts, totals }
One branch's profit and loss for a period (today if from and to are left out), exactly as the Ivahi Finance screen shows it. Full accounting only.
| Name | In | Type | Notes |
|---|---|---|---|
| branchId | query | integer | |
| from? | query | string | |
| to? | query | string |
Answers 200: { branchId, branch, fromDate, toDate, revenue, cogs, expenses, … }
One branch's balance sheet on a day, with whether it balances, exactly as the Ivahi Finance screen shows it. Full accounting only.
| Name | In | Type | Notes |
|---|---|---|---|
| branchId | query | integer | |
| asOf? | query | string |
Answers 200: { branchId, branch, asOfDate, assets, liabilities, equity, isBalanced, variance }
One branch's journal entries with their lines, newest first; filter by dates and by what made them (sourceType). Full accounting only.
| Name | In | Type | Notes |
|---|---|---|---|
| branchId | query | integer | |
| from? | query | string | |
| to? | query | string | |
| sourceType? | query | sale | purchase | expense | purchase_return | sale_return | payment_in | payment_out | sale_payment | order_deposit | stock_transfer | inventory_adjustment | payroll | bank_deposit | bank_withdrawal | |
| page? | query | integer | Default 1. |
| limit? | query | integer | Default 50. |
Answers 200: { branchId, branch, entries, total, page, totalPages }
The companies your owner account owns, newest first, with their status.
Takes nothing.
Answers 200: { companies }
A Cloud company you then own and are billed for, by the same rules as Add a business: email confirmed, the address free, at most 3 a day. It answers while its database is being made; asking again for an address you already own answers that company.
| Name | In | Type | Notes |
|---|---|---|---|
| name | body | string | |
| address | body | string | |
| category | body | supermarket | pharmacy | fashion | electronics | food | beauty | hardware | other | |
| agentCode? | body | string |
Answers 202: { company } with status setting_up (200 when it already existed)
One of your companies, with its status: setting_up, active or suspended. Ask again until it is active.
| Name | In | Type | Notes |
|---|---|---|---|
| address | path | string | The company's address: the part before .ivahi.com. |
Answers 200: { company }
A company key (ivk_…) for one of your active companies, reaching the Cloud branches you name (all of them when left out). It is shown once; each call makes a new key.
| Name | In | Type | Notes |
|---|---|---|---|
| name | body | string | |
| access? | body | read | write | Default "write". |
| branchIds? | body | integer[] | At least 1. At most 200. |
| address | path | string | The company's address: the part before .ivahi.com. |
Answers 201: { key, prefix, company, access, branches }