Billing
Get Subscription
Returns the account’s plan and the state of its subscription: the plan, the subscription’s status and billing period, a scheduled change or cancellation if one is pending, payment health (a default payment method on file, an open invoice and when it is retried) and the actions the console offers for it. Accounts that share billing share the subscription and open-invoice information. The plan here is the one the usage and summary routes price usage under.
GET
/
api
/
billing
/
subscription
Get the subscription's plan and state
curl --request GET \
--url https://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription \
--header 'Authorization: Bearer <token>'import requests
url = "https://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription', 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://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription",
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://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription"
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://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription")
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{
"success": true,
"data": {
"billingOwner": {
"accountId": "<string>",
"type": "personal"
},
"billingMode": "not_setup",
"plan": "free",
"subscriptionStatus": "none",
"hasPendingUpdate": true,
"paymentHealth": {
"status": "not_applicable",
"hasDefaultPaymentMethod": true,
"openInvoiceId": "<string>",
"amountRemaining": 123,
"openInvoiceCurrency": "<string>",
"openInvoiceDueDate": 123,
"openInvoiceNextPaymentAttempt": 123,
"pendingOperationId": "<string>"
},
"actions": {
"canStartCheckout": true,
"canManagePaymentMethods": true,
"canUpdateBillingProfile": true,
"canViewInvoices": true,
"canChangePlan": true,
"canCancel": true,
"canKeepSubscription": true,
"canPayOpenInvoice": true,
"canWithdrawScheduledChange": true
},
"billingPeriod": {
"start": 123,
"end": 123
},
"scheduledCancellationAt": 123,
"scheduledChange": {
"type": "schedule_transition",
"effectiveAt": 123,
"targetPlan": "developer"
}
}
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}Was this page helpful?
Get the subscription's plan and state
curl --request GET \
--url https://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription \
--header 'Authorization: Bearer <token>'import requests
url = "https://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription', 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://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription",
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://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription"
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://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://control.green.us-east-1.aws.prod.archil.com/api/billing/subscription")
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{
"success": true,
"data": {
"billingOwner": {
"accountId": "<string>",
"type": "personal"
},
"billingMode": "not_setup",
"plan": "free",
"subscriptionStatus": "none",
"hasPendingUpdate": true,
"paymentHealth": {
"status": "not_applicable",
"hasDefaultPaymentMethod": true,
"openInvoiceId": "<string>",
"amountRemaining": 123,
"openInvoiceCurrency": "<string>",
"openInvoiceDueDate": 123,
"openInvoiceNextPaymentAttempt": 123,
"pendingOperationId": "<string>"
},
"actions": {
"canStartCheckout": true,
"canManagePaymentMethods": true,
"canUpdateBillingProfile": true,
"canViewInvoices": true,
"canChangePlan": true,
"canCancel": true,
"canKeepSubscription": true,
"canPayOpenInvoice": true,
"canWithdrawScheduledChange": true
},
"billingPeriod": {
"start": 123,
"end": 123
},
"scheduledCancellationAt": 123,
"scheduledChange": {
"type": "schedule_transition",
"effectiveAt": 123,
"targetPlan": "developer"
}
}
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}