Clarify API
Schemas

Add object relationships

Creates relationship fields between object types. The `attributes` map is keyed first by object type, then by field name, and both sides of each relationship must be supplied together so the pairing is consistent. On `one-to-many` and `many-to-many` sides, the field must declare `"oneOf": [{ "$ref": "https://getclarify.ai/schemas/core/collectionOfIds" }, { "type": "null" }]` — the exact `$ref` string is required. The change is applied asynchronously and the response body is empty.

POST
/workspaces/{workspace}/schemas/{entity}/relationships
Authorization<token>

API key authentication. Send your key in the Authorization header as: api-key <your-api-key>.

In: header

Path Parameters

workspace*string

The workspace slug — the {slug} segment of your Clarify workspace URL.

entity*string

The object type: a built-in entity (person, company, deal, …) or a custom object (c_*).

Query Parameters

silent?boolean

When true, suppresses in-app and Slack notifications for this mutation.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/workspaces/string/schemas/string/relationships" \  -H "Content-Type: application/json" \  -d '{    "data": {      "type": "relationship",      "attributes": {        "c_project": {          "company_id": {            "title": "Company",            "type": [              "string",              "null"            ],            "xClarifyRelationship": {              "kind": "many-to-one",              "entity": "company",              "field": "projects"            }          }        },        "company": {          "projects": {            "title": "Projects",            "oneOf": [              {                "x-ref": "https://getclarify.ai/schemas/core/collectionOfIds"              },              {                "type": "null"              }            ],            "xClarifyRelationship": {              "kind": "one-to-many",              "entity": "c_project",              "field": "company_id"            }          }        }      }    }  }'
{}