Creates a relation definition between two document types; an active one computes its keys at once.
const url = 'https://api.contentsurface.io/v1/admin/relation-definitions';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"key":"accountContacts","name":"Contacts","inverseName":"Account","from":{"documentTypeId":"dty_01j9n4xfr0e008000000000002","attributeId":null,"standardField":"sourceId"},"to":{"documentTypeId":"dty_01j9n4xfr0e008000000000003","attributeId":"att_01j9n4xbr0e008000000000003","standardField":null},"match":"exact","active":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.contentsurface.io/v1/admin/relation-definitions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "key": "accountContacts", "name": "Contacts", "inverseName": "Account", "from": { "documentTypeId": "dty_01j9n4xfr0e008000000000002", "attributeId": null, "standardField": "sourceId" }, "to": { "documentTypeId": "dty_01j9n4xfr0e008000000000003", "attributeId": "att_01j9n4xbr0e008000000000003", "standardField": null }, "match": "exact", "active": true }'Creates a relation definition: nodes of the from type and the to type are related wherever their fields hold the same value — such as a contact’s account ID and an account’s ID — across connections and connector types too. An active one is computed at once for the existing nodes. Relations never grant access: each user sees the related nodes they may read. Repository admins.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”A relation definition to create.
object
Its key: letters, digits and underscores in dot-separated parts, starting with a letter; unique and permanent.
What the to side’s nodes are, seen from the from side.
What the from side’s nodes are, seen from the to side.
The from side.
object
The document type (dty_…).
The attribute it matches on (att_…), mapped by the type; or use standardField.
name or sourceId, to match on a standard field instead of an attribute.
The to side.
object
The document type (dty_…).
The attribute it matches on (att_…), mapped by the type; or use standardField.
name or sourceId, to match on a standard field instead of an attribute.
exact (default) or ignoreCase.
False to create it inactive; default true.
Example
{ "key": "accountContacts", "name": "Contacts", "inverseName": "Account", "from": { "documentTypeId": "dty_01j9n4xfr0e008000000000002", "attributeId": null, "standardField": "sourceId" }, "to": { "documentTypeId": "dty_01j9n4xfr0e008000000000003", "attributeId": "att_01j9n4xbr0e008000000000003", "standardField": null }, "match": "exact", "active": true}Responses
Section titled “Responses”Created
A relation definition: nodes of two document types are related where their fields hold the same value.
object
The definition (rld_…).
Its permanent key, as searches name it in filters.related.definition.
What the to side’s nodes are, seen from the from side, such as Contacts.
What the from side’s nodes are, seen from the to side, such as Account.
The from side.
object
The document type (dty_…).
The attribute it matches on (att_…), mapped by the type; or use standardField.
name or sourceId, to match on a standard field instead of an attribute.
The to side.
object
The document type (dty_…).
The attribute it matches on (att_…), mapped by the type; or use standardField.
name or sourceId, to match on a standard field instead of an attribute.
exact, or ignoreCase to compare values ignoring case.
active (relations are computed and shown) or inactive.
When it was created.
Its version, also its ETag.
Example
{ "id": "rld_01j9n4wvr0e008000000000001", "key": "accountContacts", "name": "Contacts", "inverseName": "Account", "from": { "documentTypeId": "dty_01j9n4xfr0e008000000000002", "attributeId": null, "standardField": "sourceId" }, "to": { "documentTypeId": "dty_01j9n4xfr0e008000000000003", "attributeId": "att_01j9n4xbr0e008000000000003", "standardField": null }, "match": "exact", "status": "active", "createdAt": "2026-09-19T08:30:00+00:00", "version": 1}The request is not valid: a malformed ID, body, filter or parameter.
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:validation-failed", "title": "The request is not valid.", "status": 400, "detail": "'key' is letters, digits and underscores in dot-separated parts, starting with a letter.", "code": "validation-failed", "field": "key"}No valid access token, or it no longer holds for the user (suspended, signed out, relation removed).
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:unauthorized", "title": "Not authenticated.", "status": 401, "detail": "A valid access token is required.", "code": "unauthorized"}Authenticated but not allowed: a missing scope or role, an impersonated token on an admin endpoint, or an inactive tenant.
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:role-required", "title": "Not allowed.", "status": 403, "detail": "This endpoint requires one of the roles: repositoryAdmin.", "code": "role-required"}Absent: not existing, in another tenant, or not readable by the caller — never distinguished.
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:not-found", "title": "Not found.", "status": 404, "detail": "The resource does not exist.", "code": "not-found"}Conflicts with the current state, or needs confirmation (confirmation-required with impactToken).
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:name-taken", "title": "The request conflicts with the current state.", "status": 409, "detail": "Another relation definition already has this name.", "code": "name-taken"}Load protection: the tenant is making too many calls, or running too many searches or content streams, at once. Transient and never a quota; retry after Retry-After seconds.
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:too-many-requests", "title": "Too many requests.", "status": 429, "detail": "The tenant is making more API calls than one replica serves at once; retry shortly.", "code": "too-many-requests", "retryAfter": 1}