Find and call any operation, step by step
Every operation Codossier Office can run, from a search to a matter's preparation, is found, described and called through one door, and every one answers in the same shape, so a developer learns the API once.
One self-describing door for every operation: find it, read its contract, call it, and read one answer shape everywhere.
What it is
- One door for every operation:
POST /api/v1/execute/{name}, or/{name}/{table}/{id}for one that runs on a record. Codossier Office's own messages and your office's custom actions are called the same way. - A catalogue that describes itself:
GET /api/v1/executelists every operation with what it is for, its effect (read, write, external) and whether it costs money;GET /api/v1/execute/{name}gives one operation's full contract, with its input and output schemas. - One answer: an outcome (completed, queued, refused or failed, with a code and a message) beside the operation's own output_parameters. Refusals carry an error with a stable code and a correlation id for support.
- An OpenAPI 3 document of the data API, built from your own tables, at
/api/openapi.json. - Every call runs as the person or machine that makes it, with that caller's roles: the operations a role may run are set in the Builder.
Good to know
- Records are read and written at
/api/v1/data, and two records are linked at/api/v1/associate; the door refuses those verbs and says where to go. - Most operations carry a summary, an effect and a cost in the catalogue; some older ones list only their name and description.
- In production the OpenAPI document may require a key, and anonymous requests to it are limited per minute.
Before you start
- Everything Codossier Office can do beyond reading and writing records is an operation with a name: search everything, send an email, Bates-number a production, prepare a matter. Every one of them is called through the same door,
POST /api/v1/execute/{name}, and every one of them answers in the same shape. - This guide shows how a developer finds the operations, reads what one takes and gives back, what it does and whether it costs money, calls it, and reads its answer and its refusals. Every request and answer below is a real exchange with a Codossier Office office, shown as it came back; record ids and support ids are hidden, and long lists are shortened where the picture says so.
- You sign in as a person (the browser session) or as a machine with an API key: Give a machine its own API key.
1List every operation: GET /api/v1/execute
Send GET /api/v1/execute. The answer lists every operation you can call here: Codossier Office's own messages (kind message), then the active custom actions your office built (custom_action). This office answered 465.
Each entry says, in one line, what it is for: summary, its domain, its effect (read, write, external when something leaves Codossier Office, as an email does), its cost (none, or paid when it calls a paid model or vendor) and its binding (whether it runs with no record or on a record of a given table). Here three of them: a free search, an email send that leaves the building, and a paid matter preparation.

2Read one operation's contract: GET /api/v1/execute/{name}
Add the name: GET /api/v1/execute/RecordSearch. The answer is the operation's contract: its input_schema (a JSON schema: q is required, tables, top and skip are optional, each with its limits and a sentence on what it means), its output_schema, its effect and cost, and use_when, a line on when to choose it over its neighbours.
The contract also names related operations, an example call and what the operation requires (fifteen more keys, left out of the picture). Write your call from it: you do not need to guess a parameter name.

3Call it, and read the outcome
Send the input as a JSON body: POST /api/v1/execute/RecordSearch with {"q":"Harbor Glen","tables":["matter","court_appearance"],"top":3}. The header X-Codossier Office-Operation-Kind says whether a message or a custom action ran.
Every operation answers the same two parts. outcome says what happened: state is completed (200), queued (202: the work goes on in the background and job_id says which job), refused or failed, with a code and a message for a person. output_parameters is the operation's own answer, here the matter found, with its record number. An operation with nothing to say answers 204 and no body.
?fields=true and the outcome also lists every output value with its type (string, date, lookup and so on), so a client can format it without knowing the operation.
4Read a refusal: the error and the outcome
A refusal carries the same outcome (state refused) beside an error with a stable code your code can branch on, and a message that says what to do. Above, RecordGraphGet was called without a record: it runs on one, so Codossier Office answers execute_record_required and gives the route to use. Below, a name that does not exist: unknown_message.
Other refusals you will meet at the door: execute_use_data (Create, Update and the other record verbs go through the data API), execute_table_mismatch (the operation runs on another table), and a refusal of access when your roles do not hold the operation. Every error also carries a correlation_id (hidden here) to quote to support.

5Get the OpenAPI document
GET /api/openapi.json (the same document is at /api/v1/metadata/openapi.json) answers an OpenAPI 3.0.3 description of the data API, built from your office's own tables: for each table a list and a create, and a read, an update and a delete by id. It also describes the shared shapes every client needs: MessageAnswer (what the door answers), MessageOutcome and ApiErrorResponse. Point a code generator or an API tool at it.
Asked without a key, as here, it is the anonymous view: tables marked to stay out of it are left out (the description says so). Sent with your API key, it describes every table you have. An operation's own input and output are in its contract (step 2), not in this document.

What next
- Records themselves are read and written through the data API, not this door: Read and write records over the API. Many writes in one call: Send many changes in one call.
- Who may run which operation is set on each role: Choose who may run which operation.
- The catalogue of tables and fields: Read the catalogue and change structure.