> ## Documentation Index
> Fetch the complete documentation index at: https://velt-raghul-agent-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove Agents from Group

Use this API to remove one or more agents from a group. The operation is **idempotent** — removing an id that is not a member is a silent success.

The agents themselves are **not deleted** — only their membership in this group is removed. To delete a custom agent (and have it removed from every group), use [Delete Agent](/api-reference/rest-apis/v2/agents/delete).

# Endpoint

`POST https://api.velt.dev/v2/agents/groups/remove-agents`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="groupId" type="string" required>
      Trimmed, non-empty. Agent group id.
    </ParamField>

    <ParamField body="agentIds" type="string[]" required>
      Non-empty. Each id must be min 1 char.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### 1. Remove a single agent

```JSON theme={null}
{
  "data": {
    "groupId": "grp_9f3ac2",
    "agentIds": ["abc123def456"]
  }
}
```

#### 2. Remove multiple agents

```JSON theme={null}
{
  "data": {
    "groupId": "grp_9f3ac2",
    "agentIds": ["abc123def456", "spell-check"]
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Agents removed from group successfully",
    "data": {
      "group": {
        "id": "grp_9f3ac2",
        "name": "Brand QA",
        "agentIds": ["broken-links"],
        "metadata": { "apiKey": "ak_xxx" },
        "createdAt": 1711900000000,
        "updatedAt": 1711950000000
      }
    }
  }
}
```

| Field        | Type   | Description                |
| ------------ | ------ | -------------------------- |
| `data.group` | object | The updated group document |

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "NOT_FOUND"
  }
}
```

**Errors:**

* `NOT_FOUND` — group does not exist
* `INVALID_ARGUMENT` — empty `agentIds` array, or any id is empty

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Agents removed from group successfully",
      "data": {
        "group": {
          "id": "grp_9f3ac2",
          "name": "Brand QA",
          "agentIds": [],
          "metadata": { "apiKey": "ak_xxx" },
          "createdAt": 1711900000000,
          "updatedAt": 1711950000000
        }
      }
    }
  }
  ```
</ResponseExample>
