POST /api/v1/community/threads/{threadId}/attachments
Attaches files you already uploaded to a thread. An attachment can be attached once: a second call on the same id is refused.
| Role in the organization | This endpoint |
|---|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Conditional — the space must be in scope, and participation in progress |
| Requirement | Rule for this endpoint |
|---|---|
| Business role | None |
| Resource scope | Thread of the school attached to the API key |
| Participation | Same rule as posting in that space |
| Resource state | An archived space answers 400 |
| Parameter | Type | Required | Description |
|---|---|---|---|
threadId | UUID | yes | Thread visible from the key's school |
| Header | Required | Description |
|---|---|---|
x-api-key | yes | API key created for this school |
Idempotency-Key | yes | Caller-generated key |
X-Correlation-Id | no | Caller correlation id, returned or generated |
| Field | Type | Required | Description |
|---|---|---|---|
attachmentIds | UUID[] | yes | Ids returned by the upload endpoint, 5 per post at most |
curl -X POST "$COHORTE_API_BASE_URL/api/v1/community/threads/$THREAD_ID/attachments" \
-H "x-api-key: $COHORTE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"attachmentIds":["0f1c6d8a-2a5e-4f51-9d1e-7c4b2a9f3e10"]}'200 OK — the attachments are attached.400 Bad Request — a missing or malformed attachmentIds, an archived space, an unknown or already attached id, or more than 5 attachments on the post.403 Forbidden — the bearer cannot post in that space.404 Not Found — the thread is unknown or belongs to another school.| Field | Type | Nullable | Description |
|---|---|---|---|
data.threadId | UUID | no | The thread that now carries them |
data.attached | integer | no | Number of attachments attached |
{
"success": true,
"data": {
"threadId": "3f7b2c91-1d3e-4a77-b0a1-6c8d5e4f2a09", "attached": 1
},
"correlationId": "1b1f7a1e-6d54-4f0c-8f97-2b2a1a7f5d33"
}