Skip to main content
POST
http://localhost:3000
/
tag-assignments
curl -X POST 'https://api.example.com/tag-assignments' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "tagId": "tag_engineering",
    "targetType": "subject",
    "targetId": "subject_jane",
    "scopeId": "scope_acme"
  }'
{
  "id": "tag_assignment_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
  "tagId": "tag_engineering",
  "targetType": "subject",
  "targetId": "subject_jane",
  "scopeId": "scope_acme",
  "appliedBy": "subject_admin",
  "appliedAt": "2024-01-15T10:30:00Z"
}

Request Body

id
string
Optional client-provided ID. Format: tag_assignment_{uuidv7}
tagId
string
required
ID of the tag to assign
targetType
string
required
Type of target. One of: resource, subject, role, permission
targetId
string
required
ID of the target entity
scopeId
string
required
Scope context for this assignment

Response

Returns the created tag assignment object.
curl -X POST 'https://api.example.com/tag-assignments' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "tagId": "tag_engineering",
    "targetType": "subject",
    "targetId": "subject_jane",
    "scopeId": "scope_acme"
  }'
{
  "id": "tag_assignment_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
  "tagId": "tag_engineering",
  "targetType": "subject",
  "targetId": "subject_jane",
  "scopeId": "scope_acme",
  "appliedBy": "subject_admin",
  "appliedAt": "2024-01-15T10:30:00Z"
}

Examples

Tag a Resource

curl -X POST 'https://api.example.com/tag-assignments' \
  -d '{
    "tagId": "tag_confidential",
    "targetType": "resource",
    "targetId": "resource_doc_123",
    "scopeId": "scope_acme"
  }'

Tag a Subject

curl -X POST 'https://api.example.com/tag-assignments' \
  -d '{
    "tagId": "tag_engineering",
    "targetType": "subject",
    "targetId": "subject_jane",
    "scopeId": "scope_acme"
  }'