Relations

Read, filter and change the links between records.

On this page

A relation field links records. Its metadata gives the target object and the cardinality in config. Relations come in pairs: a person's company is the other side of a company's people. Changing one side changes both.

CardinalityExampleRead as
many_to_onea person's companyone linked record, or null
one_to_manya company's peoplean array
many_to_manya field linking both waysan array

A linked record looks like this:

Linked record
{
  "id": "84dc4b91-e114-4f52-97f1-8fa7cee37687",
  "displayValue": "Globex",
  "objectSlug": "companies",
  "imageUrl": null
}

Lists hold up to 10 linked records per field, single records up to 50. relationCounts has the full numbers.

GET/records/{recordId}/relations/{fieldKey}
ParameterDefaultRules
offset00–1,000,000
limit1001–100
cURL
curl --fail-with-body "$JEMERO_URL/records/$COMPANY_ID/relations/people?limit=100&offset=0" \
  -H "Authorization: Bearer $JEMERO_API_KEY"
Response 200
{
  "records": [
    {
      "id": "e1b83a4a-1363-4d45-a755-981a448cb410",
      "displayValue": "Grace Hopper",
      "objectSlug": "people",
      "imageUrl": null
    }
  ],
  "total": 1
}

An unknown or non-relation fieldKey answers 404 Relation field not found.

Write relations with Create or Update. Use record IDs.

For a many-to-one field, send an ID, or null to unlink:

cURL
curl --fail-with-body -X PATCH "$JEMERO_URL/records/$PERSON_ID" \
  -H "Authorization: Bearer $JEMERO_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{ \"values\": { \"company\": \"$COMPANY_ID\" } }"

For a field with many links, you have two choices. An array replaces all links:

Replace every link
{ "values": { "people": ["e1b83a4a-1363-4d45-a755-981a448cb410"] } }

An object with add and remove changes only what you name:

cURL
curl --fail-with-body -X PATCH "$JEMERO_URL/records/$COMPANY_ID" \
  -H "Authorization: Bearer $JEMERO_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{ \"values\": { \"people\": { \"add\": [\"$PERSON_ID\"] } } }"
  • Each list takes up to 500 IDs.
  • Linked records must be live records of the relation's target object. Otherwise the answer is 400.
  • Where a record can have only one parent, linking it to a new one moves it from the old one.

Use is_any_of, is_empty or is_not_empty on the relation's field ID. See Filtering.