curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_instruments \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_codes": [
"<string>"
]
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_instruments"
payload = { "p_codes": ["<string>"] }
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>']})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_instruments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"line_no": 123,
"input_code": "<string>",
"code": "<string>",
"match_kind": "<string>",
"instrument_type": "<string>",
"cnpj_securit": "<string>",
"numero_serie": 123,
"classe": "<string>",
"data_vencimento": "2023-12-25",
"situacao": "<string>",
"taxa_juros": "<string>",
"classificacao_risco_atual": "<string>",
"valor_total_integralizado": 123,
"data_referencia": "2023-12-25",
"cd_isin": "<string>",
"issuer_code": "<string>",
"n_fundos": 123,
"preco_marcacao_fundos": 123,
"cda_period": "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_instruments
CRA, CRI and debenture codes from a statement (catalog v62; securit cd_isin v67). Per code (trimmed, upper-cased, a leading CRA-, CRI- or DEB- stripped; the hyphen is required, so CRA0260025T keeps its CRA): match_kind securit_cetip returns every series of cvm_securit_serie whose codigo_cetip is the code, at the code’s newest data_referencia, one row per (numero_serie, classe) at its highest versao, with the series columns as filed and instrument_type as stored (cra_mensal, cri_mensal), and (v67) cd_isin the series’ codigo_isin as filed, not validated, NULL when not filed (issuer_code stays NULL: a CRA or CRI ISIN’s characters 3-6 name the securitizer, not the debtor); a code can match several series. Else match_kind cda_ticker: the newest month the code appears in CDA block 4 (cvm_fi_cda_acoes, any tp_aplic) and that month’s rows with tp_aplic Debêntures: cd_isin (the most common ISIN), issuer_code (ISIN characters 3-6, never a CNPJ), n_fundos (distinct holding funds), preco_marcacao_fundos (sum of market value over sum of quantity, 6 places: the funds’ own marks, not a trade price) and cda_period (the newest CDA month may still be filling, so n_fundos can be low). A code held that month as something other than a debenture is no match, and the reason says what it was held as. Else one row with match_kind NULL and the reason in words (Portuguese). Nothing is inferred from a code’s letters. More than 200 codes RAISES 22023; the result is at most one 1000-row page, refused above it, 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_instruments \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_codes": [
"<string>"
]
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_instruments"
payload = { "p_codes": ["<string>"] }
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>']})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_instruments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"line_no": 123,
"input_code": "<string>",
"code": "<string>",
"match_kind": "<string>",
"instrument_type": "<string>",
"cnpj_securit": "<string>",
"numero_serie": 123,
"classe": "<string>",
"data_vencimento": "2023-12-25",
"situacao": "<string>",
"taxa_juros": "<string>",
"classificacao_risco_atual": "<string>",
"valor_total_integralizado": 123,
"data_referencia": "2023-12-25",
"cd_isin": "<string>",
"issuer_code": "<string>",
"n_fundos": 123,
"preco_marcacao_fundos": 123,
"cda_period": "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
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?