Skip to content

Create a work item relation ​

POST/api/v2/workspaces/{slug}/projects/{project_id}/work-items/{work_item_id}/relations/

Relate the work item in the path to one or more other work items through a relation definition. One call creates one relation per id in work_item_ids, all with the same definition and direction.

direction decides which side the path work item is on. The path work item lists the related work items under the label you send, and each of them lists the path work item under the definition's other label. Sending tests on ENG-42 for ENG-17 means "ENG-42 tests ENG-17", so ENG-17 shows ENG-42 under tested by.

The response is 201 with the path work item's whole relations map after the write, not only the new relations. A relation that already exists, with the same definition and direction, is skipped without an error.

The call is all or nothing on lookups: if the definition or any related work item isn't found, it returns 404 and creates no relations. Every 404 has the same detail, so check the definition id, the direction, and each id in work_item_ids when you get one.

You need edit access to the path work item. Project admins, contributors, and workspace owners and admins have it. The related work items only need to be visible to you, and they can be in any project in the workspace.

Path parameters ​

slug:requiredstring

The workspace slug. It appears in your Plane URLs. In https://app.plane.so/my-team/projects/, the slug is my-team.

project_id:requiredstring

The project the resource belongs to. Accepts the project UUID or its bare identifier, for example ENG.

work_item_id:requiredstring

The work item the resource belongs to. Accepts the work item UUID or its PROJ-123 identifier.

Body parameters ​

relation_definition_id:requiredstring (uuid)

The id of the relation definition to use. Get it from List work item relation definitions. An unknown or inactive definition returns 404.

direction:requiredstring

One of the definition's two labels, its outward or its inward, for example tests or tested by. The path work item lists the related work items under this label. The match is exact and case-sensitive. A value that matches neither label returns 404.

work_item_ids:requiredarray of string (uuid)

The work items to relate, from 1 to 100 UUIDs. PROJ-123 identifiers aren't accepted here. A repeated id counts once.

Every id must be a work item in the workspace that you can see. Archived, draft, and intake work items count as missing. One missing id fails the whole call with 404.

Scopes ​

projects.work_items.relations:write

Errors ​

StatusCodeCause
400invalid_requestrelation_definition_id, direction, or work_item_ids is missing, work_item_ids is empty or has more than 100 ids, or an id isn't a UUID. See errors[].
401unauthorizedMissing or invalid credentials.
403forbiddenYou can't edit this work item, or your token scope doesn't allow this.
404not_foundNo such workspace, project, or work item, you can't see the work item, or it's archived.
404not_foundAn id in work_item_ids isn't a work item you can see. Nothing is created.
404not_foundNo active definition has this relation_definition_id with direction as one of its labels. Nothing is created.
406not_acceptableThe Accept header asks for a representation the API can't produce.
409governance_migration_in_progressA governance migration is running in this workspace, so writes are paused. Retry after it finishes.
413payload_too_largeThe request body is over the size limit.
415unsupported_media_typeThe Content-Type isn't one this endpoint accepts.
429rate_limitedThrottled. Honor the Retry-After header before retrying.
Create a work item relation
bash
curl -X POST \
  "https://api.plane.so/api/v2/workspaces/my-team/projects/4af68566-94a4-4eb3-94aa-50dc9427067b/work-items/8c3d1f72-4a9e-4b65-9d20-6e1f3b7a5c48/relations/" \
  -H "X-Api-Key: $PLANE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "relation_definition_id": "7a4c9e12-5f3b-4d68-8e01-2b6d9f4a3c85",
  "direction": "tests",
  "work_item_ids": [
    "9c1f0b3d-6d2e-4c9a-8b41-2f7e5a0d6c88",
    "3d8f5a62-7b1e-4c94-a0d3-9e6c2f8b1a57"
  ]
}'
Response201
json
{
  "relates to": ["f3b8a1c6-2d7e-4a95-8c14-5e9d0b3f7a28"],
  "duplicate": [],
  "implements": [],
  "implemented by": ["6e2a9d47-1c5b-4f83-a7d0-3b8e4f1c9a62"],
  "tests": ["9c1f0b3d-6d2e-4c9a-8b41-2f7e5a0d6c88", "3d8f5a62-7b1e-4c94-a0d3-9e6c2f8b1a57"],
  "tested by": []
}