Cancel a subscription
curl --request DELETE \
--url https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}', 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://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}"
req, _ := http.NewRequest("DELETE", 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.delete("https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"type": "conflict_error",
"code": "cancellation_would_underprovision",
"message": "Cannot delete subscription. Deleting it would leave the account under-provisioned for 'locations'. Current usage: 5, remaining capacity after deletion: 0.",
"doc_url": "https://docs.altostrat.io/errors/cancellation_would_underprovision"
}{
"type": "api_error",
"code": "internal_server_error",
"message": "An internal server error occurred. Please try again later.",
"doc_url": "https://docs.altostrat.io/errors/internal_server_error"
}Subscriptions
Cancel a subscription
Cancels a subscription at the end of the current billing period. This operation cannot be performed if it would leave the workspace or billing account with insufficient capacity for its current resource usage.
DELETE
/
workspaces
/
{workspaceId}
/
billing-accounts
/
{billingAccountId}
/
subscriptions
/
{subscriptionId}
Cancel a subscription
curl --request DELETE \
--url https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}', 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://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}"
req, _ := http.NewRequest("DELETE", 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.delete("https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://v1.api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"type": "conflict_error",
"code": "cancellation_would_underprovision",
"message": "Cannot delete subscription. Deleting it would leave the account under-provisioned for 'locations'. Current usage: 5, remaining capacity after deletion: 0.",
"doc_url": "https://docs.altostrat.io/errors/cancellation_would_underprovision"
}{
"type": "api_error",
"code": "internal_server_error",
"message": "An internal server error occurred. Please try again later.",
"doc_url": "https://docs.altostrat.io/errors/internal_server_error"
}Authorizations
Enter your JWT in the format: Bearer {token}
Path Parameters
The ID of the workspace.
Example:
"ws_a1b2c3d4e5f6g7h8"
The ID of the billing account, which corresponds to a Stripe Customer ID (cus_...).
Example:
"cus_a1b2c3d4e5f6g7h8"
The ID of the Stripe subscription (sub_...).
Example:
"sub_a1b2c3d4e5f6g7h8"
Response
The subscription was successfully scheduled for cancellation.
Was this page helpful?
⌘I