Listar e filtrar clientes
curl --request GET \
--url https://api-sandbox.fortalpay.tech/v1/customers \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api-sandbox.fortalpay.tech/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api-sandbox.fortalpay.tech/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-sandbox.fortalpay.tech/v1/customers"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.fortalpay.tech/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api-sandbox.fortalpay.tech/v1/customers")
.header("Authorization", "<api-key>")
.asString();package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.fortalpay.tech/v1/customers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api-sandbox.fortalpay.tech/v1/customers");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
{
"data": {
"page": 123,
"size": 123,
"numberOfElements": 123,
"totalElements": 123,
"totalPages": 123,
"content": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "ACTIVE",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"email": "<string>",
"document": "***.***.***-25",
"phone": "<string>"
}
]
},
"success": true,
"error": null
}{
"data": null,
"success": false,
"error": {
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"message": "<string>",
"path": "<string>",
"fields": [
{
"field": "<string>",
"message": "<string>"
}
]
}
}{
"data": null,
"success": false,
"error": {
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"message": "<string>",
"path": "<string>",
"fields": [
{
"field": "<string>",
"message": "<string>"
}
]
}
}Listar clientes
Recupere a lista de clientes cadastrados na sua conta para consulta e gerenciamento.
GET
/
customers
Listar e filtrar clientes
curl --request GET \
--url https://api-sandbox.fortalpay.tech/v1/customers \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api-sandbox.fortalpay.tech/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api-sandbox.fortalpay.tech/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-sandbox.fortalpay.tech/v1/customers"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.fortalpay.tech/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api-sandbox.fortalpay.tech/v1/customers")
.header("Authorization", "<api-key>")
.asString();package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.fortalpay.tech/v1/customers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api-sandbox.fortalpay.tech/v1/customers");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
{
"data": {
"page": 123,
"size": 123,
"numberOfElements": 123,
"totalElements": 123,
"totalPages": 123,
"content": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "ACTIVE",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"email": "<string>",
"document": "***.***.***-25",
"phone": "<string>"
}
]
},
"success": true,
"error": null
}{
"data": null,
"success": false,
"error": {
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"message": "<string>",
"path": "<string>",
"fields": [
{
"field": "<string>",
"message": "<string>"
}
]
}
}{
"data": null,
"success": false,
"error": {
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"message": "<string>",
"path": "<string>",
"fields": [
{
"field": "<string>",
"message": "<string>"
}
]
}
}Exemplos de filtro
Busca geral
Usesearch para procurar simultaneamente por nome, e-mail, documento ou telefone:
curl --request GET 'https://api-sandbox.fortalpay.tech/v1/customers?search=Maria&page=0&size=20' \
--header 'Authorization: ApiKey <api_key>'
Maria Silva e também registros cujo e-mail, documento ou telefone contenha o valor pesquisado.
Filtros combinados
É possível combinar filtros específicos. Todos os parâmetros informados precisam corresponder ao cliente:curl --request GET 'https://api-sandbox.fortalpay.tech/v1/customers?name=Maria&email=example.com&document=529.982&status=ACTIVE&page=0&size=20' \
--header 'Authorization: ApiKey <api_key>'
Exemplo em JavaScript
const params = new URLSearchParams({
name: 'Maria',
document: '529.982',
status: 'ACTIVE',
page: '0',
size: '20'
});
const response = await fetch(`https://api-sandbox.fortalpay.tech/v1/customers?${params}`, {
headers: {
Authorization: `ApiKey ${process.env.FORTALPAY_API_KEY}`
}
});
const result = await response.json();
Authorizations
Todas as requisições devem incluir sua API key no cabeçalho Authorization
usando o formato ApiKey <sua_api_key>. Não use o esquema Bearer.
Sem esse cabeçalho, a requisição será rejeitada.
Use fpay_sk_test_... no ambiente de teste e fpay_sk_live_... em produção.
Saiba como criar e usar uma API key.