curl -X POST "https://api.pix.basspago.com.br/oauth/token" \
--cert ./client.crt \
--key ./client.key \
--pass "SUA_SENHA_DO_CERTIFICADO" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "SEU_CLIENT_ID",
"client_secret": "SEU_CLIENT_SECRET"
}'
<?php
$ch = curl_init('https://api.pix.basspago.com.br/oauth/token');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_SSLCERT => './client.crt',
CURLOPT_SSLKEY => './client.key',
CURLOPT_KEYPASSWD => 'SUA_SENHA_DO_CERTIFICADO',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'grant_type' => 'client_credentials',
'client_id' => 'SEU_CLIENT_ID',
'client_secret' => 'SEU_CLIENT_SECRET',
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import fs from "node:fs";
import https from "node:https";
import axios from "axios";
const agent = new https.Agent({
cert: fs.readFileSync("./client.crt"),
key: fs.readFileSync("./client.key"),
passphrase: "SUA_SENHA_DO_CERTIFICADO",
});
const { data } = await axios.post(
"https://api.pix.basspago.com.br/oauth/token",
{
grant_type: "client_credentials",
client_id: "SEU_CLIENT_ID",
client_secret: "SEU_CLIENT_SECRET",
},
{ httpsAgent: agent }
);
console.log(data);
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 300
}
Transações
Autenticar conta
Gere um Bearer Token para autenticar as requisições à API
POST
/
oauth
/
token
curl -X POST "https://api.pix.basspago.com.br/oauth/token" \
--cert ./client.crt \
--key ./client.key \
--pass "SUA_SENHA_DO_CERTIFICADO" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "SEU_CLIENT_ID",
"client_secret": "SEU_CLIENT_SECRET"
}'
<?php
$ch = curl_init('https://api.pix.basspago.com.br/oauth/token');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_SSLCERT => './client.crt',
CURLOPT_SSLKEY => './client.key',
CURLOPT_KEYPASSWD => 'SUA_SENHA_DO_CERTIFICADO',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'grant_type' => 'client_credentials',
'client_id' => 'SEU_CLIENT_ID',
'client_secret' => 'SEU_CLIENT_SECRET',
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import fs from "node:fs";
import https from "node:https";
import axios from "axios";
const agent = new https.Agent({
cert: fs.readFileSync("./client.crt"),
key: fs.readFileSync("./client.key"),
passphrase: "SUA_SENHA_DO_CERTIFICADO",
});
const { data } = await axios.post(
"https://api.pix.basspago.com.br/oauth/token",
{
grant_type: "client_credentials",
client_id: "SEU_CLIENT_ID",
client_secret: "SEU_CLIENT_SECRET",
},
{ httpsAgent: agent }
);
console.log(data);
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 300
}
Gere o Bearer Token de Cash In a partir das suas credenciais e do certificado de Cash In. O token é usado no header
Authorization das requisições de recebimento (API de QR Codes).
O token de Cash In expira em 300 segundos. Renove-o antes desse prazo, contado a partir da última renovação.
Os Bearer Tokens de Cash In e Cash Out são separados. O token gerado aqui vale apenas para as requisições de Cash In. Para transferências (Cash Out), gere um token próprio com o certificado e as credenciais de Cash Out.
Certificados
Esta rota usa autenticação mútua (mTLS). Envie o certificado de Cash In, a chave e a senha na requisição:file
required
Certificado de Cash In do cliente (
client.crt).file
required
Chave privada do cliente (
client.key).string
required
Senha para descriptografar a chave
.key, enviada por e-mail junto com os certificados.Headers
string
required
Formato do corpo da requisição. Use
application/json.Body
string
required
Tipo de concessão OAuth. Use
client_credentials.string
required
Client ID gerado no painel FINANCE, em Configurações → API QRCODES.
string
required
Client Secret gerado junto com o Client ID. Trate como segredo.
Resposta
string
Bearer Token usado no header
Authorization das próximas requisições.string
Tipo do token. Sempre
Bearer.integer
Tempo de expiração do token, em segundos.
300 para Cash In.curl -X POST "https://api.pix.basspago.com.br/oauth/token" \
--cert ./client.crt \
--key ./client.key \
--pass "SUA_SENHA_DO_CERTIFICADO" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "SEU_CLIENT_ID",
"client_secret": "SEU_CLIENT_SECRET"
}'
<?php
$ch = curl_init('https://api.pix.basspago.com.br/oauth/token');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_SSLCERT => './client.crt',
CURLOPT_SSLKEY => './client.key',
CURLOPT_KEYPASSWD => 'SUA_SENHA_DO_CERTIFICADO',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'grant_type' => 'client_credentials',
'client_id' => 'SEU_CLIENT_ID',
'client_secret' => 'SEU_CLIENT_SECRET',
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import fs from "node:fs";
import https from "node:https";
import axios from "axios";
const agent = new https.Agent({
cert: fs.readFileSync("./client.crt"),
key: fs.readFileSync("./client.key"),
passphrase: "SUA_SENHA_DO_CERTIFICADO",
});
const { data } = await axios.post(
"https://api.pix.basspago.com.br/oauth/token",
{
grant_type: "client_credentials",
client_id: "SEU_CLIENT_ID",
client_secret: "SEU_CLIENT_SECRET",
},
{ httpsAgent: agent }
);
console.log(data);
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 300
}