user_123 → order ord_998) points at a
relationship type that defines its role, the object types involved, and
metadata like cardinality. Think of it as the schema for your edges.
Creating a relationship requires a relationshipTypeId, so registering
the type — or finding an existing one with GET /relationship-types — is
a prerequisite for linking over the API. Registering also lets you
attach cardinality, description, and bidirectional so your graph is
self-describing and queryable in Segments.
When you register a type, you reference custom object types by
name (
order, line_item). When you create a relationship, you
reference the type by its relationshipTypeId (returned here) — so
register or list your types first. See the FAQ below.What you need before you register
Registration validates against your existing catalog, so have these ready first — in this order:1
An organization API key
Sent as
Authorization: Bearer boom_org_…. The organization is
derived from the key. See Authentication.2
The custom object type(s), already created
Both endpoints reference object types by name, and those types
must already exist for your org. An unknown name returns For
404 with
fuzzy suggestions. Confirm with:person_to_co you need one type; for co_to_co you need both the
parent and the child type.3
A role and (recommended) the metadata
Decide the
role label and, ideally, the cardinality and a short
description. These are the fields documented in the catalog below.Field catalog
Required vs. optional fields perkind. role, cardinality,
description, and bidirectional are common to both.
kind: "person_to_co"
kind: "co_to_co"
Both
person_to_co and co_to_co relationships can be created over the API.
To link two objects, call Link a relationship with kind: "co_to_co"
and parentExternalId / childExternalId (instead of personExternalId /
customObjectExternalId).Cardinality catalog
cardinality is optional but recommended. For person_to_co, read it as
person→object; for co_to_co, read it as parent→child.
Any other value is rejected with
400.
Register a type
created (false when
the type already existed and was refined in place):
List your types
Recommended order of operations
1
Create custom object types
POST /custom-objects/types (or via your dashboard / data sync). The
public API never auto-creates object types.2
Register relationship types
POST /relationship-types with cardinality + description. Keep the
relationshipTypeId from the response — you’ll need it to create
relationships.3
Upsert people and custom objects
POST /people and POST /custom-objects.4
Create relationships
POST /relationships, passing the relationshipTypeId from step 2.FAQ
Do I send the relationshipTypeId when creating a relationship?
Yes — it’s required. POST /relationships takes the
relationshipTypeId, which fixes the link’s role and which custom
object type it targets, so you don’t pass those separately. Get the id
from the response of POST /relationship-types or from
GET /relationship-types.
What happens if I skip registration?
You can’t —POST /relationships needs a relationshipTypeId, and the
only way to get one is to register a type (or list a type that already
exists from a prior data sync). So registering is a prerequisite for
linking over the API.
Can I change a type’s cardinality later?
Yes — re-POST the same type with the new value. It’s an upsert and only
the fields you send are updated.
Related
Quickstart
Register a type and create a relationship in context.
Events
Record what your linked people and objects did.