curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_codes": [
"<string>"
],
"p_end_month": "2023-12-25",
"p_series": null,
"p_classes": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns"
payload = {
"p_codes": ["<string>"],
"p_end_month": "2023-12-25",
"p_series": None,
"p_classes": None
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
p_codes: ['<string>'],
p_end_month: '2023-12-25',
p_series: null,
p_classes: null
})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns', 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://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns",
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([
'p_codes' => [
'<string>'
],
'p_end_month' => '2023-12-25',
'p_series' => null,
'p_classes' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <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://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns"
payload := strings.NewReader("{\n \"p_codes\": [\n \"<string>\"\n ],\n \"p_end_month\": \"2023-12-25\",\n \"p_series\": null,\n \"p_classes\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<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://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"p_codes\": [\n \"<string>\"\n ],\n \"p_end_month\": \"2023-12-25\",\n \"p_series\": null,\n \"p_classes\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"p_codes\": [\n \"<string>\"\n ],\n \"p_end_month\": \"2023-12-25\",\n \"p_series\": null,\n \"p_classes\": null\n}"
response = http.request(request)
puts response.read_body[
{
"line_no": 123,
"input_code": "<string>",
"code": "<string>",
"numero_serie": 123,
"classe": "<string>",
"month": "2023-12-25",
"data_referencia": "2023-12-25",
"versao": 123,
"quantidade_certificados": 123,
"valor_certificados": 123,
"rendimentos": 123,
"amortizacoes": 123,
"pu": 123,
"paid_per_unit": 123,
"factor": 123,
"month_flag": "<string>",
"taxa_juros": "<string>",
"data_vencimento": "2023-12-25",
"reason": "<string>"
}
]{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}portfolio_credit_returns
The value ON THE CURVE of a CRA or CRI as its securitizer files it (catalog v71, #766): for each CETIP code (trimmed, upper-cased, a leading CRA- or CRI- stripped), the 13 month-ends p_end_month - 12 .. p_end_month from cvm_securit_serie, one row per (line, month), oldest first. The series is the one p_series / p_classes name (from portfolio_instruments) or the code’s only series in the window; two or more with none named is serie_ambigua. A month’s row is its informe (data_referencia = the month, the month-end value) at the highest versao. pu = valor_certificados / quantidade_certificados; paid_per_unit = (rendimentos + amortizacoes) / quantidade, NULL read as 0; factor = (pu + paid) / previous pu, 12 places, NULL on the first month or a flagged one: compound the 12 factors for the 12-month return. month_flag says why a month is unknown: serie_ambigua, mes_ausente, valor_invalido, quantidade_mudou, pu_repetido (the value of the month before carried over), queda_sem_evento_arquivado (the pu falls and nothing paid is filed: an unfiled coupon or amortization, never read as a loss), pagamento_acima_do_pu, pagamento_incompativel (a payment month whose return is outside 0.5 .. 1.5 times the median of the line’s months with no payment, or with fewer than 3 of them). A window with any flag has no return. rentabilidade is never read. It is the securitizer’s value on the curve, not a market price. At most 70 codes (13 rows each); otherwise RAISES 22023; one page, never trimmed.
Row cap. A window producing more than 1000 rows raises SQLSTATE 22023 naming this function. Nothing is trimmed to fit — PostgREST would silently cut the response at 1000 and a cut-short series is indistinguishable from one that simply ends. This function does not page — narrow the window instead.
curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_codes": [
"<string>"
],
"p_end_month": "2023-12-25",
"p_series": null,
"p_classes": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns"
payload = {
"p_codes": ["<string>"],
"p_end_month": "2023-12-25",
"p_series": None,
"p_classes": None
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
p_codes: ['<string>'],
p_end_month: '2023-12-25',
p_series: null,
p_classes: null
})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns', 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://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns",
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([
'p_codes' => [
'<string>'
],
'p_end_month' => '2023-12-25',
'p_series' => null,
'p_classes' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <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://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns"
payload := strings.NewReader("{\n \"p_codes\": [\n \"<string>\"\n ],\n \"p_end_month\": \"2023-12-25\",\n \"p_series\": null,\n \"p_classes\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<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://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"p_codes\": [\n \"<string>\"\n ],\n \"p_end_month\": \"2023-12-25\",\n \"p_series\": null,\n \"p_classes\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"p_codes\": [\n \"<string>\"\n ],\n \"p_end_month\": \"2023-12-25\",\n \"p_series\": null,\n \"p_classes\": null\n}"
response = http.request(request)
puts response.read_body[
{
"line_no": 123,
"input_code": "<string>",
"code": "<string>",
"numero_serie": 123,
"classe": "<string>",
"month": "2023-12-25",
"data_referencia": "2023-12-25",
"versao": 123,
"quantidade_certificados": 123,
"valor_certificados": 123,
"rendimentos": 123,
"amortizacoes": 123,
"pu": 123,
"paid_per_unit": 123,
"factor": 123,
"month_flag": "<string>",
"taxa_juros": "<string>",
"data_vencimento": "2023-12-25",
"reason": "<string>"
}
]{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}Authorizations
The publishable key (sb_publishable_…), on every request. It is NOT a JWT — sending it as Authorization: Bearer is rejected as an invalid JWT. It identifies the project, not you, and maps to the Postgres anon role.
Body
Response
The result set, oldest first. An unknown id is an empty array, not a 404 and never a guessed value.
Was this page helpful?