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

# Criar Link de Chamada

> Cria um link de chamada reutilizável (áudio ou vídeo) que qualquer pessoa pode abrir para entrar

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

## Descrição

Cria um **link de chamada** reutilizável, de áudio ou vídeo, que pode ser compartilhado com qualquer pessoa. Quem abrir o link consegue entrar na chamada, sem precisar receber uma ligação primeiro. Use o campo `video` para escolher entre um link de áudio (padrão) ou de vídeo. A resposta traz o `token` do link e a `url` completa, pronta para compartilhar.

## Exemplos

### Link de áudio (padrão)

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

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

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

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

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

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

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

### Link de vídeo

`video: true` gera um link de chamada de vídeo em vez de áudio.

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

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

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

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

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

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

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

```json 200 OK theme={null}
{
  "success": true,
  "token":   "AbCdEfGhIjKlMnOp",
  "url":     "https://call.whatsapp.com/audio/AbCdEfGhIjKlMnOp",
  "video":   false
}
```

<Note>
  Para `video: true`, o segmento da URL muda para `/video/` (ex.: `https://call.whatsapp.com/video/<token>`). O link é reutilizável: pode ser aberto por várias pessoas, em momentos diferentes, até ser revogado.
</Note>

## Parâmetros de rota

<ParamField path="instance" type="string" required>
  Nome da instância (ex.: `$Instance_Name`).
</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="video" type="boolean" default="false">
  Quando `true`, gera um link de chamada de **vídeo** em vez de áudio.
</ParamField>

## Erros

| HTTP | Mensagem                          |
| ---- | --------------------------------- |
| 400  | `Instance name is required`       |
| 400  | `Invalid request body: <detalhe>` |
| 404  | `instance not found`              |
| 500  | `<motivo da falha>`               |

Envelope de erro:

```json theme={null}
{
  "success": false,
  "error": { "message": "instance not found" }
}
```
