Allocation policy
Propose new policy
Draft: specification in progress. Endpoints and fields may change.
Proposes a new version of the policy. The percentages must add up to 100 and
only supported assets are accepted. The new version applies to future deposits
and serves as the reference for rebalancing proposals. Scope: admin.
PUT
/
politica-de-alocacao
Propose new policy
curl --request PUT \
--url https://api.t3sa.com/v1/politica-de-alocacao \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alocacao": [
{
"percentual": 60
}
],
"comentario": "<string>"
}
'import requests
url = "https://api.t3sa.com/v1/politica-de-alocacao"
payload = {
"alocacao": [{ "percentual": 60 }],
"comentario": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({alocacao: [{percentual: 60}], comentario: '<string>'})
};
fetch('https://api.t3sa.com/v1/politica-de-alocacao', 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.t3sa.com/v1/politica-de-alocacao",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'alocacao' => [
[
'percentual' => 60
]
],
'comentario' => '<string>'
]),
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.t3sa.com/v1/politica-de-alocacao"
payload := strings.NewReader("{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"comentario\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.t3sa.com/v1/politica-de-alocacao")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"comentario\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.t3sa.com/v1/politica-de-alocacao")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"comentario\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"versao": 3,
"alocacao": [
{
"ativo": "USDY",
"percentual": 60
}
],
"status": "vigente",
"aprovada_por": "<string>",
"vigente_desde": "2023-11-07T05:31:56Z"
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}Draft: specification in progress. Endpoints and fields may change.
Authorizations
bearerAuthbearerAuth & tesaTimestamp & tesaSignature
The organization's API key (tesa_live_... in production, tesa_test_... in the sandbox).
Body
application/json
⌘I
Propose new policy
curl --request PUT \
--url https://api.t3sa.com/v1/politica-de-alocacao \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alocacao": [
{
"percentual": 60
}
],
"comentario": "<string>"
}
'import requests
url = "https://api.t3sa.com/v1/politica-de-alocacao"
payload = {
"alocacao": [{ "percentual": 60 }],
"comentario": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({alocacao: [{percentual: 60}], comentario: '<string>'})
};
fetch('https://api.t3sa.com/v1/politica-de-alocacao', 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.t3sa.com/v1/politica-de-alocacao",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'alocacao' => [
[
'percentual' => 60
]
],
'comentario' => '<string>'
]),
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.t3sa.com/v1/politica-de-alocacao"
payload := strings.NewReader("{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"comentario\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.t3sa.com/v1/politica-de-alocacao")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"comentario\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.t3sa.com/v1/politica-de-alocacao")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"comentario\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"versao": 3,
"alocacao": [
{
"ativo": "USDY",
"percentual": 60
}
],
"status": "vigente",
"aprovada_por": "<string>",
"vigente_desde": "2023-11-07T05:31:56Z"
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}