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

# Entrar em Grupo

> Entra em um grupo via código ou link de convite

**Auth:** `TokenAccount` ou `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotente:** parcial (chamadas repetidas em grupo aberto retornam o mesmo `groupJid`)

## Descrição

Entra em um grupo a partir de um **código** (`ABC123XYZ`) ou **link** completo (`https://chat.whatsapp.com/ABC123XYZ`). Se o grupo tiver `requireAdminApproval=true`, a entrada fica pendente e retorna `requiresApproval: true`.

<Warning>
  Diferente das outras rotas, `/join` **não aceita JID** como identifier, apenas código ou link.
</Warning>

## Exemplos

### Por link

Entra no grupo passando o link completo (`https://chat.whatsapp.com/ABC123XYZ`) em `identifier`. O serviço extrai o código automaticamente e tenta o ingresso.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/group/join/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "identifier": "https://chat.whatsapp.com/ABC123XYZ"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/group/join/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      identifier: "https://chat.whatsapp.com/ABC123XYZ"
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/group/join/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "identifier": "https://chat.whatsapp.com/ABC123XYZ"
      }
  )
  ```

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

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

  func main() {
      body := strings.NewReader(`{
          "identifier": "https://chat.whatsapp.com/ABC123XYZ"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/group/join/"+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>

### Por código

Entra no grupo passando apenas o código bruto (`ABC123XYZ`) em `identifier`, útil quando você já extraiu o código do link em outro fluxo.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/group/join/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "identifier": "ABC123XYZ"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/group/join/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      identifier: "ABC123XYZ"
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/group/join/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "identifier": "ABC123XYZ"
      }
  )
  ```

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

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

  func main() {
      body := strings.NewReader(`{
          "identifier": "ABC123XYZ"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/group/join/"+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

O `groupJid` identifica o grupo que a instância passou a integrar (ou tentou integrar). Quando `requiresApproval: true`, a entrada **ainda não** foi efetivada, está aguardando aprovação manual de um admin, confira a fila pendente em [`/requests`](/pt/api/groups/requests). Quando `false`, a instância já é membro e pode enviar/receber mensagens.

```json 200 OK theme={null}
{
  "success": true,
  "message": "Successfully joined the group",
  "groupJid": "120363406289005073@g.us",
  "requiresApproval": false
}
```

```json 200 OK (com aprovação manual) theme={null}
{
  "success": true,
  "message": "Join request sent successfully. Waiting for admin approval.",
  "groupJid": "120363406289005073@g.us",
  "requiresApproval": true
}
```

## 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="identifier" type="string" required>
  Código de convite (`ABC123XYZ`) ou link completo (`https://chat.whatsapp.com/ABC123XYZ`).
</ParamField>

## Notas

<Note>
  * `requiresApproval: true` significa que você **ainda não** entrou, sua entrada está na fila listada por [`/requests`](/pt/api/groups/requests) até que um admin aprove.
  * Quando o link foi revogado por um admin (via [`/resetLink`](/pt/api/groups/reset-link)), o código antigo deixa de funcionar imediatamente.
  * Para pré-visualizar o grupo sem entrar, use [`GET /info`](/pt/api/groups/info) com o link como `identifier`.
</Note>

## Erros

| HTTP | Mensagem                                  |
| ---- | ----------------------------------------- |
| 400  | `Invalid invite link or code`             |
| 400  | `Invite link has been revoked or expired` |
| 403  | `Not allowed to join this group`          |
| 404  | `Group not found`                         |

Envelope:

```json theme={null}
{
  "success": false,
  "error": { "message": "Invite link has been revoked or expired" }
}
```
