Open Inventory / Docs
EndpointsInventory structureResourcesIdRelations

Create or pin a manual relationship

The API runs on your application instance. Schemas and field names come directly from the OpenAPI specification. Session-authenticated requests require a session on that instance.

POST
/resources/{id}/relations

One endpoint must match the resource id in the path. Containment relationships reject invalid parents, self-reference, and direct or indirect cycles. Creating an existing spatial relationship converts it to a manual relationship.

Authorization

bearerAuth
headerAuthorizationBearer <inv_ token>

Path Parameters

id*string
Formatuuid

Header Parameters

X-Organization-ID?string

Organization membership selected for this request. User-bound credentials may select any active membership; standalone tokens may only repeat their pinned organization ID.

Formatuuid

Request Body

application/json
  1. body
sourceResourceId*string

Directed parent or subject endpoint.

Formatuuid
targetResourceId*string

Directed child or object endpoint.

Formatuuid
relationTypeKey*string

Stable key of an administrator-configurable directed relationship type.

Match^[a-z][a-z0-9_-]{0,63}$
Length1 <= length <= 64

Response Body

Manual relationship created or pinned

application/json
  1. response
relation*
Example Request
curl -X POST 'https://inventory.example.com/api/v1/resources/497f6eca-6276-4993-bfeb-53cbbbba6f08/relations' \  -H 'Content-Type: application/json' \  -d '{  "sourceResourceId": "481dd929-1ef7-4b4f-8c71-b35f932f1b65",  "targetResourceId": "8b52d9f4-692a-4d1f-8c9f-c36bd283d92e",  "relationTypeKey": "string"}'
Example Response
{  "relation": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "sourceResourceId": "481dd929-1ef7-4b4f-8c71-b35f932f1b65",    "targetResourceId": "8b52d9f4-692a-4d1f-8c9f-c36bd283d92e",    "relationTypeKey": "string",    "origin": "manual",    "sourceFeatureId": "string",    "targetFeatureId": "string",    "attributes": {},    "createdBy": "string",    "createdAt": "2019-08-24T14:15:22Z"  }}