Skip to main content

Collection Assignments

Assign a collection to a person or a group, either to limit what they see to that collection or only to preselect it for them, and list or remove assignments.

An assignment gives a collection to a person (user) or a group (group) of the workspace. In mode enforced, the person sees only the documents of their enforced collections; in mode default, the collection is only preselected for them and they still see everything else they may see. Assigning the same person or group again changes the mode instead of failing.

Assignments decide who sees what, so changing them is Admin only, as in the web app: documents:write, and the key's person must be an Admin of the workspace; anyone else gets 403 insufficient_role. Listing assignments needs the read scope (or documents:read) and any member. The person or group must belong to the workspace, or the call answers 400.

GET/v1/collections/{id}/assignments
POST/v1/collections/{id}/assignments

Body parameters

principal_type*stringuser or group.
principal_id*uuidThe person or group of the workspace.
mode*stringenforced limits what they see to their enforced collections; default only preselects this one.

Limit a person to one account

curl -X POST https://api.talonic.com/v1/collections/$COLLECTION_ID/assignments \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"principal_type": "user", "principal_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e", "mode": "enforced"}'
DELETE/v1/collections/{id}/assignments/{assignmentId}
An enforced assignment narrows what the person sees everywhere, including through their own API keys. Check GET /v1/collections/mine with their key to confirm what they now see.

Frequently asked questions

What is the difference between enforced and default?+
Enforced limits what the person sees to the documents of their enforced collections. Default only preselects the collection for them; they keep seeing everything else they may see.
How do I switch an assignment from default to enforced?+
Assign the same person or group again with the new mode. The existing assignment changes; there is no duplicate and no 409.
Does an assignment affect API keys?+
Yes. A key acts as its person, so an enforced assignment narrows what that person's keys can read as well.