> For the complete documentation index, see [llms.txt](https://knowledgebase.offer18.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.offer18.com/pt/afiliado/apis-de-afiliado/api-de-otp.md).

# API de OTP

A API OTP pode ser usada para gerar e validar PINs em campanhas VAS, garantindo autenticação de usuário segura e eficiente.

### **Parâmetros Comuns**

<table data-header-hidden><thead><tr><th width="150">Caminho</th><th width="150"> </th><th> </th></tr></thead><tbody><tr><td><strong>Query</strong></td><td><strong>Tipo</strong></td><td><strong>Descrição</strong></td></tr><tr><td>key</td><td>String</td><td>Chave da API</td></tr><tr><td>aid</td><td>Inteiro</td><td>Id do Afiliado</td></tr><tr><td>mid</td><td>Inteiro</td><td>Seu MID de Anunciante</td></tr></tbody></table>

## Gerar OTP

```
POST https://api.offer18.com/api/af/otp_gen
```

### Parâmetros da Requisição

<table data-header-hidden><thead><tr><th width="212.5555419921875"></th><th width="191"></th><th></th></tr></thead><tbody><tr><td><strong>Corpo</strong></td><td><strong>Tipo</strong></td><td><strong>Descrição</strong>  </td></tr><tr><td>type</td><td>string</td><td>Tipo de requisição</td></tr><tr><td>userId</td><td>string</td><td>ID do usuário (sob o Parceiro)</td></tr><tr><td>msisdn</td><td>string</td><td>Número móvel (numérico)</td></tr><tr><td>partner</td><td>string</td><td>Nome do parceiro</td></tr></tbody></table>

<pre data-overflow="wrap"><code><strong>https://api.offer18.com/api/af/otp_gen?key=000000000&#x26;aid=0000&#x26;mid=0000&#x26;msisdn=xxxxxxxx&#x26;partner=partnername&#x26;userId=xxxx
</strong></code></pre>

{% code title="Sucesso" overflow="wrap" %}

```json
{
  "status": "200",
  "response": "otp_sent",
  "data": "6xxxxx00f3fa55axxxxxxxxxx567a" // data[requestId] key and value return when patner api return in response 
} 
```

{% endcode %}

{% code title="Falha" overflow="wrap" %}

```json
{     
  "status": "400",     
  "error": "invalid_user_credentials" 
}
```

{% endcode %}

***

## Verificar OTP

```
POST https://api.offer18.com/api/af/otp_verify
```

### Parâmetros da Requisição

<table data-header-hidden><thead><tr><th width="212.5555419921875"></th><th width="191"></th><th></th></tr></thead><tbody><tr><td><strong>Corpo</strong></td><td><strong>Tipo</strong></td><td><strong>Descrição</strong>  </td></tr><tr><td>userId</td><td>string</td><td>ID do usuário</td></tr><tr><td>msisdn</td><td>string</td><td>Número móvel</td></tr><tr><td>otp</td><td>string</td><td>OTP recebido pelo usuário</td></tr><tr><td>partner</td><td>string</td><td>Nome do parceiro</td></tr><tr><td>request_id</td><td>string</td><td>ID da requisição para rastreamento</td></tr></tbody></table>

{% code overflow="wrap" %}

```
https://api.offer18.com/api/af/otp_verify?key=000000000&aid=0000&mid=0000&msisdn=xxxxxxxx&partner=partnername&userId=xxxx&request_id=xxxxx&otp=xxxxx
```

{% endcode %}

### Resposta de API de exemplo

{% code title="Sucesso" overflow="wrap" %}

```json
{     
  "status": "200",     
  "response": "otp_verified" 
} 
```

{% endcode %}

{% code title="Falha" overflow="wrap" %}

```json
{     
  "status": "400",     
  "error": "invalid_user_credentials" 
}
```

{% endcode %}

***

{% hint style="info" %}
**Para interações seguras, sempre chame a API a partir do lado do servidor.**
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://knowledgebase.offer18.com/pt/afiliado/apis-de-afiliado/api-de-otp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
