Get Subscription
Retrieve details about a specific subscription
GET
/
api
/
v2
/
subscriptions
/
{id}
Get Subscription
curl --request GET \
--url https://api.example.com/api/v2/subscriptions/{id}import requests
url = "https://api.example.com/api/v2/subscriptions/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v2/subscriptions/{id}', 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.example.com/api/v2/subscriptions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/v2/subscriptions/{id}"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/v2/subscriptions/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/subscriptions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyGet Subscription
Retrieve information about a subscription, including its current status and next billing date.Authentication
Authorization: Bearer glm_test_YOUR_API_KEY
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Subscription ID (e.g., sub_abc123xyz) |
Request
GET /api/v2/subscriptions/{id}
Response
{
"id": "sub_abc123xyz",
"customer_id": "cus_xyz789",
"status": "active",
"product_id": 12345,
"amount_cents": 9900,
"currency": "USD",
"interval": "monthly",
"interval_count": 1,
"current_period_start": "2025-10-18T14:30:00Z",
"current_period_end": "2025-11-18T14:30:00Z",
"next_billing_date": "2025-11-18T14:30:00Z",
"cancel_at_period_end": false,
"payment_method": {
"type": "hsa_fsa_card",
"last4": "1111",
"brand": "visa"
},
"created_at": "2025-10-18T14:30:00Z",
"updated_at": "2025-10-18T14:30:00Z"
}
Examples
Basic Retrieval
curl https://api.withgale.com/api/v2/subscriptions/sub_abc123xyz \
-H "Authorization: Bearer glm_test_YOUR_API_KEY"
With JavaScript
const getSubscription = async (subscriptionId) => {
const response = await fetch(
`https://api.withgale.com/api/v2/subscriptions/${subscriptionId}`,
{
headers: {
'Authorization': `Bearer ${process.env.GALE_API_KEY}`
}
}
);
return await response.json();
};
// Check subscription status
const sub = await getSubscription('sub_abc123xyz');
console.log(`Status: ${sub.status}`);
console.log(`Next billing: ${sub.next_billing_date}`);
Related Endpoints
⌘I
Get Subscription
curl --request GET \
--url https://api.example.com/api/v2/subscriptions/{id}import requests
url = "https://api.example.com/api/v2/subscriptions/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v2/subscriptions/{id}', 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.example.com/api/v2/subscriptions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/v2/subscriptions/{id}"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/v2/subscriptions/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/subscriptions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body