List Subscriptions
curl --request GET \
--url https://api.base39.com.br/v2/billing/subscriptions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.base39.com.br/v2/billing/subscriptions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.base39.com.br/v2/billing/subscriptions', 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.base39.com.br/v2/billing/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://api.base39.com.br/v2/billing/subscriptions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.base39.com.br/v2/billing/subscriptions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.base39.com.br/v2/billing/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"results": [
{
"object": "subscription",
"id": "sub_xxx",
"status": "active",
"hasActiveSubscription": true,
"currentPeriodStart": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": false,
"trialEnd": "2023-11-07T05:31:56Z",
"currentBillTotal": 9900,
"currentPlanTotal": 7900,
"currentExcessTotal": 2000,
"creditGrants": [
{
"id": "credgr_xxx",
"name": "Recarga de saldo",
"amount": 10000,
"category": "promotional",
"effectiveAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}
],
"trialDaysRemaining": 7,
"defaultPaymentMethod": "Cartão •••• 4242",
"products": [
{
"productGroup": "queries",
"slug": "entities",
"name": "Agente IA",
"description": {},
"meters": [
{
"slug": "entity_retrieved",
"eventName": "entity.retrieved",
"name": "Execuções",
"current": 42,
"granted": 100,
"limit": 500,
"amountMtd": 0,
"unit": "execuções",
"capacitySources": [
{
"sourceId": "subscription_item:si_123",
"sourceType": "subscription_item",
"orgId": "org_123",
"customerId": "cus_123",
"productSlug": "entities_tier_2",
"meterEventName": "entity.retrieved",
"billingMode": "prepaid",
"priority": 10,
"eligible": true,
"usage": {
"amountMtd": 1490,
"quantityMtd": 1
},
"limits": {
"spendLimit": 100000,
"includedRemainingQuantity": 50,
"creditRemainingAmount": 50000,
"remainingSpendLimit": 25000
},
"availability": {
"available": true,
"blocker": "product_not_available"
},
"subscriptionId": "sub_123",
"subscriptionItemId": "si_123",
"priceId": "price_123"
}
],
"included": 85,
"unitPrice": 499,
"tiers": [
{
"upTo": 123,
"flatAmount": 123,
"unitAmount": 123
}
],
"datasets": [
"<string>"
],
"includedDatasets": [
{
"slug": "<string>",
"name": "<string>"
}
],
"breakdown": [
{
"datasetName": "<string>",
"quantity": 123,
"amount": 123
}
],
"selectedCapacitySource": {
"sourceId": "subscription_item:si_123",
"sourceType": "subscription_item",
"orgId": "org_123",
"customerId": "cus_123",
"productSlug": "entities_tier_2",
"meterEventName": "entity.retrieved",
"billingMode": "prepaid",
"priority": 10,
"eligible": true,
"usage": {
"amountMtd": 1490,
"quantityMtd": 1
},
"limits": {
"spendLimit": 100000,
"includedRemainingQuantity": 50,
"creditRemainingAmount": 50000,
"remainingSpendLimit": 25000
},
"availability": {
"available": true,
"blocker": "product_not_available"
},
"subscriptionId": "sub_123",
"subscriptionItemId": "si_123",
"priceId": "price_123"
}
}
],
"amountMtd": 0,
"grantedShared": 0,
"currency": "brl",
"spendLimit": 50000
}
],
"addons": [
{
"slug": "premium_support",
"name": "Segurança avançada",
"description": {},
"active": false,
"price": 350000,
"setupPrice": 500000,
"marketingFeatures": [
"<string>"
]
}
],
"billingInterval": "month",
"pastDueInvoices": [
{
"id": "in_xxx",
"dueDate": "2023-11-07T05:31:56Z",
"amount": 99.9
}
],
"hasPastDueInvoices": false,
"isCurrent": true,
"orgId": "<string>",
"name": "Plano por consumo",
"type": "metered",
"editable": true,
"customerName": "Base39 Holding S.A.",
"metadata": {
"plan": "pay_as_you_go",
"billing_mode": "prepaid"
},
"customerId": "cus_xxx",
"priceId": "price_xxx",
"credits": {
"name": "Créditos",
"used": 4250,
"included": 10000,
"granted": 5000,
"remaining": 5750,
"exceeded": 250,
"currency": "brl",
"currentPeriodStart": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z"
},
"productQuotas": [
{
"productSlug": "entities_tier_2",
"included": 100
}
]
}
],
"has_more": true,
"currentSubscriptionId": "<string>",
"hasActiveSubscription": true,
"creditBalance": 10000,
"currentBillTotal": 9900,
"currentPlanTotal": 7900,
"currentExcessTotal": 2000,
"billingPeriod": {
"currentPeriodStart": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"interval": "month"
},
"usageSummary": {},
"next_cursor": "<string>",
"type": "subscription"
}Billing
List Subscriptions
GET
/
v2
/
billing
/
subscriptions
List Subscriptions
curl --request GET \
--url https://api.base39.com.br/v2/billing/subscriptions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.base39.com.br/v2/billing/subscriptions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.base39.com.br/v2/billing/subscriptions', 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.base39.com.br/v2/billing/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://api.base39.com.br/v2/billing/subscriptions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.base39.com.br/v2/billing/subscriptions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.base39.com.br/v2/billing/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"results": [
{
"object": "subscription",
"id": "sub_xxx",
"status": "active",
"hasActiveSubscription": true,
"currentPeriodStart": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": false,
"trialEnd": "2023-11-07T05:31:56Z",
"currentBillTotal": 9900,
"currentPlanTotal": 7900,
"currentExcessTotal": 2000,
"creditGrants": [
{
"id": "credgr_xxx",
"name": "Recarga de saldo",
"amount": 10000,
"category": "promotional",
"effectiveAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}
],
"trialDaysRemaining": 7,
"defaultPaymentMethod": "Cartão •••• 4242",
"products": [
{
"productGroup": "queries",
"slug": "entities",
"name": "Agente IA",
"description": {},
"meters": [
{
"slug": "entity_retrieved",
"eventName": "entity.retrieved",
"name": "Execuções",
"current": 42,
"granted": 100,
"limit": 500,
"amountMtd": 0,
"unit": "execuções",
"capacitySources": [
{
"sourceId": "subscription_item:si_123",
"sourceType": "subscription_item",
"orgId": "org_123",
"customerId": "cus_123",
"productSlug": "entities_tier_2",
"meterEventName": "entity.retrieved",
"billingMode": "prepaid",
"priority": 10,
"eligible": true,
"usage": {
"amountMtd": 1490,
"quantityMtd": 1
},
"limits": {
"spendLimit": 100000,
"includedRemainingQuantity": 50,
"creditRemainingAmount": 50000,
"remainingSpendLimit": 25000
},
"availability": {
"available": true,
"blocker": "product_not_available"
},
"subscriptionId": "sub_123",
"subscriptionItemId": "si_123",
"priceId": "price_123"
}
],
"included": 85,
"unitPrice": 499,
"tiers": [
{
"upTo": 123,
"flatAmount": 123,
"unitAmount": 123
}
],
"datasets": [
"<string>"
],
"includedDatasets": [
{
"slug": "<string>",
"name": "<string>"
}
],
"breakdown": [
{
"datasetName": "<string>",
"quantity": 123,
"amount": 123
}
],
"selectedCapacitySource": {
"sourceId": "subscription_item:si_123",
"sourceType": "subscription_item",
"orgId": "org_123",
"customerId": "cus_123",
"productSlug": "entities_tier_2",
"meterEventName": "entity.retrieved",
"billingMode": "prepaid",
"priority": 10,
"eligible": true,
"usage": {
"amountMtd": 1490,
"quantityMtd": 1
},
"limits": {
"spendLimit": 100000,
"includedRemainingQuantity": 50,
"creditRemainingAmount": 50000,
"remainingSpendLimit": 25000
},
"availability": {
"available": true,
"blocker": "product_not_available"
},
"subscriptionId": "sub_123",
"subscriptionItemId": "si_123",
"priceId": "price_123"
}
}
],
"amountMtd": 0,
"grantedShared": 0,
"currency": "brl",
"spendLimit": 50000
}
],
"addons": [
{
"slug": "premium_support",
"name": "Segurança avançada",
"description": {},
"active": false,
"price": 350000,
"setupPrice": 500000,
"marketingFeatures": [
"<string>"
]
}
],
"billingInterval": "month",
"pastDueInvoices": [
{
"id": "in_xxx",
"dueDate": "2023-11-07T05:31:56Z",
"amount": 99.9
}
],
"hasPastDueInvoices": false,
"isCurrent": true,
"orgId": "<string>",
"name": "Plano por consumo",
"type": "metered",
"editable": true,
"customerName": "Base39 Holding S.A.",
"metadata": {
"plan": "pay_as_you_go",
"billing_mode": "prepaid"
},
"customerId": "cus_xxx",
"priceId": "price_xxx",
"credits": {
"name": "Créditos",
"used": 4250,
"included": 10000,
"granted": 5000,
"remaining": 5750,
"exceeded": 250,
"currency": "brl",
"currentPeriodStart": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z"
},
"productQuotas": [
{
"productSlug": "entities_tier_2",
"included": 100
}
]
}
],
"has_more": true,
"currentSubscriptionId": "<string>",
"hasActiveSubscription": true,
"creditBalance": 10000,
"currentBillTotal": 9900,
"currentPlanTotal": 7900,
"currentExcessTotal": 2000,
"billingPeriod": {
"currentPeriodStart": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"interval": "month"
},
"usageSummary": {},
"next_cursor": "<string>",
"type": "subscription"
}Authorizations
OAuth2 Authorization Code flow
Query Parameters
Include dataset cost breakdown for billing summary tables.
Response
200 - application/json
Object type identifier
Assinaturas visíveis para a organização
Show child attributes
Show child attributes
Whether more results exist beyond this page
ID da assinatura corrente
Se existe assinatura ativa corrente
Example:
true
Saldo disponível de créditos em centavos
Example:
10000
Total atual agregado da fatura em centavos
Example:
9900
Parcela atual agregada de plano em centavos
Example:
7900
Parcela atual agregada excedente em centavos
Example:
2000
Período de cobrança corrente
Show child attributes
Show child attributes
Resumo de uso agregado por meter
Show child attributes
Show child attributes
Opaque cursor for next page. null if no more results.
Tipo dos itens retornados
Example:
"subscription"
⌘I