Создать субсчёт
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"
}Субсчета
Создать субсчёт
Создаёт субсчёт с собственным балансом, полностью независимым от баланса основного аккаунта.
Требуемое разрешение: SUBACCOUNT:WRITE или FULL_ACCESS
POST
/
sub-accounts
Создать субсчёт
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"
}reference неизменяем. Это идентификатор, который вы отправляете в заголовке X-Sub-Account, чтобы выполнить операцию в субсчёте, и значение, которое приходит в поле subAccount вебхуков, — выбирайте его внимательно, изменить его после создания невозможно.Формат: ^[a-z0-9][a-z0-9_-]{1,31}$ — от 2 до 32 символов, только строчные латинские буквы, цифры, - и _, начиная со строчной буквы или цифры. reference должен быть уникальным в пределах аккаунта: повторное использование существующего возвращает 409 SUB_ACCOUNT_REFERENCE_TAKEN.Субсчёт создаётся с собственным нулевым балансом, полностью независимым от баланса основного аккаунта. См. Субсчета — там описано поведение заголовка X-Sub-Account и приведена полная таблица ошибок.Авторизации
Токен доступа, полученный через POST /auth (client_id + client_secret). Действителен в течение 300 секунд.
Тело
application/json
Идентификатор субсчёта, задаваемый вами. Уникален в пределах аккаунта и неизменяем после создания. principal — зарезервированное слово основного аккаунта, использовать его нельзя: возвращается 400 SUB_ACCOUNT_INVALID_REFERENCE.
Pattern:
^[a-z0-9][a-z0-9_-]{1,31}$Пример:
"loja-centro"
Отображаемое имя субсчёта
Maximum string length:
255Пример:
"Loja Centro"

