Update billing page settings
curl --request PATCH \
--url https://api.custral.com/v1/billing/page \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sections": {
"paymentMethod": true,
"usage": true,
"invoices": true,
"billingContact": true
},
"actions": {
"updateCard": true,
"changePlan": true,
"cancel": true
},
"askCancelReason": true
}
'import requests
url = "https://api.custral.com/v1/billing/page"
payload = {
"sections": {
"paymentMethod": True,
"usage": True,
"invoices": True,
"billingContact": True
},
"actions": {
"updateCard": True,
"changePlan": True,
"cancel": True
},
"askCancelReason": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sections: {paymentMethod: true, usage: true, invoices: true, billingContact: true},
actions: {updateCard: true, changePlan: true, cancel: true},
askCancelReason: true
})
};
fetch('https://api.custral.com/v1/billing/page', 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.custral.com/v1/billing/page",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'sections' => [
'paymentMethod' => true,
'usage' => true,
'invoices' => true,
'billingContact' => true
],
'actions' => [
'updateCard' => true,
'changePlan' => true,
'cancel' => true
],
'askCancelReason' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.custral.com/v1/billing/page"
payload := strings.NewReader("{\n \"sections\": {\n \"paymentMethod\": true,\n \"usage\": true,\n \"invoices\": true,\n \"billingContact\": true\n },\n \"actions\": {\n \"updateCard\": true,\n \"changePlan\": true,\n \"cancel\": true\n },\n \"askCancelReason\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.custral.com/v1/billing/page")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sections\": {\n \"paymentMethod\": true,\n \"usage\": true,\n \"invoices\": true,\n \"billingContact\": true\n },\n \"actions\": {\n \"updateCard\": true,\n \"changePlan\": true,\n \"cancel\": true\n },\n \"askCancelReason\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.custral.com/v1/billing/page")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sections\": {\n \"paymentMethod\": true,\n \"usage\": true,\n \"invoices\": true,\n \"billingContact\": true\n },\n \"actions\": {\n \"updateCard\": true,\n \"changePlan\": true,\n \"cancel\": true\n },\n \"askCancelReason\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"sections": {
"paymentMethod": true,
"usage": true,
"invoices": true,
"billingContact": true
},
"actions": {
"updateCard": true,
"changePlan": true,
"cancel": true
},
"downgradeTiming": "period_end",
"askCancelReason": true
},
"reqId": "req_2a1f9c8e7b6d5"
}Billing
Update billing page settings
Change the page settings you name. The key’s creator must be a workspace admin. Requires scope: billing:admin.
PATCH
/
v1
/
billing
/
page
Update billing page settings
curl --request PATCH \
--url https://api.custral.com/v1/billing/page \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sections": {
"paymentMethod": true,
"usage": true,
"invoices": true,
"billingContact": true
},
"actions": {
"updateCard": true,
"changePlan": true,
"cancel": true
},
"askCancelReason": true
}
'import requests
url = "https://api.custral.com/v1/billing/page"
payload = {
"sections": {
"paymentMethod": True,
"usage": True,
"invoices": True,
"billingContact": True
},
"actions": {
"updateCard": True,
"changePlan": True,
"cancel": True
},
"askCancelReason": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sections: {paymentMethod: true, usage: true, invoices: true, billingContact: true},
actions: {updateCard: true, changePlan: true, cancel: true},
askCancelReason: true
})
};
fetch('https://api.custral.com/v1/billing/page', 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.custral.com/v1/billing/page",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'sections' => [
'paymentMethod' => true,
'usage' => true,
'invoices' => true,
'billingContact' => true
],
'actions' => [
'updateCard' => true,
'changePlan' => true,
'cancel' => true
],
'askCancelReason' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.custral.com/v1/billing/page"
payload := strings.NewReader("{\n \"sections\": {\n \"paymentMethod\": true,\n \"usage\": true,\n \"invoices\": true,\n \"billingContact\": true\n },\n \"actions\": {\n \"updateCard\": true,\n \"changePlan\": true,\n \"cancel\": true\n },\n \"askCancelReason\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.custral.com/v1/billing/page")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sections\": {\n \"paymentMethod\": true,\n \"usage\": true,\n \"invoices\": true,\n \"billingContact\": true\n },\n \"actions\": {\n \"updateCard\": true,\n \"changePlan\": true,\n \"cancel\": true\n },\n \"askCancelReason\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.custral.com/v1/billing/page")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sections\": {\n \"paymentMethod\": true,\n \"usage\": true,\n \"invoices\": true,\n \"billingContact\": true\n },\n \"actions\": {\n \"updateCard\": true,\n \"changePlan\": true,\n \"cancel\": true\n },\n \"askCancelReason\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"sections": {
"paymentMethod": true,
"usage": true,
"invoices": true,
"billingContact": true
},
"actions": {
"updateCard": true,
"changePlan": true,
"cancel": true
},
"downgradeTiming": "period_end",
"askCancelReason": true
},
"reqId": "req_2a1f9c8e7b6d5"
}Authorizations
A Custral API key, created in Settings → Developers → Applications, sent as Authorization: Bearer sk_…. The X-Api-Key header is also accepted and takes precedence. Use a secret key (sk_…) from your server; a publishable key (pk_…) may hold only objects:read and usage:write. Never expose a secret key in a browser.
Body
application/json
Was this page helpful?