|
| 1 | +--- |
| 2 | +title: Add work items to epic |
| 3 | +description: Add work items to epic via Plane API. HTTP request format, parameters, scopes, and example responses for add work items to epic. |
| 4 | +keywords: plane, plane api, rest api, api integration, epics, add work items to epic |
| 5 | +--- |
| 6 | + |
| 7 | +# Add work items to epic |
| 8 | + |
| 9 | +<div class="api-endpoint-badge"> |
| 10 | + <span class="method post">POST</span> |
| 11 | + <span class="path">/api/v1/workspaces/{slug}/projects/{project_id}/epics/{epic_id}/issues/</span> |
| 12 | +</div> |
| 13 | + |
| 14 | +<div class="api-two-column"> |
| 15 | +<div class="api-left"> |
| 16 | + |
| 17 | +Add multiple work items as sub-issues under an epic. Validates type hierarchy before assignment. |
| 18 | + |
| 19 | +<div class="params-section"> |
| 20 | + |
| 21 | +### Path Parameters |
| 22 | + |
| 23 | +<div class="params-list"> |
| 24 | + |
| 25 | +<ApiParam name="epic_id" type="string" :required="true"> |
| 26 | + |
| 27 | +Epic ID |
| 28 | + |
| 29 | +</ApiParam> |
| 30 | + |
| 31 | +<ApiParam name="project_id" type="string" :required="true"> |
| 32 | + |
| 33 | +Project ID |
| 34 | + |
| 35 | +</ApiParam> |
| 36 | + |
| 37 | +<ApiParam name="slug" type="string" :required="true"> |
| 38 | + |
| 39 | +Workspace slug |
| 40 | + |
| 41 | +</ApiParam> |
| 42 | + |
| 43 | +</div> |
| 44 | +</div> |
| 45 | + |
| 46 | +<div class="params-section"> |
| 47 | + |
| 48 | +### Body Parameters |
| 49 | + |
| 50 | +<div class="params-list"> |
| 51 | + |
| 52 | +<ApiParam name="work_item_ids" type="array" :required="true"> |
| 53 | + |
| 54 | +List of work item IDs to add to the epic |
| 55 | + |
| 56 | +</ApiParam> |
| 57 | + |
| 58 | +</div> |
| 59 | +</div> |
| 60 | + |
| 61 | +<div class="params-section"> |
| 62 | + |
| 63 | +### Scopes |
| 64 | + |
| 65 | +`projects.epics:write` |
| 66 | + |
| 67 | +</div> |
| 68 | + |
| 69 | +</div> |
| 70 | + |
| 71 | +<div class="api-right"> |
| 72 | + |
| 73 | +<CodePanel title="Add work items to epic" :languages="['cURL', 'Python', 'JavaScript']"> |
| 74 | +<template #curl> |
| 75 | + |
| 76 | +```bash |
| 77 | +curl -X POST \ |
| 78 | + "https://api.plane.so/api/v1/workspaces/my-workspace/projects/550e8400-e29b-41d4-a716-446655440000/epics/550e8400-e29b-41d4-a716-446655440001/issues/" \ |
| 79 | + -H "X-API-Key: $PLANE_API_KEY" \ |
| 80 | + # Or use -H "Authorization: Bearer $PLANE_OAUTH_TOKEN" \ |
| 81 | + -H "Content-Type: application/json" \ |
| 82 | + -d '{ |
| 83 | + "work_item_ids": [ |
| 84 | + "550e8400-e29b-41d4-a716-446655440010", |
| 85 | + "550e8400-e29b-41d4-a716-446655440011" |
| 86 | + ] |
| 87 | +}' |
| 88 | +``` |
| 89 | + |
| 90 | +</template> |
| 91 | +<template #python> |
| 92 | + |
| 93 | +```python |
| 94 | +import requests |
| 95 | + |
| 96 | +response = requests.post( |
| 97 | + "https://api.plane.so/api/v1/workspaces/my-workspace/projects/550e8400-e29b-41d4-a716-446655440000/epics/550e8400-e29b-41d4-a716-446655440001/issues/", |
| 98 | + headers={"X-API-Key": "your-api-key"}, |
| 99 | + json={ |
| 100 | + "work_item_ids": [ |
| 101 | + "550e8400-e29b-41d4-a716-446655440010", |
| 102 | + "550e8400-e29b-41d4-a716-446655440011" |
| 103 | + ] |
| 104 | + } |
| 105 | +) |
| 106 | +print(response.json()) |
| 107 | +``` |
| 108 | + |
| 109 | +</template> |
| 110 | +<template #javascript> |
| 111 | + |
| 112 | +```javascript |
| 113 | +const response = await fetch( |
| 114 | + "https://api.plane.so/api/v1/workspaces/my-workspace/projects/550e8400-e29b-41d4-a716-446655440000/epics/550e8400-e29b-41d4-a716-446655440001/issues/", |
| 115 | + { |
| 116 | + method: "POST", |
| 117 | + headers: { |
| 118 | + "X-API-Key": "your-api-key", |
| 119 | + "Content-Type": "application/json", |
| 120 | + }, |
| 121 | + body: JSON.stringify({ |
| 122 | + work_item_ids: ["550e8400-e29b-41d4-a716-446655440010", "550e8400-e29b-41d4-a716-446655440011"], |
| 123 | + }), |
| 124 | + } |
| 125 | +); |
| 126 | +const data = await response.json(); |
| 127 | +``` |
| 128 | + |
| 129 | +</template> |
| 130 | +</CodePanel> |
| 131 | + |
| 132 | +<ResponsePanel status="200"> |
| 133 | + |
| 134 | +```json |
| 135 | +[ |
| 136 | + { |
| 137 | + "id": "550e8400-e29b-41d4-a716-446655440010", |
| 138 | + "name": "Implement login screen", |
| 139 | + "description_html": "<p>Build the login screen UI</p>", |
| 140 | + "description_stripped": "Build the login screen UI", |
| 141 | + "description_binary": null, |
| 142 | + "state": "550e8400-e29b-41d4-a716-446655440002", |
| 143 | + "priority": "high", |
| 144 | + "assignees": [], |
| 145 | + "labels": [], |
| 146 | + "type": null, |
| 147 | + "type_id": null, |
| 148 | + "estimate_point": null, |
| 149 | + "point": null, |
| 150 | + "start_date": null, |
| 151 | + "target_date": null, |
| 152 | + "parent": "550e8400-e29b-41d4-a716-446655440001", |
| 153 | + "sequence_id": 12, |
| 154 | + "sort_order": 65535.0, |
| 155 | + "is_draft": false, |
| 156 | + "completed_at": null, |
| 157 | + "archived_at": null, |
| 158 | + "last_activity_at": "2025-03-15T10:00:00Z", |
| 159 | + "project": "550e8400-e29b-41d4-a716-446655440000", |
| 160 | + "workspace": "550e8400-e29b-41d4-a716-446655440003", |
| 161 | + "external_id": null, |
| 162 | + "external_source": null, |
| 163 | + "deleted_at": null, |
| 164 | + "created_at": "2025-03-10T09:00:00Z", |
| 165 | + "updated_at": "2025-03-15T10:00:00Z", |
| 166 | + "created_by": "550e8400-e29b-41d4-a716-446655440005", |
| 167 | + "updated_by": null |
| 168 | + } |
| 169 | +] |
| 170 | +``` |
| 171 | + |
| 172 | +</ResponsePanel> |
| 173 | + |
| 174 | +</div> |
| 175 | + |
| 176 | +</div> |
0 commit comments