> ## Documentation Index
> Fetch the complete documentation index at: https://developers.bonifiq.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Objetivos e Missões

> Endpoints para listar objetivos e completar missões de fidelidade

Os endpoints de objetivos permitem listar as missões disponíveis para o cliente e registrar a conclusão de ações como indicações e interações com redes sociais.

## Status de Autenticação dos Endpoints

| Endpoint                                                    | Status      |
| ----------------------------------------------------------- | ----------- |
| `GET /pub/widget/objectives`                                | Público     |
| `GET /pub/widget/objectives/{id}/redeem`                    | Autenticado |
| `POST /pub/widget/objectives/referral/refer`                | Público     |
| `POST /pub/widget/objectives/referral/friend`               | Público     |
| `POST /pub/widget/objectives/referral/coupon`               | Público     |
| `GET /pub/widget/objectives/referral/sent`                  | Público     |
| `POST /pub/widget/objectives/createpointsfollowsocialmedia` | Público     |
| `GET /pub/widget/objectives/review/urls`                    | Autenticado |

***

## Listar Objetivos

Retorna todos os objetivos (missões) disponíveis para o cliente.

### Requisição

`GET /pub/widget/objectives`

**Headers**

<ParamField header="X-Bq-Tenant" type="string" required>
  Identificador público da loja.
</ParamField>

### Exemplo

```bash theme={null}
curl -X GET "https://api.bonifiq.com.br/pub/widget/objectives" \
  -H "X-Bq-Tenant: {tenant_key}"
```

### Resposta

```json theme={null}
{
  "HasError": false,
  "Message": null,
  "Item": [
    {
      "Type": "Purchase",
      "Title": "Faça uma compra",
      "Description": "Ganhe pontos a cada compra realizada",
      "Points": 100,
      "Completed": false,
      "Icon": "shopping-cart"
    },
    {
      "Type": "Referral",
      "Title": "Indique um amigo",
      "Description": "Ganhe pontos quando seu amigo fizer a primeira compra",
      "Points": 500,
      "Completed": false,
      "Icon": "users"
    },
    {
      "Type": "Birthday",
      "Title": "Cadastre seu aniversário",
      "Description": "Ganhe pontos bônus no seu aniversário",
      "Points": 200,
      "Completed": true,
      "Icon": "cake"
    }
  ]
}
```

***

## Resgatar Objetivo

Resgata/completa um objetivo específico.

### Requisição

`GET /pub/widget/objectives/{id}/redeem`

**Headers**

<ParamField header="X-Bq-Tenant" type="string" required>
  Identificador público da loja.
</ParamField>

<ParamField header="X-Bq-SecureToken" type="string" required>
  Token do usuário obtido no login seguro.
</ParamField>

**Path Parameters**

<ParamField path="id" type="string" required>
  Tipo do objetivo (ObjectiveType).
</ParamField>

### Exemplo

```bash theme={null}
curl -X GET "https://api.bonifiq.com.br/pub/widget/objectives/Birthday/redeem" \
  -H "X-Bq-Tenant: {tenant_key}" \
  -H "X-Bq-SecureToken: {secure_token}"
```

### Resposta

```json theme={null}
{
  "HasError": false,
  "Message": null,
  "Item": {
    "Success": true,
    "ResultMessage": "Objetivo completado com sucesso!",
    "Points": 200
  }
}
```

***

## Indicar Amigo (Referral)

Registra uma indicação de amigo para o programa de fidelidade.

### Requisição

`POST /pub/widget/objectives/referral/refer`

**Headers**

<ParamField header="X-Bq-Tenant" type="string" required>
  Identificador público da loja.
</ParamField>

**Body**

<ParamField body="name" type="string" required>
  Nome do amigo indicado.
</ParamField>

<ParamField body="email" type="string" required>
  E-mail do amigo indicado.
</ParamField>

<ParamField body="phone" type="string">
  Telefone do amigo indicado (opcional).
</ParamField>

### Exemplo

```bash theme={null}
curl -X POST "https://api.bonifiq.com.br/pub/widget/objectives/referral/refer" \
  -H "X-Bq-Tenant: {tenant_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "João Silva",
    "email": "joao@email.com",
    "phone": "11999999999"
  }'
```

### Resposta

```json theme={null}
{
  "HasError": false,
  "Message": null,
  "Item": {
    "Success": true,
    "Message": "Indicação enviada com sucesso!"
  }
}
```

***

## Gerar Link de Indicação

Gera um link único para compartilhamento que permite rastrear indicações.

### Requisição

`POST /pub/widget/objectives/referral/friend`

**Headers**

<ParamField header="X-Bq-Tenant" type="string" required>
  Identificador público da loja.
</ParamField>

**Body**

<ParamField body="channel" type="string">
  Canal de compartilhamento (ex: "whatsapp", "email", "facebook").
</ParamField>

### Exemplo

```bash theme={null}
curl -X POST "https://api.bonifiq.com.br/pub/widget/objectives/referral/friend" \
  -H "X-Bq-Tenant: {tenant_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "whatsapp"
  }'
```

### Resposta

```json theme={null}
{
  "HasError": false,
  "Message": null,
  "Item": {
    "Link": "https://loja.com.br/?ref=ABC123",
    "Code": "ABC123"
  }
}
```

***

## Gerar Cupom de Indicação

Gera um cupom de desconto para o amigo indicado.

### Requisição

`POST /pub/widget/objectives/referral/coupon`

**Headers**

<ParamField header="X-Bq-Tenant" type="string" required>
  Identificador público da loja.
</ParamField>

### Exemplo

```bash theme={null}
curl -X POST "https://api.bonifiq.com.br/pub/widget/objectives/referral/coupon" \
  -H "X-Bq-Tenant: {tenant_key}" \
  -H "Content-Type: application/json"
```

### Resposta

```json theme={null}
{
  "HasError": false,
  "Message": null,
  "Item": {
    "CouponCode": "AMIGO10",
    "Discount": "10%",
    "ExpirationDate": "2025-03-01"
  }
}
```

***

## Listar Indicações Enviadas

Retorna a lista de indicações enviadas pelo cliente.

### Requisição

`GET /pub/widget/objectives/referral/sent`

**Headers**

<ParamField header="X-Bq-Tenant" type="string" required>
  Identificador público da loja.
</ParamField>

### Exemplo

```bash theme={null}
curl -X GET "https://api.bonifiq.com.br/pub/widget/objectives/referral/sent" \
  -H "X-Bq-Tenant: {tenant_key}"
```

### Resposta

```json theme={null}
{
  "HasError": false,
  "Message": null,
  "Item": [
    {
      "Name": "João Silva",
      "Email": "joao@email.com",
      "Status": "Pending",
      "Date": "2025-02-01",
      "PointsEarned": 0
    },
    {
      "Name": "Maria Santos",
      "Email": "maria@email.com",
      "Status": "Completed",
      "Date": "2025-01-15",
      "PointsEarned": 500
    }
  ]
}
```

***

## Registrar Interação com Redes Sociais

Registra pontos por seguir a marca em redes sociais.

### Requisição

`POST /pub/widget/objectives/createpointsfollowsocialmedia`

**Headers**

<ParamField header="X-Bq-Tenant" type="string" required>
  Identificador público da loja.
</ParamField>

**Body**

<ParamField body="socialNetwork" type="string" required>
  Rede social (ex: "instagram", "facebook", "twitter", "tiktok").
</ParamField>

### Exemplo

```bash theme={null}
curl -X POST "https://api.bonifiq.com.br/pub/widget/objectives/createpointsfollowsocialmedia" \
  -H "X-Bq-Tenant: {tenant_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "socialNetwork": "instagram"
  }'
```

### Resposta

```json theme={null}
{
  "HasError": false,
  "Message": null,
  "Item": {
    "Success": true,
    "Points": 50,
    "Message": "Você ganhou 50 pontos por seguir no Instagram!"
  }
}
```

***

## Listar URLs de Avaliação

Retorna as URLs para o cliente deixar avaliações da loja.

### Requisição

`GET /pub/widget/objectives/review/urls`

**Headers**

<ParamField header="X-Bq-Tenant" type="string" required>
  Identificador público da loja.
</ParamField>

<ParamField header="X-Bq-SecureToken" type="string" required>
  Token do usuário obtido no login seguro.
</ParamField>

### Exemplo

```bash theme={null}
curl -X GET "https://api.bonifiq.com.br/pub/widget/objectives/review/urls" \
  -H "X-Bq-Tenant: {tenant_key}" \
  -H "X-Bq-SecureToken: {secure_token}"
```

### Resposta

```json theme={null}
{
  "HasError": false,
  "Message": null,
  "Item": [
    {
      "Platform": "Google",
      "Url": "https://g.page/r/...",
      "Icon": "google",
      "Points": 100
    },
    {
      "Platform": "Reclame Aqui",
      "Url": "https://reclameaqui.com.br/...",
      "Icon": "reclame-aqui",
      "Points": 100
    }
  ]
}
```
