Criar Subconta
curl --request POST \
--url https://gateway.astronpay.co/sub-accounts \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--header 'api_secret: <api-key>' \
--data '
{
"company_infos": {
"cnpj": "12345678000195",
"company_name": "Empresa Exemplo LTDA",
"trade_name": "Empresa Exemplo",
"company_type": "LTDA",
"constitution_date": "2020-01-01",
"monthly_income": 50000
},
"representative": {
"name": "João Silva",
"email": "joao@empresa.com",
"cpf": "12345678901",
"full_name": "João Silva Santos",
"phone": "+5511987654321",
"mother_name": "Maria Silva",
"monthly_income": "3000",
"birth_date": "1990-01-01",
"was_signed": true,
"signature_date": "2024-01-01"
},
"address": {
"street": "Rua Exemplo",
"number": "123",
"city": "São Paulo",
"zip_code": "01234567",
"neighborhood": "Centro",
"uf": "SP",
"adress_type": 1
},
"ref": "A12as31qw78gb"
}
'import requests
url = "https://gateway.astronpay.co/sub-accounts"
payload = {
"company_infos": {
"cnpj": "12345678000195",
"company_name": "Empresa Exemplo LTDA",
"trade_name": "Empresa Exemplo",
"company_type": "LTDA",
"constitution_date": "2020-01-01",
"monthly_income": 50000
},
"representative": {
"name": "João Silva",
"email": "joao@empresa.com",
"cpf": "12345678901",
"full_name": "João Silva Santos",
"phone": "+5511987654321",
"mother_name": "Maria Silva",
"monthly_income": "3000",
"birth_date": "1990-01-01",
"was_signed": True,
"signature_date": "2024-01-01"
},
"address": {
"street": "Rua Exemplo",
"number": "123",
"city": "São Paulo",
"zip_code": "01234567",
"neighborhood": "Centro",
"uf": "SP",
"adress_type": 1
},
"ref": "A12as31qw78gb"
}
headers = {
"api_key": "<api-key>",
"api_secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
api_key: '<api-key>',
api_secret: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
company_infos: {
cnpj: '12345678000195',
company_name: 'Empresa Exemplo LTDA',
trade_name: 'Empresa Exemplo',
company_type: 'LTDA',
constitution_date: '2020-01-01',
monthly_income: 50000
},
representative: {
name: 'João Silva',
email: 'joao@empresa.com',
cpf: '12345678901',
full_name: 'João Silva Santos',
phone: '+5511987654321',
mother_name: 'Maria Silva',
monthly_income: '3000',
birth_date: '1990-01-01',
was_signed: true,
signature_date: '2024-01-01'
},
address: {
street: 'Rua Exemplo',
number: '123',
city: 'São Paulo',
zip_code: '01234567',
neighborhood: 'Centro',
uf: 'SP',
adress_type: 1
},
ref: 'A12as31qw78gb'
})
};
fetch('https://gateway.astronpay.co/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://gateway.astronpay.co/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([
'company_infos' => [
'cnpj' => '12345678000195',
'company_name' => 'Empresa Exemplo LTDA',
'trade_name' => 'Empresa Exemplo',
'company_type' => 'LTDA',
'constitution_date' => '2020-01-01',
'monthly_income' => 50000
],
'representative' => [
'name' => 'João Silva',
'email' => 'joao@empresa.com',
'cpf' => '12345678901',
'full_name' => 'João Silva Santos',
'phone' => '+5511987654321',
'mother_name' => 'Maria Silva',
'monthly_income' => '3000',
'birth_date' => '1990-01-01',
'was_signed' => true,
'signature_date' => '2024-01-01'
],
'address' => [
'street' => 'Rua Exemplo',
'number' => '123',
'city' => 'São Paulo',
'zip_code' => '01234567',
'neighborhood' => 'Centro',
'uf' => 'SP',
'adress_type' => 1
],
'ref' => 'A12as31qw78gb'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>",
"api_secret: <api-key>"
],
]);
$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://gateway.astronpay.co/sub-accounts"
payload := strings.NewReader("{\n \"company_infos\": {\n \"cnpj\": \"12345678000195\",\n \"company_name\": \"Empresa Exemplo LTDA\",\n \"trade_name\": \"Empresa Exemplo\",\n \"company_type\": \"LTDA\",\n \"constitution_date\": \"2020-01-01\",\n \"monthly_income\": 50000\n },\n \"representative\": {\n \"name\": \"João Silva\",\n \"email\": \"joao@empresa.com\",\n \"cpf\": \"12345678901\",\n \"full_name\": \"João Silva Santos\",\n \"phone\": \"+5511987654321\",\n \"mother_name\": \"Maria Silva\",\n \"monthly_income\": \"3000\",\n \"birth_date\": \"1990-01-01\",\n \"was_signed\": true,\n \"signature_date\": \"2024-01-01\"\n },\n \"address\": {\n \"street\": \"Rua Exemplo\",\n \"number\": \"123\",\n \"city\": \"São Paulo\",\n \"zip_code\": \"01234567\",\n \"neighborhood\": \"Centro\",\n \"uf\": \"SP\",\n \"adress_type\": 1\n },\n \"ref\": \"A12as31qw78gb\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
req.Header.Add("api_secret", "<api-key>")
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://gateway.astronpay.co/sub-accounts")
.header("api_key", "<api-key>")
.header("api_secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"company_infos\": {\n \"cnpj\": \"12345678000195\",\n \"company_name\": \"Empresa Exemplo LTDA\",\n \"trade_name\": \"Empresa Exemplo\",\n \"company_type\": \"LTDA\",\n \"constitution_date\": \"2020-01-01\",\n \"monthly_income\": 50000\n },\n \"representative\": {\n \"name\": \"João Silva\",\n \"email\": \"joao@empresa.com\",\n \"cpf\": \"12345678901\",\n \"full_name\": \"João Silva Santos\",\n \"phone\": \"+5511987654321\",\n \"mother_name\": \"Maria Silva\",\n \"monthly_income\": \"3000\",\n \"birth_date\": \"1990-01-01\",\n \"was_signed\": true,\n \"signature_date\": \"2024-01-01\"\n },\n \"address\": {\n \"street\": \"Rua Exemplo\",\n \"number\": \"123\",\n \"city\": \"São Paulo\",\n \"zip_code\": \"01234567\",\n \"neighborhood\": \"Centro\",\n \"uf\": \"SP\",\n \"adress_type\": 1\n },\n \"ref\": \"A12as31qw78gb\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.astronpay.co/sub-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["api_secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"company_infos\": {\n \"cnpj\": \"12345678000195\",\n \"company_name\": \"Empresa Exemplo LTDA\",\n \"trade_name\": \"Empresa Exemplo\",\n \"company_type\": \"LTDA\",\n \"constitution_date\": \"2020-01-01\",\n \"monthly_income\": 50000\n },\n \"representative\": {\n \"name\": \"João Silva\",\n \"email\": \"joao@empresa.com\",\n \"cpf\": \"12345678901\",\n \"full_name\": \"João Silva Santos\",\n \"phone\": \"+5511987654321\",\n \"mother_name\": \"Maria Silva\",\n \"monthly_income\": \"3000\",\n \"birth_date\": \"1990-01-01\",\n \"was_signed\": true,\n \"signature_date\": \"2024-01-01\"\n },\n \"address\": {\n \"street\": \"Rua Exemplo\",\n \"number\": \"123\",\n \"city\": \"São Paulo\",\n \"zip_code\": \"01234567\",\n \"neighborhood\": \"Centro\",\n \"uf\": \"SP\",\n \"adress_type\": 1\n },\n \"ref\": \"A12as31qw78gb\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"account": {
"name": "Empresa Exemplo LTDA",
"document": "12345678000195",
"status": "PENDING",
"secrets": {
"api_key": "ak_1234567890abcdef",
"api_secret": "as_1234567890abcdef"
}
}
}Sub-accounts API
Criar Subconta
Cria uma nova subconta completa, incluindo usuário e informações da empresa
POST
/
sub-accounts
Criar Subconta
curl --request POST \
--url https://gateway.astronpay.co/sub-accounts \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--header 'api_secret: <api-key>' \
--data '
{
"company_infos": {
"cnpj": "12345678000195",
"company_name": "Empresa Exemplo LTDA",
"trade_name": "Empresa Exemplo",
"company_type": "LTDA",
"constitution_date": "2020-01-01",
"monthly_income": 50000
},
"representative": {
"name": "João Silva",
"email": "joao@empresa.com",
"cpf": "12345678901",
"full_name": "João Silva Santos",
"phone": "+5511987654321",
"mother_name": "Maria Silva",
"monthly_income": "3000",
"birth_date": "1990-01-01",
"was_signed": true,
"signature_date": "2024-01-01"
},
"address": {
"street": "Rua Exemplo",
"number": "123",
"city": "São Paulo",
"zip_code": "01234567",
"neighborhood": "Centro",
"uf": "SP",
"adress_type": 1
},
"ref": "A12as31qw78gb"
}
'import requests
url = "https://gateway.astronpay.co/sub-accounts"
payload = {
"company_infos": {
"cnpj": "12345678000195",
"company_name": "Empresa Exemplo LTDA",
"trade_name": "Empresa Exemplo",
"company_type": "LTDA",
"constitution_date": "2020-01-01",
"monthly_income": 50000
},
"representative": {
"name": "João Silva",
"email": "joao@empresa.com",
"cpf": "12345678901",
"full_name": "João Silva Santos",
"phone": "+5511987654321",
"mother_name": "Maria Silva",
"monthly_income": "3000",
"birth_date": "1990-01-01",
"was_signed": True,
"signature_date": "2024-01-01"
},
"address": {
"street": "Rua Exemplo",
"number": "123",
"city": "São Paulo",
"zip_code": "01234567",
"neighborhood": "Centro",
"uf": "SP",
"adress_type": 1
},
"ref": "A12as31qw78gb"
}
headers = {
"api_key": "<api-key>",
"api_secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
api_key: '<api-key>',
api_secret: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
company_infos: {
cnpj: '12345678000195',
company_name: 'Empresa Exemplo LTDA',
trade_name: 'Empresa Exemplo',
company_type: 'LTDA',
constitution_date: '2020-01-01',
monthly_income: 50000
},
representative: {
name: 'João Silva',
email: 'joao@empresa.com',
cpf: '12345678901',
full_name: 'João Silva Santos',
phone: '+5511987654321',
mother_name: 'Maria Silva',
monthly_income: '3000',
birth_date: '1990-01-01',
was_signed: true,
signature_date: '2024-01-01'
},
address: {
street: 'Rua Exemplo',
number: '123',
city: 'São Paulo',
zip_code: '01234567',
neighborhood: 'Centro',
uf: 'SP',
adress_type: 1
},
ref: 'A12as31qw78gb'
})
};
fetch('https://gateway.astronpay.co/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://gateway.astronpay.co/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([
'company_infos' => [
'cnpj' => '12345678000195',
'company_name' => 'Empresa Exemplo LTDA',
'trade_name' => 'Empresa Exemplo',
'company_type' => 'LTDA',
'constitution_date' => '2020-01-01',
'monthly_income' => 50000
],
'representative' => [
'name' => 'João Silva',
'email' => 'joao@empresa.com',
'cpf' => '12345678901',
'full_name' => 'João Silva Santos',
'phone' => '+5511987654321',
'mother_name' => 'Maria Silva',
'monthly_income' => '3000',
'birth_date' => '1990-01-01',
'was_signed' => true,
'signature_date' => '2024-01-01'
],
'address' => [
'street' => 'Rua Exemplo',
'number' => '123',
'city' => 'São Paulo',
'zip_code' => '01234567',
'neighborhood' => 'Centro',
'uf' => 'SP',
'adress_type' => 1
],
'ref' => 'A12as31qw78gb'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>",
"api_secret: <api-key>"
],
]);
$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://gateway.astronpay.co/sub-accounts"
payload := strings.NewReader("{\n \"company_infos\": {\n \"cnpj\": \"12345678000195\",\n \"company_name\": \"Empresa Exemplo LTDA\",\n \"trade_name\": \"Empresa Exemplo\",\n \"company_type\": \"LTDA\",\n \"constitution_date\": \"2020-01-01\",\n \"monthly_income\": 50000\n },\n \"representative\": {\n \"name\": \"João Silva\",\n \"email\": \"joao@empresa.com\",\n \"cpf\": \"12345678901\",\n \"full_name\": \"João Silva Santos\",\n \"phone\": \"+5511987654321\",\n \"mother_name\": \"Maria Silva\",\n \"monthly_income\": \"3000\",\n \"birth_date\": \"1990-01-01\",\n \"was_signed\": true,\n \"signature_date\": \"2024-01-01\"\n },\n \"address\": {\n \"street\": \"Rua Exemplo\",\n \"number\": \"123\",\n \"city\": \"São Paulo\",\n \"zip_code\": \"01234567\",\n \"neighborhood\": \"Centro\",\n \"uf\": \"SP\",\n \"adress_type\": 1\n },\n \"ref\": \"A12as31qw78gb\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
req.Header.Add("api_secret", "<api-key>")
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://gateway.astronpay.co/sub-accounts")
.header("api_key", "<api-key>")
.header("api_secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"company_infos\": {\n \"cnpj\": \"12345678000195\",\n \"company_name\": \"Empresa Exemplo LTDA\",\n \"trade_name\": \"Empresa Exemplo\",\n \"company_type\": \"LTDA\",\n \"constitution_date\": \"2020-01-01\",\n \"monthly_income\": 50000\n },\n \"representative\": {\n \"name\": \"João Silva\",\n \"email\": \"joao@empresa.com\",\n \"cpf\": \"12345678901\",\n \"full_name\": \"João Silva Santos\",\n \"phone\": \"+5511987654321\",\n \"mother_name\": \"Maria Silva\",\n \"monthly_income\": \"3000\",\n \"birth_date\": \"1990-01-01\",\n \"was_signed\": true,\n \"signature_date\": \"2024-01-01\"\n },\n \"address\": {\n \"street\": \"Rua Exemplo\",\n \"number\": \"123\",\n \"city\": \"São Paulo\",\n \"zip_code\": \"01234567\",\n \"neighborhood\": \"Centro\",\n \"uf\": \"SP\",\n \"adress_type\": 1\n },\n \"ref\": \"A12as31qw78gb\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.astronpay.co/sub-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["api_secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"company_infos\": {\n \"cnpj\": \"12345678000195\",\n \"company_name\": \"Empresa Exemplo LTDA\",\n \"trade_name\": \"Empresa Exemplo\",\n \"company_type\": \"LTDA\",\n \"constitution_date\": \"2020-01-01\",\n \"monthly_income\": 50000\n },\n \"representative\": {\n \"name\": \"João Silva\",\n \"email\": \"joao@empresa.com\",\n \"cpf\": \"12345678901\",\n \"full_name\": \"João Silva Santos\",\n \"phone\": \"+5511987654321\",\n \"mother_name\": \"Maria Silva\",\n \"monthly_income\": \"3000\",\n \"birth_date\": \"1990-01-01\",\n \"was_signed\": true,\n \"signature_date\": \"2024-01-01\"\n },\n \"address\": {\n \"street\": \"Rua Exemplo\",\n \"number\": \"123\",\n \"city\": \"São Paulo\",\n \"zip_code\": \"01234567\",\n \"neighborhood\": \"Centro\",\n \"uf\": \"SP\",\n \"adress_type\": 1\n },\n \"ref\": \"A12as31qw78gb\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"account": {
"name": "Empresa Exemplo LTDA",
"document": "12345678000195",
"status": "PENDING",
"secrets": {
"api_key": "ak_1234567890abcdef",
"api_secret": "as_1234567890abcdef"
}
}
}Criação de Subconta
Cria uma nova subconta completa, incluindo usuário e informações da empresa.Headers
string
required
Chave de API do usuário
string
required
Secret de API do usuário
string
required
application/json
Body
object
required
Informações da empresa
string
required
CNPJ da empresa (formato: 12345678000195)
string
required
Razão social da empresa
string
required
Nome fantasia da empresa
string
required
Tipo da empresa (ex: LTDA, S.A., etc.)
string
required
Data de constituição (formato: YYYY-MM-DD)
number
required
Renda mensal da empresa
object
required
Informações do representante legal
string
required
Nome do representante
string
required
Email do representante
string
required
CPF do representante
string
required
Nome completo do representante
string
required
Telefone do representante
string
required
Nome da mãe do representante
string
required
Renda mensal do representante
string
required
Data de nascimento (formato: YYYY-MM-DD)
boolean
required
Se o representante já assinou os documentos
string
required
Data da assinatura (formato: YYYY-MM-DD)
object
required
Endereço da empresa
string
required
Rua/Logradouro
string
required
Número
string
required
Cidade
string
required
CEP
string
required
Bairro
string
required
UF (Estado)
number
required
Tipo de endereço
string
Referência opcional para identificação
Resposta de Sucesso (201)
{
"status": "success",
"account": {
"name": "Empresa Exemplo LTDA",
"document": "12345678000195",
"status": "PENDING",
"secrets": {
"api_key": "ak_1234567890abcdef",
"api_secret": "as_1234567890abcdef"
}
}
}
Possíveis Erros
400 - Bad Request
400 - Bad Request
Dados inválidos ou campos obrigatórios não preenchidos
401 - Unauthorized
401 - Unauthorized
Api Key não encontrada ou inválida
409 - Conflict
409 - Conflict
Email já cadastrado no sistema
500 - Internal Server Error
500 - Internal Server Error
Erro interno do servidor durante a criação
Body
application/json
⌘I
