POST /api/v1/community/threads/{threadId}/links
Links a thread to what it is about, so the lesson, milestone, deliverable or live session can point back to the conversation. Four targets exist — a program is not one: a program discussion is a program-scoped space.
| Role in the organization | This endpoint |
|---|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Conditional — the thread's author, or a coach of the school |
| Requirement | Rule for this endpoint |
|---|---|
| Business role | coach, for a member who is not the thread's author |
| Resource scope | Thread and target belong to the key's organization |
| Participation | The bearer can read the thread's space and the target |
| Resource state | None |
| Parameter | Type | Required | Description |
|---|---|---|---|
threadId | UUID | yes | Thread of the key's organization |
| Header | Required | Description |
|---|---|---|
x-api-key | yes | API key created for this organization |
Idempotency-Key | no | Accepted and ignored: linking the same pair twice is already harmless |
X-Correlation-Id | no | Caller correlation id, returned or generated |
| Field | Type | Required | Nullable | Description |
|---|---|---|---|---|
targetType | string | yes | no | lesson, milestone, deliverable or live_session |
targetId | UUID | yes | no | The target, in the key's organization |
curl -X POST "$COHORTE_API_BASE_URL/api/v1/community/threads/$THREAD_ID/links" \
-H "x-api-key: $COHORTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"targetType": "lesson", "targetId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e"}'201 Created — the link exists now.200 OK — replayed: true: that pair was already linked; nothing changed.400 Bad Request — invalid JSON, an unknown target type, or an id that is not a UUID.401 Unauthorized — missing, unknown or expired key.403 Forbidden — the bearer may not link this thread, or the target is unknown or unreadable to them.404 Not Found — the thread is unknown, belongs to another school, or is in a space the bearer cannot read.| Field | Type | Description |
|---|---|---|
data.threadId | UUID | The thread |
data.targetType | string | As sent |
data.targetId | UUID | As sent |
data.linked | boolean | Always true — the pair is linked |
{
"success": true,
"replayed": false,
"data": {
"threadId": "2d3e4f5a-6b7c-4d8e-9f0a-1b2c3d4e5f6a",
"targetType": "lesson",
"targetId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"linked": true
},
"correlationId": "c0ffee00-1111-4222-8333-444455556666"
}