> ## 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.

# Gestionar participantes

> Agrega, elimina, promueve, degrada, aprueba o rechaza participantes en un grupo

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

## Descripción

Endpoint único para 6 acciones sobre participantes, define la operación en el campo `action`. Cada participante recibe un resultado individual (`success: bool`), por lo que **las operaciones parciales son posibles**: la llamada puede devolver `200` con algunos miembros fallando.

## Ejemplos

### Agregar al grupo

Agrega 2 números al grupo `120363406289005073@g.us` en una sola llamada (`action: "add"`). Los fallos por configuraciones de privacidad o números sin WhatsApp se aíslan como `success: false` en el 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 administrador

Promueve al número `5511999999999` a administrador mediante `action: "promote"`. Requiere que seas super-admin del grupo (creador o promovido por otro 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>

### Degradar a miembro

Quita el rol de administrador al número `5511999999999` mediante `action: "demote"`, devolviéndolo a estado de miembro común. También requiere privilegio 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>

### Aprobar unión al grupo (solicitud pendiente)

Aprueba una solicitud de unión pendiente pasando el LID `199789077627112@lid` en `participants` con `action: "approve"`. Solo funciona en grupos con `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>

### Rechazar unión al grupo (solicitud pendiente)

Rechaza una solicitud pendiente del número `5511999999999` mediante `action: "reject"`. El servicio resuelve automáticamente el LID equivalente cuando pasas solo el número de teléfono.

<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>

### Eliminar del grupo

Elimina al número `5511999999999` del grupo mediante `action: "remove"`. El ex-miembro puede volver a unirse mediante el enlace de invitación a menos que generes un nuevo enlace con [`/reset-link`](/es/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>

## Respuesta exitosa

Cada participante recibe un resultado individual con `success: true|false` en el array `participants`. **Las operaciones parciales son posibles**, la llamada puede devolver `200` incluso con algunos miembros fallando (número sin WhatsApp, privacidad bloquea el agregado, ya es miembro, etc.). Inspecciona siempre cada entrada para detectar errores aislados; el campo `error` lleva la razón cuando `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>
  Los fallos individuales (`success: false`) **no** abortan el procesamiento de los participantes restantes. Inspecciona siempre cada entrada para detectar errores parciales (por ejemplo, número sin WhatsApp, ya es miembro, privacidad bloquea el agregado).
</Warning>

## Parámetros de ruta

<ParamField path="instance" type="string" required>
  Nombre de la instancia.
</ParamField>

## Cabeceras

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

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

## Cuerpo de la solicitud

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

<ParamField body="identifier" type="string" required>
  JID, código de invitación o enlace del grupo.
</ParamField>

<ParamField body="participants" type="string[]" required>
  Números o JIDs objetivo de la operación. Al menos **1** elemento.
</ParamField>

### Tabla de acciones

| `action`  | Permiso     | Timeout | Uso                          |
| --------- | ----------- | ------- | ---------------------------- |
| `add`     | Admin       | 60s     | Agregar números / JIDs       |
| `remove`  | Admin       | 60s     | Eliminar miembros            |
| `promote` | Super-admin | 60s     | Hacer admin                  |
| `demote`  | Super-admin | 60s     | Quitar admin                 |
| `approve` | Admin       | 90s     | Aprobar solicitud pendiente  |
| `reject`  | Admin       | 90s     | Rechazar solicitud pendiente |

## Notas

<Note>
  * `promote` / `demote` requieren que seas **super-admin** (creador del grupo o promovido por un super-admin).
  * `approve` / `reject` solo funcionan para grupos con `requireAdminApproval=true` y tienen un timeout más largo (90s) ya que dependen de respuestas de WhatsApp.
  * Para `approve`/`reject`, prefiere pasar el **LID** devuelto por [`/requests`](/es/api/groups/requests); si solo tienes el número de teléfono, el servicio intenta resolver el LID equivalente automáticamente.
</Note>

## Errores

| HTTP | Mensaje                                                                         |
| ---- | ------------------------------------------------------------------------------- |
| 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`                         |

Envoltorio:

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