---
title: "Create a relationship definition"
method: POST
path: "/v1/relationships"
tags: ["Relationships"]
---

# Create a relationship definition

`POST /v1/relationships`

## Request

- Base URL: `https://app.nex.ai/api/developers`
- URL: `https://app.nex.ai/api/developers/v1/relationships`
- Auth: API key in header `Authorization`

Creates a new relationship definition between two object types

## Request body

- DeveloperCreateRelationshipDefinitionRequest
  - `type` 'one_to_one' | 'one_to_many' | 'many_to_many', required: Relationship cardinality
  - `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 `200`

Created relationship definition

- DeveloperRelationshipDefinitionResponse
  - `id` string
  - `type` '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

## Other responses

- `400`: Bad request - Invalid data
- `401`: Unauthorized - Invalid or missing API key
- `500`: Internal server error

## Changes

- **2026-02-17** `b05d8cb8cf43`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/nex/apis/nex-developer-api/changes/v1/relationships/post.md)

---

[API](https://skmtc.dev/nex/apis/nex-developer-api.md) - [All operations](https://skmtc.dev/nex/apis/nex-developer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nex/apis/nex-developer-api/revisions/51003af13108?raw)
