Skip to content

Global search across invoices, contacts, items, proformas, received documents and recurring schedules

GET
/v1/search
curl --request GET \
--url 'https://api.emite.cr/v1/search?q=Ferreteria%20El%20Roble&limit=5' \
--header 'Authorization: Bearer <token>'

Backs the command palette. The term is interpreted by SHAPE — a 50-digit string is a clave (exact match), 9-12 digits an identification number, other digit runs a consecutivo / CAByS / barcode, anything else human text — and only the sources that shape can match are queried. Text matching is accent-insensitive and per-word, in any order; when the strict pass finds nothing anywhere, a single approximate retry runs and the response is flagged fuzzy. Each group is capped (default 5, max 10) and reports truncated instead of a total — no counts are computed. Groups the caller lacks the RBAC scope or plan feature for are never queried and never appear. Environment-scoped rows (invoices, received documents, schedules) are restricted to the caller's active environment.

q
required
string
<= 120 characters
Example
Ferreteria El Roble

Free-text term. Interpreted by shape: a 50-digit string is a Hacienda clave (exact match), 9-12 digits an identification number, other digit runs a consecutivo / CAByS / barcode, anything else human text. Terms under 3 characters return no groups (below the trigram index floor).

limit
number
default: 5 >= 1 <= 10

Max hits per group.

Media typeapplication/json
object
queryKind
required

How the term was interpreted. empty means nothing was queried.

string
Allowed values: empty clave consecutivoReceptor cedula consecutivo text
fuzzy
required

True when the strict pass found nothing anywhere AND the approximate (trigram-similarity) retry produced these hits — the client should label them as approximate. Always false when groups is empty: the flag describes the hits, so there is nothing to qualify when there are none.

boolean
groups
required

Non-empty groups only, ordered by the detected intent (a clave puts invoices first; free text puts contacts first). Groups the caller lacks the scope or plan feature for are absent — never empty-but-present.

Array<object>
object
type
required

The source of all the group's hits.

string
Allowed values: invoice party item proforma recurring received
hits
required

Up to limit hits (5 by default), most recently created first. Never empty.

Array<object>
object
type
required

Where the hit comes from, and so which screen opens it: invoice (an issued document of any type, or a draft), party (a contact), item (a catalog item), proforma (a quote), recurring (a recurring invoice schedule), received (a document received from a supplier).

string
Allowed values: invoice party item proforma recurring received
id
required

Id of that record: the invoice, contact, item, proforma, schedule or received document. A hit found by the NumeroConsecutivoReceptor of an acceptance resolves to its received document.

string format: uuid
title
required

Primary line — consecutivo, party name, item name.

string
subtitle

Secondary line — receiver name, identification number, CAByS code.

string
badge

Short status token (invoice/proforma/schedule status, acceptance status). Raw domain value — the client translates it.

string
environment

Present only on env-scoped rows (invoices, received documents, recurring schedules). Always equals the caller's active environment — results are never mixed across environments.

string
Allowed values: sandbox production
truncated
required

More rows matched than were returned — the client should offer "see all" on the entity page.

boolean
Example
{
"queryKind": "empty",
"groups": [
{
"type": "invoice",
"hits": [
{
"type": "invoice",
"environment": "sandbox"
}
]
}
]
}

Missing or invalid JWT / API key

TENANT_REQUIRED — the caller has no tenant scope yet.