Create a sub-account
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"
}Sub-accounts
Create Sub-account
Creates a sub-account with its own balance, fully independent from the main account balance.
Required permission: SUBACCOUNT:WRITE or FULL_ACCESS
POST
/
sub-accounts
Create a sub-account
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"
}The
reference is immutable. It is the identifier you send in the X-Sub-Account header to operate on the sub-account, and the value that arrives in the subAccount field of webhooks — choose it carefully, because it cannot be changed after creation.Format: ^[a-z0-9][a-z0-9_-]{1,31}$ — 2 to 32 characters, only lowercase letters, digits, - and _, starting with a lowercase letter or a digit. The reference must be unique within the account: reusing an existing one returns 409 SUB_ACCOUNT_REFERENCE_TAKEN.The sub-account starts with its own balance, at zero and fully independent from the main account balance. See Sub-accounts for the behavior of the X-Sub-Account header and the full error table.Authorizations
Access token obtained from POST /auth (client_id + client_secret). Valid for 300 seconds.
Body
application/json
Sub-account identifier defined by you. Unique within the account and immutable after creation. principal is a reserved word for the main account and cannot be used: it returns 400 SUB_ACCOUNT_INVALID_REFERENCE.
Pattern:
^[a-z0-9][a-z0-9_-]{1,31}$Example:
"loja-centro"
Sub-account display name
Maximum string length:
255Example:
"Loja Centro"
Response
Sub-account created successfully

