# Mobile - Obter OTP recente

`GET /instance/mobile/registration-otp`

Pasta: **Instancia**

## Autenticação

```http
token: {{token}}
```

## Descrição

# Obter OTP wa_old recente

Retorna o último código `wa_old_registration` recebido na sessão mobile primary (notificação `type=registration`), com TTL calculado a partir de `expiry_t`.

Quando o OTP chega, o mesmo payload também é enviado no webhook `connection` com `status=registration_otp`. No reconnect, se ainda válido, entra em `connection` com `status=connected`.

## Endpoint

```http
GET {{baseUrl}}/instance/mobile/registration-otp
```

## Autenticação

```http
token: {{token}}
```

## Exemplo de Requisição

```bash
curl -X GET "{{baseUrl}}/instance/mobile/registration-otp" \
  -H "token: {{token}}"
```

## Resposta de Sucesso (OTP válido)

```json
{
  "success": true,
  "registration_otp": {
    "code": "472876",
    "ttl": 14400,
    "expires_at": 1784333186,
    "ts": 1784318786,
    "notification_id": "3399395297"
  }
}
```

## Resposta (sem OTP / expirado)

```json
{
  "success": true,
  "registration_otp": null
}
```

## Erros comuns

- `400` — instância não é mobile
- `409` — socket mobile não conectado
- `503` — mobile bridge indisponível

## Observações

Exclusivo mobile. O OTP fica em memória na sessão conectada; `ttl` zera após `expires_at`.

## cURL

```bash
curl -X GET "{{baseUrl}}/instance/mobile/registration-otp" \
  -H "token: {{token}}"
```

---

[Índice da pasta](./index.md) · [Índice geral](../index.md) · [UI](https://gozap.dev/docs?op=instancia/mobile-obter-otp-recente)
