Government budget flow
curl --request GET \
--url https://astreus.ai/api/v1/countries/{iso}/budget-flow \
--header 'X-API-KEY: <api-key>'import requests
url = "https://astreus.ai/api/v1/countries/{iso}/budget-flow"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://astreus.ai/api/v1/countries/{iso}/budget-flow', 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://astreus.ai/api/v1/countries/{iso}/budget-flow",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <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"
"net/http"
"io"
)
func main() {
url := "https://astreus.ai/api/v1/countries/{iso}/budget-flow"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://astreus.ai/api/v1/countries/{iso}/budget-flow")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://astreus.ai/api/v1/countries/{iso}/budget-flow")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"unit": "Billions of dollars",
"source": {
"name": "U.S. Treasury, Monthly Treasury Statement",
"table": "Table 9 — receipts by source, outlays by function (September, fiscal year to date)",
"url": "https://fiscaldata.treasury.gov/datasets/monthly-treasury-statement/"
},
"years": [
{
"fiscalYear": 2015,
"label": "FY2015",
"receipts": 3402.86146706,
"outlays": 3841.760325182,
"officialReceipts": 3248.723200916,
"officialOutlays": 3687.6220590380003,
"receiptSources": [
{
"id": "individual",
"label": "Individual income",
"value": 1540.802375213
},
{
"id": "payroll",
"label": "Payroll taxes",
"value": 1065.277352876
}
],
"outlayCategories": [
{
"id": "ss",
"label": "Social Security",
"value": 887.770817464
},
{
"id": "defense",
"label": "National defense",
"value": 591.372205224
}
]
},
{
"fiscalYear": 2016,
"label": "FY2016",
"receipts": 3394.728635185,
"outlays": 3982.140404822,
"officialReceipts": 3266.688370973,
"officialOutlays": 3854.10014061,
"receiptSources": [
{
"id": "individual",
"label": "Individual income",
"value": 1546.074928108
},
{
"id": "payroll",
"label": "Payroll taxes",
"value": 1115.062819157
}
],
"outlayCategories": [
{
"id": "ss",
"label": "Social Security",
"value": 916.0779871330001
},
{
"id": "defense",
"label": "National defense",
"value": 595.303439435
}
]
}
]
}{
"error": "<string>",
"code": "unknown_parameter",
"param": "<string>",
"allowed": [
"<string>"
]
}{
"error": "<string>",
"code": "unknown_parameter",
"param": "<string>",
"allowed": [
"<string>"
]
}{
"error": "<string>",
"code": "unknown_parameter",
"param": "<string>",
"allowed": [
"<string>"
]
}{
"error": "<string>",
"code": "unknown_parameter",
"param": "<string>",
"allowed": [
"<string>"
]
}Macro
Government budget flow
United States only: fiscal-year receipts by source and net outlays by function from Monthly Treasury Statement Table 9 (September, fiscal year to date), in billions of dollars, oldest year first. Any other country is a 404 (not_found): the statement covers the United States only.
GET
/
api
/
v1
/
countries
/
{iso}
/
budget-flow
Government budget flow
curl --request GET \
--url https://astreus.ai/api/v1/countries/{iso}/budget-flow \
--header 'X-API-KEY: <api-key>'import requests
url = "https://astreus.ai/api/v1/countries/{iso}/budget-flow"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://astreus.ai/api/v1/countries/{iso}/budget-flow', 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://astreus.ai/api/v1/countries/{iso}/budget-flow",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <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"
"net/http"
"io"
)
func main() {
url := "https://astreus.ai/api/v1/countries/{iso}/budget-flow"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://astreus.ai/api/v1/countries/{iso}/budget-flow")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://astreus.ai/api/v1/countries/{iso}/budget-flow")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"unit": "Billions of dollars",
"source": {
"name": "U.S. Treasury, Monthly Treasury Statement",
"table": "Table 9 — receipts by source, outlays by function (September, fiscal year to date)",
"url": "https://fiscaldata.treasury.gov/datasets/monthly-treasury-statement/"
},
"years": [
{
"fiscalYear": 2015,
"label": "FY2015",
"receipts": 3402.86146706,
"outlays": 3841.760325182,
"officialReceipts": 3248.723200916,
"officialOutlays": 3687.6220590380003,
"receiptSources": [
{
"id": "individual",
"label": "Individual income",
"value": 1540.802375213
},
{
"id": "payroll",
"label": "Payroll taxes",
"value": 1065.277352876
}
],
"outlayCategories": [
{
"id": "ss",
"label": "Social Security",
"value": 887.770817464
},
{
"id": "defense",
"label": "National defense",
"value": 591.372205224
}
]
},
{
"fiscalYear": 2016,
"label": "FY2016",
"receipts": 3394.728635185,
"outlays": 3982.140404822,
"officialReceipts": 3266.688370973,
"officialOutlays": 3854.10014061,
"receiptSources": [
{
"id": "individual",
"label": "Individual income",
"value": 1546.074928108
},
{
"id": "payroll",
"label": "Payroll taxes",
"value": 1115.062819157
}
],
"outlayCategories": [
{
"id": "ss",
"label": "Social Security",
"value": 916.0779871330001
},
{
"id": "defense",
"label": "National defense",
"value": 595.303439435
}
]
}
]
}{
"error": "<string>",
"code": "unknown_parameter",
"param": "<string>",
"allowed": [
"<string>"
]
}{
"error": "<string>",
"code": "unknown_parameter",
"param": "<string>",
"allowed": [
"<string>"
]
}{
"error": "<string>",
"code": "unknown_parameter",
"param": "<string>",
"allowed": [
"<string>"
]
}{
"error": "<string>",
"code": "unknown_parameter",
"param": "<string>",
"allowed": [
"<string>"
]
}Authorizations
apiKeycognitoIdToken
Astreus API key (pk_live_...), created on the Developers page in the terminal. Also accepted as Authorization: Bearer pk_live_....
Path Parameters
ISO alpha-2 country code.