Records
Base URL and endpoints
Every endpoint is namespaced under /api/v1/{module}, where {module} is a module's slug (leads, contacts, deals, accounts, and so on: the same slug you see in the module's URL inside the app).
| Method | Path | Action |
|---|---|---|
GET | /api/v1/{module} | List records |
GET | /api/v1/{module}/{id} | Get one record |
POST | /api/v1/{module} | Create a record |
PUT | /api/v1/{module}?match={field} | Create or update by a field |
PUT / PATCH | /api/v1/{module}/{id} | Update a record |
DELETE | /api/v1/{module}/{id} | Delete a record |
Linking records has its own endpoints; see Relationships.
Listing records
GET /api/v1/leads?per_page=25&sort=name&direction=asc&search=acme| Parameter | Meaning |
|---|---|
per_page | Records per page. Defaults to 25. |
search | Matches against the module's searchable fields. |
sort | A field name to sort by. Works for any field marked sortable in the module's field setup, custom fields included, plus created_at, updated_at, created_by and updated_by. Number fields sort as numbers. A field that can't be sorted is ignored without an error, and the list keeps its default order: newest first. |
direction | asc (the default) or desc. Ignored if sort isn't also set. |
filter | The slug or ID of a saved list filter you already created in the app for that module (Deals → your saved "Open This Quarter" filter, for example), not a raw filter expression. |
A list response looks like:
{
"data": [
{ "id": "...", "name": "Acme Corp", "email": "hello@acme.com", "...": "..." }
],
"meta": {
"total": 128,
"per_page": 25,
"current_page": 1,
"last_page": 6
},
"links": {
"next": "https://yourapp.com/api/v1/leads?page=2",
"prev": null
}
}Getting, creating, updating, deleting
GET/POST/PUT/PATCH responses wrap a single record in { "data": {...} }. DELETE returns an empty 204 No Content body on success and moves the record to the Bin.
PUT/PATCH are partial patches: send only the fields you want to change. Fields you omit keep their existing value.
POST /api/v1/leads
Content-Type: application/json
{ "name": "Jane Doe", "email": "jane@example.com" }What you can send
Only the module's writable fields are accepted. Cubrel sets these fields itself, and you can't send them:
owner_id: a new record is owned by the token's user, and an update keeps the current owner.created_by,updated_by,created_atandupdated_at.- Any field marked read-only or calculated in the module's field setup, such as a quote number or a quote total.
If the body contains one of these, or a key that isn't a field of the module, the whole request is refused with a 422 that names the keys. Nothing is saved:
{
"message": "Unknown or read-only fields: owner_id, foo",
"errors": {
"fields": ["Unknown or read-only fields: owner_id, foo"]
}
}Clearing a field. Send null or an empty string. A required field can't be cleared; that gets a 422 on the field.
Required fields. A create needs every required field except the owner. An update only checks the required fields you send, so a partial update never fails on a field you left out.
Conditional fields. A field that only shows under a condition (for example, a deal's lost reason, which shows when the stage is "Closed Lost") is required only while it shows. The condition is checked against the record as it will be after your change, so setting a deal to closed_lost without a lost_reason gets a 422, and moving it back to prospecting doesn't need one.
Values by field type:
| Field type | Send |
|---|---|
| Text, long text, phone, IBAN | A string. Phone and IBAN aren't checked further. |
| A valid email address. | |
| URL | A web address. example.com is accepted without https://. |
| Integer, duration | A whole number. |
| Number, decimal, currency, percentage | A number. "12.50" as a string is fine. |
| Date, date and time | A date, for example 2026-12-01 or 2026-12-01 14:30:00. |
| Checkbox | true or false (1 and 0 also work). |
| Select, status | One of the list's values, for example closed_lost. The label isn't accepted. |
| Record | The ID of a record in the related module, for example a user's ID. |
| Multivalue | A JSON array, for example ["a", "b"]. |
| Address | A JSON object. |
| File | A stored file path, or an object with a path key. |
Values that don't match get a 422 on that field. Your workspace's OpenAPI file lists every field and every allowed select value; see Getting Started.
Custom fields
Any custom field a module has is just another key in the same flat JSON object, both when you send it and when you read it back. There's no separate custom_fields wrapper to know about:
{ "name": "Jane Doe", "referral_source": "conference" }referral_source here is a custom field defined on the Leads module in Workspace > Modules Manager; from the API's point of view it behaves exactly like a built-in field.
Related and child records
Getting, creating, or updating a single record (never a list) includes extra keys beyond that record's own fields, so you rarely need a second request to get the full picture.
related: present on every module, always, keyed by relationship name. Each value is an array of the records linked through that relationship (an empty array if nothing's linked, or if the module has no relationships at all):
{
"id": "...",
"name": "Acme Corp",
"related": {
"leads_tasks": [
{ "id": "...", "name": "Follow up call", "status": "not_started" }
],
"leads_calls": [],
"leads_meetings": []
}
}Relationship names aren't published as a fixed list; reading them off a record's related object is how you discover them. Each relationship is capped to a limited number of records (the same cap the app's own related-records panel uses) and isn't paginated within this response.
line_items on quotes and orders, and attendees on meetings: see below.
None of this appears when listing records (GET /api/v1/{module} without an {id}), only on a single record.
Line items
Quotes, orders and every other module with line items take them inside the record's own body. One request creates an order with all its products:
POST /api/v1/orders
Content-Type: application/json
{
"name": "Shop order #1042",
"line_items": [
{ "sku": "LAMP-01", "quantity": 2 },
{ "product_id": "…", "quantity": 4, "unit_price": 3.20 },
{ "name": "Gift wrapping", "quantity": 1, "unit_price": 5.00 }
]
}- A product by SKU or ID.
skumatches the product's SKU exactly. No product with that SKU, or more than one, gets a422on that item, such asline_items.0.sku; sendproduct_idthen. - The product fills the gaps. What you leave out of
name,unit_price,unitandtax_ratecomes from the product, the same way picking it in the app does. What you send wins, like a sale price. - Without a product,
name,quantityandunit_priceare required. - Other values:
description,discount(percent),tax_rate(percent) andnote. - Totals are calculated. Each line's totals and the record's
subtotal,discount_amount,tax_amountandtotalare worked out by Cubrel; you can't send them.
On an update, line_items is the complete new list:
PATCH /api/v1/orders/{id}
Content-Type: application/json
{
"line_items": [
{ "id": "…", "quantity": 3 },
{ "sku": "BULB-E27", "quantity": 1 }
]
}An item with id is updated (only what you send changes), an item without id is created, and an item you leave out is removed. The order of the list is the order on the record. A PATCH without line_items leaves them alone; "line_items": [] removes them all.
All or nothing. If one item is refused, nothing is saved: not the record, not any item.
Writing line items needs only Write on the record's module. A change sends one updated webhook for the record, with the new totals in changes.
Attendees
Meetings take their attendees inside the meeting's body:
POST /api/v1/meetings
Content-Type: application/json
{
"name": "Kickoff",
"attendees": [
{ "email": "lena@yourcompany.com", "role": "required" },
{ "email": "anna@customer.example" },
{ "email": "guest@partner.example", "name": "Max Partner" }
]
}Matched by email. Cubrel looks for a user with that email, then a contact, then a lead. One match links the attendee to that person. No match, or more than one, adds a guest with that email and name.
You can also name the person directly with source_type (user, contact or lead) and source_id.
| Key | Values |
|---|---|
role | organizer, required or optional (the default). A new organizer makes the old one required. |
rsvp_status | invited (the default), accepted, declined or tentative |
attendance_status | attended, no_show or null |
On create, the attendees are added next to the organizer the meeting always gets: the token's user. On an update, attendees is the complete new list, like line items: an attendee already on the meeting (by id, by the same person, or a guest by the same email) is updated, a new one is added, and anyone left out is removed. New attendees are notified as in the app.
Create or update by a field
To sync data from another system without looking records up first, send a PUT to the module with the field to match on:
PUT /api/v1/products?match=sku
Content-Type: application/json
{ "sku": "LAMP-01", "name": "Desk lamp", "price": 49.90 }| Records with that value | Result |
|---|---|
| None | The record is created: 201 |
| Exactly one | That record is updated: 200 |
| More than one | Nothing changes: 422 on the field |
match must be a writable text or email field of the module, custom fields included, and its value must be in the body. Other fields get a 422 on match. The usual rules apply: creating needs the required fields, and line_items and attendees work as above.
Typical matches are a product's sku, a contact's email, or a custom field holding the other system's ID.