1. Guides
  2. CRM
  3. Examples

Examples

CRM — Examples

Copy-paste, working requests. BASE=https://app.corteksa.info/api/v1 (a dedicated workspace uses its own subdomain: https://<subdomain>.corteksa.info/api/v1). Use either an API key (X-Api-Key: crtk_live_…) or an admin JWT (Authorization: Bearer …) — examples show the API key.

The data body is keyed by field slug (e.g. name-8fk2), never the display name. Find slugs at GET /object/:objectSlug/fields.

Read records (paginated)

cURL

bash
curl "$BASE/object/data/contacts?page=1&limit=25" \  -H "X-Api-Key: $API_KEY"

JavaScript (fetch)

ts
const res = await fetch(`${BASE}/object/data/contacts?page=1&limit=25`, {
  headers: { 'X-Api-Key': apiKey },
});
const { data, pagination } = await res.json(); // data = { fields, data: rows }

Read one record

bash
curl "$BASE/object/data/contacts/sara-ali-9d4e" \  -H "X-Api-Key: $API_KEY"

Create a record

Body keyed by field slug. select/status values must match an allowed option.

cURL

bash
curl -X POST "$BASE/object/data/contacts" \  -H "X-Api-Key: $API_KEY" \  -H "Content-Type: application/json" \  -d '{    "data": {      "name-8fk2": "Sara Ali",      "email-p0zx": "sara@acme.com",      "status-a1b2": "Lead"    }  }'

JavaScript (fetch)

ts
await fetch(`${BASE}/object/data/contacts`, {
  method: 'POST',
  headers: { 'X-Api-Key': apiKey, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    data: { 'name-8fk2': 'Sara Ali', 'email-p0zx': 'sara@acme.com', 'status-a1b2': 'Lead' },
  }),
});

Response (201):

json
{ "message": "Data created successfully",
  "data": { "slug": "sara-ali-9d4e", "name": "Sara Ali" } }

Every write door — create, update, inline create, duplicate — answers the record alone. The field catalog comes from a read (GET /object/data/:slug or .../:slug/:recordSlug) and is yours to cache: no record write can change it, so resending it on each save would repeat kilobytes you already hold.

Update a record

Send only the fields that change (still keyed by slug):

bash
curl -X PUT "$BASE/object/data/contacts/sara-ali-9d4e" \  -H "X-Api-Key: $API_KEY" \  -H "Content-Type: application/json" \  -d '{ "data": { "status-a1b2": "Customer" } }'

Link a relation on create

relations is keyed by the relation field slug → the linked record slug:

bash
curl -X POST "$BASE/object/data/deals" \  -H "X-Api-Key: $API_KEY" -H "Content-Type: application/json" \  -d '{    "data": { "title-k92a": "Acme renewal", "amount-xy12": 5000 },    "relations": { "company-r7t3": "acme-inc-2f9b" }  }'

Filter & paginate

filters is a JSON array of { fieldSlug, operator, value }:

bash
curl -G "$BASE/object/data/deals" \  -H "X-Api-Key: $API_KEY" \  --data-urlencode 'page=1' \  --data-urlencode 'limit=25' \  --data-urlencode 'sortBy=amount-xy12' \  --data-urlencode 'sortDirection=DESC' \  --data-urlencode 'filters=[{"fieldSlug":"status-a1b2","operator":"equals","value":"Won"}]'
ts
const params = new URLSearchParams({
  page: '1', limit: '25', sortBy: 'amount-xy12', sortDirection: 'DESC',
  filters: JSON.stringify([{ fieldSlug: 'status-a1b2', operator: 'greater_than', value: 1000 }]),
});
const res = await fetch(`${BASE}/object/data/deals?${params}`, { headers: { 'X-Api-Key': apiKey } });

Operators include equals, does_not_equal, includes, starts_with, greater_than, less_than, between, is_empty, before, after, this_month. Filter by assignee with adminSlug, or unassigned with unassigned=true.

Search

bash
curl -X POST "$BASE/object/data/contacts/search?page=1&limit=25" \  -H "X-Api-Key: $API_KEY" -H "Content-Type: application/json" \  -d '{ "searchTerm": "acme" }'

Delete

bash
curl -X DELETE "$BASE/object/data/contacts/sara-ali-9d4e" \  -H "X-Api-Key: $API_KEY"
WebhooksNext >

Powered by heyo-docs

On this page

Read records (paginated)Read one recordCreate a recordUpdate a recordLink a relation on createFilter & paginateSearchDelete