---
title: "Add an agent to a group (idempotent)"
method: PUT
path: "/agents/{agent_id}/groups/{group_id}"
tags: ["Agent Groups"]
---

# Add an agent to a group (idempotent)

`PUT /agents/{agent_id}/groups/{group_id}`

## Request

- Base URL: `https://api.mnemom.ai/v1`
- URL: `https://api.mnemom.ai/v1/agents/{agent_id}/groups/{group_id}`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-Mnemom-Api-Key`

Agent-centric membership route. Adds the agent to the group. Idempotent — if the agent is already a member the call succeeds and returns added: false. Reuses the same authorization and upsert logic as the group-centric POST endpoint. Authorization: the `group_id` is resolved to its owning organization and the caller must be an owner/admin of that org (a group in another org is invisible → 404), and `agent_id` is re-verified to belong to that same org before the write, so neither a foreign group nor a foreign agent can be touched and no other tenant's data is affected.

## Path parameters

- `agent_id` string, required
- `group_id` string, uuid, required

## Response `200`

Membership set

- object
  - `group_id` string
  - `agent_id` string
  - `added` boolean: true if the agent was newly added, false if already present

## Other responses

- `400`: Bad request
- `401`: Authentication required
- `403`: Forbidden
- `404`: Resource not found
- `429`: Rate-limit exceeded. The global per-IP limiter (100 requests/minute, applied to every `/v1/*` route) rejected this request. Back off until the window resets — `Retry-After` carries the cooldown in seconds and `X-RateLimit-Reset` the absolute reset time.
- `500`: Server error — request was well-formed but the server failed to fulfill it. Typically a downstream dependency (DB / RPC / external API) returned an unexpected error.
- `503`: An upstream dependency is currently unavailable. The request was not processed; retry after the cooldown window.

---

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