Skip to main content
POST
/
v1
/
relationships
Create a relationship definition
curl --request POST \
  --url https://app.nex.ai/api/developers/v1/relationships \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "one_to_many",
  "entity_definition_1_id": "123",
  "entity_definition_2_id": "456",
  "entity_1_to_2_predicate": "has",
  "entity_2_to_1_predicate": "belongs to"
}
'
{
  "id": "789",
  "type": "one_to_many",
  "entity_definition_1_id": "123",
  "entity_definition_2_id": "456",
  "entity_1_to_2_predicate": "has",
  "entity_2_to_1_predicate": "belongs to",
  "created_at": "2024-01-15T10:00:00Z"
}

Authorizations

Authorization
string
header
required

API key for authentication (format: "Bearer YOUR_API_KEY")

Body

application/json

Relationship definition to create

type
enum<string>
required

Relationship cardinality

Available options:
one_to_one,
one_to_many,
many_to_many
entity_definition_1_id
string
required

First object definition ID

entity_definition_2_id
string
required

Second object definition ID

entity_1_to_2_predicate
string

Label for 1→2 direction (e.g., 'has')

entity_2_to_1_predicate
string

Label for 2→1 direction (e.g., 'belongs to')

Response

Created relationship definition

id
string
type
enum<string>
Available options:
one_to_one,
one_to_many,
many_to_many
entity_definition_1_id
string
entity_definition_2_id
string
entity_1_to_2_predicate
string
entity_2_to_1_predicate
string
created_at
string<date-time>
Last modified on February 17, 2026