Search
Find an invoice, bill, credit note, purchase order, journal entry, payment, customer or vendor by its number, a reference or a name, in every entity.
| Operation | Summary | Scope | Idempotency-Key |
|---|---|---|---|
GET /v1/search |
Find records by number or name | read |
GET /v1/search
Find records by number or name
Sales invoices and credit notes, purchase bills and credit notes, purchase orders,
journal entries, payments, customers and vendors of every entity of the organization whose
number, reference, code, name or VAT number holds q; subscriptions, revenue contracts and
deals (opportunity) by number, title or customer (a deal also by its prospect's name),
products by code or name, and plans by name.
Numbers and references (document and payment numbers, the vendor's own invoice number,
payment, order and buyer references, a journal entry's source reference, VAT numbers) are
compared on their letters and digits only, ignoring case, spaces, dashes and dots; names and
descriptions as typed, ignoring case. The best matches come first: an exact number, then
one that starts with q, then the rest; the number before any other field; then the
newest. matched_field says where q was found.
| Required scope | read (admin implies every scope) |
| Operation id | search_v1_search_get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| query | q |
string | yes | What to look for, e.g. INV-2026-000012, part of a vendor's invoice number, a QR reference (with or without spaces) or part of a customer's name. (min length 1; max length 100) |
| query | limit |
integer | Most hits of each type, 1 to 20. (min 1; max 20; default 5) |
Example request
curl "$ERP_URL/v1/search?q=value" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of SearchHit |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"type": "customer",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"number": "string",
"name": "string",
"title": "string",
"status": "string",
"date": "2026-09-21",
"amount": "string",
"currency": "string",
"direction": "incoming",
"journal_entry_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"matched_field": "buyer_reference",
"matched_value": "string"
}
]
Schemas
SearchHit
| Field | Type | Required | Description |
|---|---|---|---|
type |
"customer" | "journal_entry" | "lead" | "opportunity" | "payment" | "plan" | "product" | "purchase_bill" | "purchase_credit_note" | "purchase_order" | "quote" | "revenue_contract" | "sales_credit_note" | "sales_invoice" | "sales_order" | "subscription" | "vendor" |
yes | What was found: a sales invoice or credit note, a purchase bill or credit note, a purchase order, a quote, a sales order, a journal entry, a payment (direction says which way), a customer, a vendor, a subscription, a revenue contract, a deal (opportunity), a lead, a product or a plan (a budget or forecast). |
id |
string (uuid) | yes | Id of the record: GET /v1/documents/{id}, GET /v1/purchase-orders/{id}, GET /v1/sales-documents/{id} (a quote or sales order), GET /v1/journal-entries/{id}, GET /v1/entities/{entity}/parties/{id}, GET /v1/subscriptions/{id}, GET /v1/revenue-contracts/{id}, GET /v1/opportunities/{id}, GET /v1/leads/{id}, GET /v1/products/{id} or GET /v1/plans/{id}; a payment has no card of its own (see journal_entry_id). |
entity |
string | yes | Code of the entity (company) the record belongs to. |
number |
string or null | yes | Its number (INV-2026-000012, PO-2026-0003), or the code of a customer, vendor or product; null for a draft that has none yet, and for a plan. |
name |
string | yes | The customer or vendor of a document, order, payment, subscription or revenue contract, the customer or prospect of a deal, the name of a customer, vendor, product, plan or lead (a person), or the description of a journal entry. |
title |
string or null | yes | The title of a subscription, revenue contract or deal, a lead's company; else null. |
status |
string | yes | Its status, e.g. draft, posted, active; a deal's stage (lead to won or lost), a lead's status (new to converted), a product's active or inactive, a plan's kind (budget or forecast). |
date |
string (date) or null | yes | Document, order, entry or payment date, the start of a subscription or revenue contract, the expected close of a deal, the day a lead came in; null for a customer, vendor, product or plan. |
amount |
string or null | yes | Total of a document, net total of an order, the amount of a payment, the transaction price of a revenue contract or the expected value of a deal, in currency; null otherwise. |
currency |
string or null | yes | ISO 4217 currency of amount. |
direction |
"incoming" | "outgoing" or null |
yes | Of a payment: incoming (a customer paid) or outgoing (a vendor is paid); null otherwise. |
journal_entry_id |
string (uuid) or null | yes | Of a payment: the journal entry it posted, once posted; null otherwise. |
matched_field |
"buyer_reference" | "code" | "customer_reference" | "description" | "email" | "external_number" | "name" | "number" | "order_reference" | "party" | "payment_reference" | "reference" | "source_ref" | "title" | "vat_number" |
yes | The field the text was found in, e.g. number or payment_reference. |
matched_value |
string | yes | That field's value. |