> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ryzeapi.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Gerenciar Participantes

> Adiciona, remove, promove, rebaixa, aprova ou rejeita participantes em um grupo

**Auth:** `TokenAccount` ou `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotente:** não

## Descrição

Endpoint único para 6 ações sobre participantes, define a operação no campo `action`. Cada participante recebe um resultado individual (`success: bool`), então **operações parciais são possíveis**: a chamada pode retornar `200` com alguns membros falhando.

## Exemplos

### Adicionar ao Grupo

Adiciona 2 números ao grupo `120363406289005073@g.us` em uma única chamada (`action: "add"`). Falhas por privacidade ou número sem WhatsApp ficam isoladas em `success: false` no array `participants`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/group/participants/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "add",
      "identifier": "120363406289005073@g.us",
      "participants": ["5511999999999", "5521988888888"]
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/group/participants/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      action:       "add",
      identifier:   "120363406289005073@g.us",
      participants: ["5511999999999", "5521988888888"]
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/group/participants/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "action":       "add",
          "identifier":   "120363406289005073@g.us",
          "participants": ["5511999999999", "5521988888888"]
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "action": "add",
          "identifier": "120363406289005073@g.us",
          "participants": ["5511999999999", "5521988888888"]
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/group/participants/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Promover a Admin

Promove o número `5511999999999` a admin via `action: "promote"`. Requer que você seja super-admin do grupo (criador ou promovido por outro super-admin).

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/group/participants/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "promote",
      "identifier": "120363406289005073@g.us",
      "participants": ["5511999999999"]
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/group/participants/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      action:       "promote",
      identifier:   "120363406289005073@g.us",
      participants: ["5511999999999"]
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/group/participants/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "action":       "promote",
          "identifier":   "120363406289005073@g.us",
          "participants": ["5511999999999"]
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "action": "promote",
          "identifier": "120363406289005073@g.us",
          "participants": ["5511999999999"]
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/group/participants/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Rebaixar a Membro

Remove o cargo de admin do número `5511999999999` via `action: "demote"`, devolvendo-o ao status de membro comum. Também exige privilégio de super-admin.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/group/participants/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "demote",
      "identifier": "120363406289005073@g.us",
      "participants": ["5511999999999"]
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/group/participants/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      action:       "demote",
      identifier:   "120363406289005073@g.us",
      participants: ["5511999999999"]
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/group/participants/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "action":       "demote",
          "identifier":   "120363406289005073@g.us",
          "participants": ["5511999999999"]
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "action": "demote",
          "identifier": "120363406289005073@g.us",
          "participants": ["5511999999999"]
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/group/participants/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Aprovar Entrada no Grupo (request pendente)

Aprova um pedido de entrada pendente passando o LID `199789077627112@lid` em `participants` e `action: "approve"`. Funciona apenas em grupos com `requireAdminApproval=true`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/group/participants/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "approve",
      "identifier": "120363406289005073@g.us",
      "participants": ["199789077627112@lid"]
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/group/participants/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      action:       "approve",
      identifier:   "120363406289005073@g.us",
      participants: ["199789077627112@lid"]
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/group/participants/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "action":       "approve",
          "identifier":   "120363406289005073@g.us",
          "participants": ["199789077627112@lid"]
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "action": "approve",
          "identifier": "120363406289005073@g.us",
          "participants": ["199789077627112@lid"]
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/group/participants/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Rejeitar Entrada no Grupo (request pendente)

Rejeita um pedido pendente do número `5511999999999` via `action: "reject"`. O serviço resolve automaticamente o LID equivalente quando você passa apenas o telefone.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/group/participants/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "reject",
      "identifier": "120363406289005073@g.us",
      "participants": ["5511999999999"]
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/group/participants/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      action:       "reject",
      identifier:   "120363406289005073@g.us",
      participants: ["5511999999999"]
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/group/participants/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "action":       "reject",
          "identifier":   "120363406289005073@g.us",
          "participants": ["5511999999999"]
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "action": "reject",
          "identifier": "120363406289005073@g.us",
          "participants": ["5511999999999"]
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/group/participants/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Remover do Grupo

Remove o número `5511999999999` do grupo via `action: "remove"`. O ex-membro pode reentrar pelo link de convite, a menos que você gere um novo link com [`/reset-link`](/pt/api/groups/reset-link).

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/group/participants/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "remove",
      "identifier": "120363406289005073@g.us",
      "participants": ["5511999999999"]
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/group/participants/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      action:       "remove",
      identifier:   "120363406289005073@g.us",
      participants: ["5511999999999"]
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/group/participants/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "action":       "remove",
          "identifier":   "120363406289005073@g.us",
          "participants": ["5511999999999"]
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "action": "remove",
          "identifier": "120363406289005073@g.us",
          "participants": ["5511999999999"]
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/group/participants/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Resposta de sucesso

Cada participante recebe um resultado individual com `success: true|false` no array `participants`. **Operações parciais são possíveis**, a chamada pode retornar `200` mesmo com alguns membros falhando (número sem WhatsApp, privacidade impede add, já é membro, etc.). Sempre inspecione cada entrada para detectar erros isolados; o campo `error` traz o motivo quando `success=false`.

```json 200 OK (parcial) theme={null}
{
  "success": true,
  "message": "Successfully added 2 participant(s)",
  "groupJid": "120363406289005073@g.us",
  "action": "add",
  "participants": [
    {
      "jid": "5511999999999@s.whatsapp.net",
      "isAdmin": false,
      "isSuperAdmin": false,
      "success": true
    },
    {
      "jid": "5521988888888@s.whatsapp.net",
      "isAdmin": false,
      "isSuperAdmin": false,
      "success": false,
      "error": "user not on whatsapp"
    }
  ]
}
```

<Warning>
  Falhas individuais (`success: false`) **não** abortam o processamento dos demais participantes. Sempre inspecione cada entrada para detectar erros parciais (ex.: número sem WhatsApp, já membro, privacidade impede add).
</Warning>

## Parâmetros de rota

<ParamField path="instance" type="string" required>
  Nome da instância.
</ParamField>

## Headers

<ParamField header="token" type="string" required>
  `TokenAccount` ou `TokenInstance`.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Request body

<ParamField body="action" type="string" required>
  Uma de: `add`, `remove`, `promote`, `demote`, `approve`, `reject`.
</ParamField>

<ParamField body="identifier" type="string" required>
  JID, código de convite ou link do grupo.
</ParamField>

<ParamField body="participants" type="string[]" required>
  Números ou JIDs alvo da operação. Pelo menos **1** item.
</ParamField>

### Tabela de ações

| `action`  | Permissão   | Timeout | Uso                       |
| --------- | ----------- | ------- | ------------------------- |
| `add`     | Admin       | 60s     | Adicionar números / JIDs  |
| `remove`  | Admin       | 60s     | Remover membros           |
| `promote` | Super-admin | 60s     | Tornar admin              |
| `demote`  | Super-admin | 60s     | Remover admin             |
| `approve` | Admin       | 90s     | Aprovar request pendente  |
| `reject`  | Admin       | 90s     | Rejeitar request pendente |

## Notas

<Note>
  * `promote` / `demote` exigem que você seja **super-admin** (criador do grupo ou promovido por um super-admin).
  * `approve` / `reject` só funcionam para grupos com `requireAdminApproval=true` e tem timeout maior (90s) por dependerem de respostas do WhatsApp.
  * Em `approve`/`reject`, prefira passar o **LID** retornado por [`/requests`](/pt/api/groups/requests), caso só tenha o telefone, o serviço tenta resolver o LID equivalente automaticamente.
</Note>

## Erros

| HTTP | Mensagem                                                                        |
| ---- | ------------------------------------------------------------------------------- |
| 400  | `Invalid action. Must be one of: add, remove, promote, demote, approve, reject` |
| 400  | `At least one participant is required`                                          |
| 400  | `Identifier is required`                                                        |
| 403  | `Not authorized to perform this action (must be admin)`                         |
| 404  | `Group not found or you are not a member of this group`                         |

Envelope:

```json theme={null}
{
  "success": false,
  "error": { "message": "Invalid action. Must be one of: add, remove, promote, demote, approve, reject" }
}
```
