Skip to content

Vocabulary API

Shared lists: Nepal places, palikas, industries, product categories.

The same operations are in the interactive API reference, and the whole contract is in the OpenAPI document.

GET/v1/vocab/fhir/{id}

Get a FHIR resource

Returns one FHIR R5 resource, such as Patient or Appointment: a sentence about what it is and its top-level fields with their types. Only the top level is given, not nested elements and not the full profile. It is here so a health business can map its own records to names the assistant understands.

The id is the resource name with its capitals, exactly as in FHIR. An unknown name is a 404.

Needs the vocab:read scope. A test key and a live key read the same data and nothing is charged. The answer carries an ETag; send it back as If-None-Match to get a bodiless 304 while nothing has changed.

Scope vocab:read. Accepts: API key or personal access token. Open in the API reference

ParameterInTypeRequiredDescription
idpathstringYesThe FHIR R5 resource name, capitalised as in FHIR, such as `Patient`.
If-None-MatchheaderstringNoThe ETag of an answer you already hold. When it is still current the reply is 304 with no body.

GET/v1/vocab/industries

List industries

Returns ISIC Rev. 4 industries. Nepal's NSIC uses the same codes, so a code from here is valid on a Nepali business registration. With no parent and no q you get the top level, the sections. With parent set to a code you get its children: sections hold divisions, divisions hold groups, groups hold classes. With q you get matches from any level, best first.

Each row names the starting template a workspace in that industry gets, which is what the assistant starts from. To set your own organization's industry, use PUT /v1/vocab/industry. An unreadable cursor is a 400. Page with cursor and limit; total says how long the whole list is, and next is null at the end.

Needs the vocab:read scope. A test key and a live key read the same data and nothing is charged. The answer carries an ETag; send it back as If-None-Match to get a bodiless 304 while nothing has changed.

Scope vocab:read. Accepts: API key or personal access token. Open in the API reference

ParameterInTypeRequiredDescription
qquerystringNoSearch text, English or Nepali. Best matches first.
parentquerystringNoOnly the children of this ISIC code. Left out, the top-level sections.
cursorquerystringNoThe `next` of the previous page. Pass it back unchanged. It stays valid across a vocabulary update; an unreadable cursor is a 400.
limitqueryintegerNoHow many items to return, 1 to 200. 50 when left out. A value outside the range is clamped.
If-None-MatchheaderstringNoThe ETag of an answer you already hold. When it is still current the reply is 304 with no body.

GET/v1/vocab/industry

Get the organization's industry

Returns the ISIC/NSIC industry this organization works in, its title in English and Nepali, and the starting template that follows from it. chosen is true when someone set it with the PUT operation and false when AirFone derived it from the category and type picked during onboarding.

Needs the vocab:read scope. A test key reads the sandbox's industry and a live key the live organization's. Reading is free.

Scope vocab:read. Accepts: API key or personal access token. Open in the API reference

ParameterInTypeRequiredDescription
If-None-MatchheaderstringNoThe ETag of an answer you already hold. When it is still current the reply is 304 with no body.

PUT/v1/vocab/industry

Set the organization's industry

Sets the industry for this organization, which picks the template the assistant starts from. Send an ISIC/NSIC code from the industries list, at any level. The code is trimmed and upper-cased. Send code: null, or an empty string, to drop the choice and go back to the industry derived from onboarding. The answer is the new state, the same as the GET.

Needs the vocab:write scope, and the caller must be an admin of the organization (the settings permission): a restricted key with the scope but acting for a non-admin is refused with 403. A code that is not in the vocabulary is a 400.

A test key changes the sandbox's industry and a live key the live organization's. The operation is idempotent: setting the same code again changes nothing, so it needs no Idempotency-Key and does not take one.

Scope vocab:write. Accepts: API key or personal access token. Open in the API reference

GET/v1/vocab/nepal

Get Nepal's small lists

Returns, in one answer, the lists that are small enough to send whole: provinces with their capitals and districts, palika types, mobile operators with their number prefixes, payment methods, education levels (ISCED 2011 and what Nepal calls each), fields of study, faculties, room types, meal plans and amenities. Every term has a Nepali label.

The 753 palikas are not here; they are paged at GET /v1/vocab/palikas. This answer is large and changes rarely, so keep it and revalidate with If-None-Match rather than fetching it on every request.

Needs the vocab:read scope. A test key and a live key read the same data and nothing is charged. The answer carries an ETag; send it back as If-None-Match to get a bodiless 304 while nothing has changed.

Scope vocab:read. Accepts: API key or personal access token. Open in the API reference

ParameterInTypeRequiredDescription
If-None-MatchheaderstringNoThe ETag of an answer you already hold. When it is still current the reply is 304 with no body.

GET/v1/vocab/palikas

List palikas

Returns Nepal's 753 local levels (metropolitan and sub-metropolitan cities, municipalities and rural municipalities), with code, English and Nepali names, type, district and province. Give district to get one district's palikas; give q to search by name in English or Nepali; give neither to page through all of them.

wards is null for the 26 palikas whose ward count is missing at the source. It is null, not zero. A district that matches nothing gives an empty list, not an error. The district is matched without regard to capitals. Page with cursor and limit; total says how long the whole list is, and next is null at the end.

Needs the vocab:read scope. A test key and a live key read the same data and nothing is charged. The answer carries an ETag; send it back as If-None-Match to get a bodiless 304 while nothing has changed.

Scope vocab:read. Accepts: API key or personal access token. Open in the API reference

ParameterInTypeRequiredDescription
qquerystringNoSearch text, English or Nepali. Best matches first.
districtquerystringNoOnly the palikas of this district, by its English name, such as `Kathmandu`.
cursorquerystringNoThe `next` of the previous page. Pass it back unchanged. It stays valid across a vocabulary update; an unreadable cursor is a 400.
limitqueryintegerNoHow many items to return, 1 to 200. 50 when left out. A value outside the range is clamped.
If-None-MatchheaderstringNoThe ETag of an answer you already hold. When it is still current the reply is 304 with no body.

GET/v1/vocab/product-categories

List product categories

Returns the Google product taxonomy, in English and Nepali where translated. With no parent and no q you get the top categories. With parent set to a category id you get its children. With q you get matches from any depth, best first. Each row carries the full path from the top, so a match can be shown in context ("Food, Beverages & Tobacco > Beverages > Tea").

Use the ids when you tag your own catalogue so that products you push line up with the ones the assistant already knows. Category ids are whole numbers: a parent that is not one, or an unreadable cursor, is a 400. Page with cursor and limit; total says how long the whole list is, and next is null at the end.

Needs the vocab:read scope. A test key and a live key read the same data and nothing is charged. The answer carries an ETag; send it back as If-None-Match to get a bodiless 304 while nothing has changed.

Scope vocab:read. Accepts: API key or personal access token. Open in the API reference

ParameterInTypeRequiredDescription
qquerystringNoSearch text, English or Nepali. Best matches first.
parentquerystringNoOnly the children of this category id, a whole number. Left out, the top categories.
cursorquerystringNoThe `next` of the previous page. Pass it back unchanged. It stays valid across a vocabulary update; an unreadable cursor is a 400.
limitqueryintegerNoHow many items to return, 1 to 200. 50 when left out. A value outside the range is clamped.
If-None-MatchheaderstringNoThe ETag of an answer you already hold. When it is still current the reply is 304 with no body.

GET/v1/vocab/types

List types

Returns the types of things a business can have: Thing, Organization, Hotel, np:Ward and so on. A type has parents, so the list is a tree you walk one level at a time. With no parent, you get the subtypes of Thing, the root. With parent set to a type id, you get that type's direct subtypes. With q, you get types whose name or description match, best first, from the whole tree.

parent and q may be combined to search inside one branch. An unreadable cursor is a 400. Each row says how many direct subtypes it has, so you know whether to descend further. Page with cursor and limit; total says how long the whole list is, and next is null at the end.

Needs the vocab:read scope. A test key and a live key read the same data and nothing is charged. The answer carries an ETag; send it back as If-None-Match to get a bodiless 304 while nothing has changed.

Scope vocab:read. Accepts: API key or personal access token. Open in the API reference

ParameterInTypeRequiredDescription
qquerystringNoSearch text, English or Nepali. Best matches first.
parentquerystringNoOnly the direct subtypes of this type id. Left out, the subtypes of `Thing`.
cursorquerystringNoThe `next` of the previous page. Pass it back unchanged. It stays valid across a vocabulary update; an unreadable cursor is a 400.
limitqueryintegerNoHow many items to return, 1 to 200. 50 when left out. A value outside the range is clamped.
If-None-MatchheaderstringNoThe ETag of an answer you already hold. When it is still current the reply is 304 with no body.

GET/v1/vocab/types/{id}

Get one type

Returns one type: its label in English and Nepali, its parents, its chain of ancestors nearest first, and counts of its direct subtypes and of its properties (inherited ones included). Use it to decide whether to list the subtypes or the properties next.

The id is case sensitive and looks like Hotel or np:Ward. An id that is not in the vocabulary is a 404.

Needs the vocab:read scope. A test key and a live key read the same data and nothing is charged. The answer carries an ETag; send it back as If-None-Match to get a bodiless 304 while nothing has changed.

Scope vocab:read. Accepts: API key or personal access token. Open in the API reference

ParameterInTypeRequiredDescription
idpathstringYesThe type id, such as `Hotel` or `np:Ward`.
If-None-MatchheaderstringNoThe ETag of an answer you already hold. When it is still current the reply is 304 with no body.

GET/v1/vocab/types/{id}/properties

List a type's properties

Returns the properties a type can have: its own first, then those inherited from its ancestors. Each says what types its value can take (range), and whether it is declared on this type (own) or inherited. These are the same names the assistant uses for facts, such as price or opening_hours.

q filters the properties by name. An id that is not a type is a 404, and an unreadable cursor is a 400. Page with cursor and limit; total says how long the whole list is, and next is null at the end.

Needs the vocab:read scope. A test key and a live key read the same data and nothing is charged. The answer carries an ETag; send it back as If-None-Match to get a bodiless 304 while nothing has changed.

Scope vocab:read. Accepts: API key or personal access token. Open in the API reference

ParameterInTypeRequiredDescription
idpathstringYesThe type id, such as `Hotel` or `np:Ward`.
qquerystringNoSearch text, English or Nepali. Best matches first.
cursorquerystringNoThe `next` of the previous page. Pass it back unchanged. It stays valid across a vocabulary update; an unreadable cursor is a 400.
limitqueryintegerNoHow many items to return, 1 to 200. 50 when left out. A value outside the range is clamped.
If-None-MatchheaderstringNoThe ETag of an answer you already hold. When it is still current the reply is 304 with no body.