Get subscription plan
curl --request GET \
--url https://api.corebasehq.com/api/v1/plan \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.corebasehq.com/api/v1/plan"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.corebasehq.com/api/v1/plan', 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.corebasehq.com/api/v1/plan",
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.corebasehq.com/api/v1/plan"
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.corebasehq.com/api/v1/plan")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.corebasehq.com/api/v1/plan")
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{
"plan": "<string>",
"status": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>"
}Endpoints
Get subscription plan
Returns the subscription plan and status of the organization the token belongs to.
GET
/
api
/
v1
/
plan
Get subscription plan
curl --request GET \
--url https://api.corebasehq.com/api/v1/plan \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.corebasehq.com/api/v1/plan"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.corebasehq.com/api/v1/plan', 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.corebasehq.com/api/v1/plan",
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.corebasehq.com/api/v1/plan"
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.corebasehq.com/api/v1/plan")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.corebasehq.com/api/v1/plan")
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{
"plan": "<string>",
"status": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>"
}Returns the current subscription tier and status for the organization the calling
cb_live_ token belongs to. Useful for gating features in your UI.
The plan field returns the plan key: free, pro (the Growth plan), team, or enterprise.
Examples
Gate a paid-only feature
const res = await fetch("https://api.corebasehq.com/api/v1/plan", {
headers: { Authorization: `Bearer ${process.env.CB_LIVE}` },
});
const { plan } = await res.json();
if (plan === "free") {
ui.showUpgradePrompt();
}
Block requests if subscription lapsed
import httpx
def is_active(token: str) -> bool:
r = httpx.get(
"https://api.corebasehq.com/api/v1/plan",
headers={"Authorization": f"Bearer {token}"},
)
r.raise_for_status()
return r.json()["status"] in {"active", "trialing"}
Caching
Plan changes propagate on subscription create/update/delete events. Safe to cache for ~60 seconds.Authorizations
A cb_live_ API token, created in the panel under API Tokens.