---
title: "Add Agent To Group"
method: PUT
path: "/agents/{id}/groups/{groupId}"
tags: ["agents"]
---

# Add Agent To Group

`PUT /agents/{id}/groups/{groupId}`

## Request

- Base URL: `https://api.instruxi.dev/api/v1/enforcer`
- URL: `https://api.instruxi.dev/api/v1/enforcer/agents/{id}/groups/{groupId}`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `X-API-Key`

Adds the agent's service account to a group through the group-membership fence (AGENTS_CONTRACT §6.5): the caller must manage the agent (403 agent_consent_required), be able to write the group, and — short of tenant_manage — already be a member of it (403 not_group_member). Reserved group types stay the owning service's (403 group_type_reserved).

## Path parameters

- `id` string, required
- `groupId` string, required

## Response `200`

OK

- InternalDeliveryHttpHandlerAgentGroupMembershipResponse
  - `data` InternalDeliveryHttpHandlerAgentGroupMembershipData
    - `added` boolean: Added is true on a join that changed membership; Removed on a leave.
    - `group_id` string
    - `removed` boolean
  - `success` boolean

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found

---

[API](https://skmtc.dev/instruxi/apis/enforcer-api.md) · [All operations](https://skmtc.dev/instruxi/apis/enforcer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/instruxi/apis/enforcer-api/revisions/fa82bc1becc0?raw)
