---
# System prepended metadata

title: Consultar cartão pelo número e valida a senha

---

## Consultar cartão pelo número e valida a senha

1. [Autenticar em Cartões na API de Autenticar em Cartões](#autentica)
2. [Reautenticar (refresh de sessão) em Cartões na API de Reautenticar em Cartões](#reautentica)
3. [Realizar o bloqueio do login do cooperado pelo CPF](#block-cpf)


### <a id="autentica"></a>Endpoint que autentica em cartões
**POST**:
https://api.test.cartoesunicred.com.br/auth/agw

**Headers:**

Content-Type
Exemplo: application/x-www-form-urlencoded
Form URL Encoded:

grant_type=password
client_id=unicred
username=user
password=******

**Retornos:**

200 (Ok)
401 (Unauthorized)
500 (Internal Server Error)
Exemplos de retorno:

Retorna 200 quando autentica com sucesso

**Body de retorno:**
```JSON
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI2cG9MdlIzckE2aVRBMThhbE1GeGk4b0xFN0F0SWVVZG5xcFpLdlVqYlE0In0.eyJleHAiOjE2MTM2NTk1NzksImlhdCI6MTYxMzY1OTI3OSwianRpIjoiMzI0ZGNlOGUtNjliNS00NWFlLWE3ZDAtMDIzMTAzNmUzODk3IiwiaXNzIjoiaHR0cDovL2F1dGgudGVzdC5jYXJ0b2VzdW5pY3JlZC5jb20uYnIvYXV0aC9yZWFsbXMvYXBpLWdhdGV3YXkiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiYWE1OWMyOWItNDdiZi00ODMwLTgyNWMtNGIzODU1ODg4ZmYwIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoidW5pY3JlZCIsInNlc3Npb25fc3RhdGUiOiJhODJkMjc5Mi05NzEzLTRjYzUtYTk2My0wY2MwMTkwZWFlMzUiLCJhY3IiOiIxIiwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIm9mZmxpbmVfYWNjZXNzIiwiZ2V0X3Jld2FyZHNfYmFsYW5jZSIsImdldF9jdXN0b21lcl9kb2N1bWVudCIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdX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ZSI6ImE4MmQyNzkyLTk3MTMtNGNjNS1hOTYzLTBjYzAxOTBlYWUzNSI",
  "token_type": "bearer",
  "not-before-policy": 0,
  "session_state": "a82d2792-9713-4cc5-a963-0cc0190eae35",
  "scope": "email profile"
}
```
**Exemplo curl:**
```JSON
curl --location 'https://api.test.cartoesunicred.com.br/auth/agw' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'client_id=unicred' \
--data-urlencode 'username=aec_user' \
--data-urlencode 'password=xyxyxyxyxyx'
```

## <a id="reautentica"></a>Endpoint que reautentica em cartoes

**POST:**
https://api.test.cartoesunicred.com.br/auth/agw

**Headers:**

Content-Type
Exemplo: application/x-www-form-urlencoded
Form URL Encoded:

grant_type=refresh_token
client_id=unicred
refresh_token=eyJhbGciOiJIUzI1NiIsInR5cCI…

**Retornos:**

200 (Ok)
401 (Unauthorized)
500 (Internal Server Error)
Exemplos de retorno:

Retorna 200 quando autentica com sucesso

**Body de retorno:**

```JSON
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI2cG9MdlIzckE2aVRBMThhbE1GeGk4b0xFN0F0SWVVZG5xcFpLdlVqYlE0In0.eyJleHAiOjE2MTM2NTk1NzksImlhdCI6MTYxMzY1OTI3OSwianRpIjoiMzI0ZGNlOGUtNjliNS00NWFlLWE3ZDAtMDIzMTAzNmUzODk3IiwiaXNzIjoiaHR0cDovL2F1dGgudGVzdC5jYXJ0b2VzdW5pY3JlZC5jb20uYnIvYXV0aC9yZWFsbXMvYXBpLWdhdGV3YXkiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiYWE1OWMyOWItNDdiZi00ODMwLTgyNWMtNGIzODU1ODg4ZmYwIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoidW5pY3JlZCIsInNlc3Npb25fc3RhdGUiOiJhODJkMjc5Mi05NzEzLTRjYzUtYTk2My0wY2MwMTkwZWFlMzUiLCJhY3I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vbS5ici9hdXRoL3JlYWxtcy9hcGktZ2F0ZXdheSIsInN1YiI6ImFhNTljMjliLTQ3YmYtNDgzMC04MjVjLTRiMzg1NTg4OGZmMCIsInR5cCI6IlJlZnJlc2giLCJhenAiOiJ1bmljcmVkIiwic2Vzc2lvbl9zdGF0ZSI6ImE4MmQyNzkyLTk3MTMtNGNjNS1hOTYzLTBjYzAxOTBlYWUzNSI",
  "token_type": "bearer",
  "not-before-policy": 0,
  "session_state": "a82d2792-9713-4cc5-a963-0cc0190eae35",
  "scope": "email profile"
}
```

**Exemplo curl:**
```JSON
curl --location 'https://api.test.cartoesunicred.com.br/auth/agw' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'client_id=unicred' \
--data-urlencode 'refresh_token=ey...'
```


### <a id="block-cpf">Realizar o bloqueio do login do cooperado pelo CPF</a>

</br>

**POST**: 
api.cartoesunicred.com.br/v1/cards/mobile-user-block-fraud-prevention/{cpf}

**Headers:**
* Authorization 
  * **Exemplo:** eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI2cG9MdlIzckE2aVRBMThhbE1GeGk4b0xFN0F0SWVVZG5xcFpLdlVqYlE0In0.eyJleHAiOjE2MTM2NTk1NzksImlhdCI6MTYxMzY1OTI3OSwianRpIjoiM **(required)**
* Traffic-Code 
  * **Exemplo:** 136 **(required)**
* X-Api-Key
  * **Exemplo:** tvlNwSLXMx2henaVrcY8G7FzcBMGnoLJay9mbOFs **(required)**

**Path Param:**
* CPF (CPF do cooperado)
  **Exemplo:** 12345678900

**Retornos:**

- 200 (OK)
- 400 (Bad Request)
- 401 (Unauthorized)
- 404 (Not Found)
- 500 (Internal Server Error)
- 502 (Bad Gateway)
