Criar uma subconta
curl --request POST \
--url https://api-gateway.pague.dev/v2/sub-accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reference": "loja-centro",
"name": "Loja Centro"
}
'import requests
url = "https://api-gateway.pague.dev/v2/sub-accounts"
payload = {
"reference": "loja-centro",
"name": "Loja Centro"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reference: 'loja-centro', name: 'Loja Centro'})
};
fetch('https://api-gateway.pague.dev/v2/sub-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-gateway.pague.dev/v2/sub-accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reference' => 'loja-centro',
'name' => 'Loja Centro'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-gateway.pague.dev/v2/sub-accounts"
payload := strings.NewReader("{\n \"reference\": \"loja-centro\",\n \"name\": \"Loja Centro\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-gateway.pague.dev/v2/sub-accounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reference\": \"loja-centro\",\n \"name\": \"Loja Centro\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-gateway.pague.dev/v2/sub-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reference\": \"loja-centro\",\n \"name\": \"Loja Centro\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reference": "loja-centro",
"name": "Loja Centro",
"status": "approved",
"createdAt": "2023-11-07T05:31:56Z"
}{
"statusCode": 400,
"error": "BadRequest",
"message": "name must be longer than or equal to 2 characters",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {},
"traceId": "<string>"
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication token is required",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {},
"traceId": "<string>"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "You do not have permission to access this resource",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {},
"traceId": "<string>"
}{
"statusCode": 409,
"error": "Conflict",
"message": "Resource with name 'Example' already exists",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {
"resource": "Example",
"field": "name",
"value": "Example"
},
"traceId": "<string>"
}{
"statusCode": 500,
"error": "InternalError",
"message": "An unexpected error occurred",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {},
"traceId": "2771463d58840c8e116dc6dda1e1e5d0"
}Subcontas
Criar Subconta
Cria uma subconta com saldo próprio, totalmente independente do saldo da conta principal.
Permissão requerida: SUBACCOUNT:WRITE ou FULL_ACCESS
POST
/
sub-accounts
Criar uma subconta
curl --request POST \
--url https://api-gateway.pague.dev/v2/sub-accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reference": "loja-centro",
"name": "Loja Centro"
}
'import requests
url = "https://api-gateway.pague.dev/v2/sub-accounts"
payload = {
"reference": "loja-centro",
"name": "Loja Centro"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reference: 'loja-centro', name: 'Loja Centro'})
};
fetch('https://api-gateway.pague.dev/v2/sub-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-gateway.pague.dev/v2/sub-accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reference' => 'loja-centro',
'name' => 'Loja Centro'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-gateway.pague.dev/v2/sub-accounts"
payload := strings.NewReader("{\n \"reference\": \"loja-centro\",\n \"name\": \"Loja Centro\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-gateway.pague.dev/v2/sub-accounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reference\": \"loja-centro\",\n \"name\": \"Loja Centro\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-gateway.pague.dev/v2/sub-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reference\": \"loja-centro\",\n \"name\": \"Loja Centro\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reference": "loja-centro",
"name": "Loja Centro",
"status": "approved",
"createdAt": "2023-11-07T05:31:56Z"
}{
"statusCode": 400,
"error": "BadRequest",
"message": "name must be longer than or equal to 2 characters",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {},
"traceId": "<string>"
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication token is required",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {},
"traceId": "<string>"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "You do not have permission to access this resource",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {},
"traceId": "<string>"
}{
"statusCode": 409,
"error": "Conflict",
"message": "Resource with name 'Example' already exists",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {
"resource": "Example",
"field": "name",
"value": "Example"
},
"traceId": "<string>"
}{
"statusCode": 500,
"error": "InternalError",
"message": "An unexpected error occurred",
"timestamp": "2025-12-15T22:00:00.000Z",
"details": {},
"traceId": "2771463d58840c8e116dc6dda1e1e5d0"
}O
reference é imutável. Ele é o identificador que você envia no header X-Sub-Account para operar na subconta e o valor que chega no campo subAccount dos webhooks — escolha com cuidado, porque não é possível alterá-lo depois da criação.Formato: ^[a-z0-9][a-z0-9_-]{1,31}$ — de 2 a 32 caracteres, apenas letras minúsculas, números, - e _, começando por letra minúscula ou número. O reference precisa ser único dentro da conta: repetir um já existente retorna 409 SUB_ACCOUNT_REFERENCE_TAKEN.A subconta nasce com saldo próprio, zerado e totalmente independente do saldo da conta principal. Veja Subcontas para o comportamento do header X-Sub-Account e a tabela completa de erros.Autorizações
Access token obtido no POST /auth (client_id + client_secret). Válido por 300 segundos.
Corpo
application/json
Identificador da subconta definido por você. Único dentro da conta e imutável depois da criação. principal é palavra reservada da conta principal e não pode ser usada: devolve 400 SUB_ACCOUNT_INVALID_REFERENCE.
Pattern:
^[a-z0-9][a-z0-9_-]{1,31}$Exemplo:
"loja-centro"
Nome de exibição da subconta
Maximum string length:
255Exemplo:
"Loja Centro"
Resposta
Subconta criada com sucesso

