Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
billing_reservations = client.cloud.billing_reservations.list()
print(billing_reservations.count)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
billingReservations, err := client.Cloud.BillingReservations.List(context.TODO(), cloud.BillingReservationListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", billingReservations.Count)
}
curl --request GET \
--url https://api.gcore.com/cloud/v2/reservations \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v2/reservations', 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.gcore.com/cloud/v2/reservations",
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: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/cloud/v2/reservations")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v2/reservations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"count": 1,
"results": [
{
"active_billing_plan_id": 207114,
"active_overcommit": {
"active_from": "2025-04-03T00:00:00",
"plan_item_id": 666,
"price_per_month": "236.63366400",
"price_per_unit": "0.31805600",
"price_total": "2839.60396800",
"subscription_id": 12344
},
"commit": {
"active_from": "2025-04-03T00:00:00",
"active_to": "2026-04-03T00:00:00",
"price_per_month": "224.80198100",
"price_per_unit": "0.30215320",
"price_total": "2697.62377200",
"subscription_id": 12345
},
"hardware_info": {
"cpu": "2xIntel Xeon 8468",
"disk": "8 x 3.84 TB NVMe",
"ram": "2TB RAM"
},
"region_name": "LUX-4",
"resource_count": 1,
"resource_name": "bm1-hf-medium",
"unit_name": "H",
"unit_size_month": "744.00000000",
"unit_size_total": "8928.00000000"
}
]
}Reservations
List reservations
Get a list of billing reservations along with detailed information on resource configurations and associated pricing.
GET
/
cloud
/
v2
/
reservations
Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
billing_reservations = client.cloud.billing_reservations.list()
print(billing_reservations.count)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
billingReservations, err := client.Cloud.BillingReservations.List(context.TODO(), cloud.BillingReservationListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", billingReservations.Count)
}
curl --request GET \
--url https://api.gcore.com/cloud/v2/reservations \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v2/reservations', 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.gcore.com/cloud/v2/reservations",
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: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/cloud/v2/reservations")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v2/reservations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"count": 1,
"results": [
{
"active_billing_plan_id": 207114,
"active_overcommit": {
"active_from": "2025-04-03T00:00:00",
"plan_item_id": 666,
"price_per_month": "236.63366400",
"price_per_unit": "0.31805600",
"price_total": "2839.60396800",
"subscription_id": 12344
},
"commit": {
"active_from": "2025-04-03T00:00:00",
"active_to": "2026-04-03T00:00:00",
"price_per_month": "224.80198100",
"price_per_unit": "0.30215320",
"price_total": "2697.62377200",
"subscription_id": 12345
},
"hardware_info": {
"cpu": "2xIntel Xeon 8468",
"disk": "8 x 3.84 TB NVMe",
"ram": "2TB RAM"
},
"region_name": "LUX-4",
"resource_count": 1,
"resource_name": "bm1-hf-medium",
"unit_name": "H",
"unit_size_month": "744.00000000",
"unit_size_total": "8928.00000000"
}
]
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234$abcdef
Query Parameters
Metric name for the resource (e.g., 'bm1-hf-medium_min')
Order by field and direction.
Available options:
active_from.asc, active_from.desc, active_to.asc, active_to.desc Examples:
"active_from.asc"
"active_to.asc"
Region for reservation
Include inactive commits in the response
Was this page helpful?
⌘I