Skip to content

Update a work item's audiences ​

PATCH/api/v2/workspaces/{slug}/projects/{project_id}/work-items/{pk}/audiences/

Attach the audiences in add to this work item and detach the ones in remove, then get back the result in the same shape as Get a work item's audiences. Audiences you don't name stay as they are, so you can attach or detach one without reading the list first.

This changes only the work item's own audiences, never its type's. A work item's own audiences override its type's: once it has an active audience of its own, the type's audiences stop applying to it. Detach all of its own audiences and it follows its type again.

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 (uuid)

The project the work item belongs to.

pk:requiredstring

The work item's UUID or its identifier, such as PROJ-157.

Body parameters ​

add:optionalarray of string (uuid)

Audience ids to attach. Up to 100. Attaching an audience that is already attached changes nothing, and duplicate ids count once.

Every id must be an audience in this workspace. If one isn't, the request returns 400 and nothing is written. You can attach an inactive audience. It restricts nothing until it is turned on.

remove:optionalarray of string (uuid)

Audience ids to detach. Up to 100. Detaching an audience that isn't attached, or an id that names no audience, changes nothing.

An id in both add and remove is a 400. A body with neither field, such as {}, changes nothing and returns the current audiences.

This works on archived work items without ?archived=.

Permissions ​

You need edit access to the work item.

Scopes ​

projects.work_items:write

Errors ​

StatusCodeCause
400invalid_requestadd or remove isn't an array of UUIDs, has more than 100 ids, or shares an id with the other. Or an id in add isn't an audience in this workspace.
401unauthorizedMissing or invalid credentials.
402payment_requiredWork item security isn't on your plan, or is switched off.
403forbiddenYou can't edit the work item, or your token can't write.
404not_foundNo such work item, it's outside your project or tenant, you can't view it, or it's a draft, a triage work item, or in an archived project.
405method_not_allowedYou sent PUT. Use PATCH.
406not_acceptableThe Accept header asks for a representation the API can't produce.
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.
Update a work item's audiences
bash
curl -X PATCH \
  "https://api.plane.so/api/v2/workspaces/my-team/projects/4af68566-94a4-4eb3-94aa-50dc9427067b/work-items/47ed6fba-1a4d-4b19-8c67-28d835d2c2c7/audiences/" \
  -H "X-Api-Key: $PLANE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "add": ["8bcf2c8f-7bd0-4d0c-bdc6-82df9fa1f312"]
}'
Response200
json
{
  "source": "work_item",
  "enforced_source": "work_item",
  "audiences": [
    {
      "id": "8bcf2c8f-7bd0-4d0c-bdc6-82df9fa1f312",
      "name": "Security response",
      "logo_props": {},
      "is_active": true
    }
  ]
}
Response400
json
{
  "type": "invalid_request",
  "code": "invalid_request",
  "detail": "One or more fields failed validation.",
  "errors": [
    {
      "field": "add",
      "code": "invalid",
      "message": "Audiences not found in this workspace: ['5b7e2f90-c3a1-4d6e-8f42-91d0a6c3e7b8']"
    }
  ]
}

What a PATCH changes ​

  • The response is the work item's audiences after the change, with source and enforced_source recomputed. When you detach the work item's last audience of its own, the response switches to its type's audiences, or to [] with enforced_source: null.
  • Each audience the call attaches or detaches adds an attached or detached entry to that audience's activity, and an "added audience" or "removed audience" entry to the work item's activity. These changes send no notifications. Ids that didn't change anything add nothing.
  • The change applies as one transaction. If any id in add fails, nothing is attached or detached.

You can restrict a work item away from yourself

Edit access is enough to attach an audience, even one that doesn't admit you. Unless you are a workspace owner or admin, or an assignee or subscriber of the work item, attaching an active audience you aren't in hides the work item from you: the response still comes back, but later reads return 404. Check List an audience's effective users first.

Swap audiences in one call ​

Because add and remove apply together, you can replace one audience with another without a window where the work item falls back to its type:

json
{
  "add": ["33d89ed2-712a-4fc0-93cf-91eedbba5ef1"],
  "remove": ["8bcf2c8f-7bd0-4d0c-bdc6-82df9fa1f312"]
}