curl --request GET \
--url https://api.beta.suby.fi/v3/subscriptions/{id} \
--header 'X-Suby-Api-Key: <api-key>'import requests
url = "https://api.beta.suby.fi/v3/subscriptions/{id}"
headers = {"X-Suby-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Suby-Api-Key': '<api-key>'}};
fetch('https://api.beta.suby.fi/v3/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.beta.suby.fi/v3/subscriptions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Suby-Api-Key: <api-key>"
],
]);
$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.beta.suby.fi/v3/subscriptions/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Suby-Api-Key", "<api-key>")
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.beta.suby.fi/v3/subscriptions/{id}")
.header("X-Suby-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/subscriptions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Suby-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"subscription": {
"id": "sub_abc123",
"organizationId": "<string>",
"customerId": "<string>",
"productId": "<string>",
"status": "INCOMPLETE",
"currentCycle": 123,
"totalCycles": 123,
"trialEndAt": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": true,
"currentCycleDueAt": "2023-11-07T05:31:56Z",
"renewalAttempt": 123,
"nextRenewalAttemptAt": "2023-11-07T05:31:56Z",
"lastDeclineCategory": "SOFT",
"priceCents": "1999",
"currency": "EUR",
"taxInclusive": true,
"purchaseAsBusiness": true,
"externalRef": "<string>",
"endedAt": "2023-11-07T05:31:56Z",
"endReason": "CANCELED_BY_CUSTOMER",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"product": {
"id": "pro_abc123",
"name": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"status": "ACTIVE",
"priceCents": "<string>",
"currency": "<string>",
"recurringInterval": "DAY",
"recurringIntervalCount": 123,
"recurringCycleCount": 123,
"trialDurationCount": 123,
"trialDurationUnit": "DAY"
},
"customer": {
"id": "cus_abc123",
"email": "jsmith@example.com"
}
},
"scheduledChange": {
"id": "ssc_abc123",
"type": "UPGRADE",
"targetPriceId": "pro_9m2k1x8s7d6f",
"targetProduct": {
"id": "pro_abc123",
"name": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"status": "ACTIVE",
"priceCents": "<string>",
"currency": "<string>",
"recurringInterval": "DAY",
"recurringIntervalCount": 123,
"recurringCycleCount": 123,
"trialDurationCount": 123,
"trialDurationUnit": "DAY"
},
"scheduledFor": "2023-11-07T05:31:56Z",
"appliedAt": "2023-11-07T05:31:56Z",
"canceledAt": "2023-11-07T05:31:56Z"
},
"nextCharge": {
"amountCents": "2400",
"vatAmountCents": "<string>",
"currency": "EUR",
"dueAt": "2023-11-07T05:31:56Z",
"cycle": 123
},
"lifetime": {
"grossCents": "24000",
"refundedCents": "0",
"netCents": "24000",
"currency": "<string>",
"chargeCount": 123
},
"renewalAttempts": [
{
"id": "sra_abc123",
"cycle": 123,
"attemptNumber": 123,
"scheduledFor": "2023-11-07T05:31:56Z",
"attemptedAt": "2023-11-07T05:31:56Z",
"status": "PENDING",
"declineCategory": "SOFT",
"declineCode": "<string>",
"failureReason": "<string>",
"paymentId": "<string>"
}
],
"accesses": [
{
"id": "agr_abc123",
"definitionName": "<string>",
"definitionKind": "DISCORD_ROLE",
"status": "GRANTED",
"expiresAt": "2023-11-07T05:31:56Z",
"claimedAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z",
"revokeReason": "<string>",
"lastError": "<string>"
}
]
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found"
}Retrieve a subscription
curl --request GET \
--url https://api.beta.suby.fi/v3/subscriptions/{id} \
--header 'X-Suby-Api-Key: <api-key>'import requests
url = "https://api.beta.suby.fi/v3/subscriptions/{id}"
headers = {"X-Suby-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Suby-Api-Key': '<api-key>'}};
fetch('https://api.beta.suby.fi/v3/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.beta.suby.fi/v3/subscriptions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Suby-Api-Key: <api-key>"
],
]);
$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.beta.suby.fi/v3/subscriptions/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Suby-Api-Key", "<api-key>")
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.beta.suby.fi/v3/subscriptions/{id}")
.header("X-Suby-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/subscriptions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Suby-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"subscription": {
"id": "sub_abc123",
"organizationId": "<string>",
"customerId": "<string>",
"productId": "<string>",
"status": "INCOMPLETE",
"currentCycle": 123,
"totalCycles": 123,
"trialEndAt": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": true,
"currentCycleDueAt": "2023-11-07T05:31:56Z",
"renewalAttempt": 123,
"nextRenewalAttemptAt": "2023-11-07T05:31:56Z",
"lastDeclineCategory": "SOFT",
"priceCents": "1999",
"currency": "EUR",
"taxInclusive": true,
"purchaseAsBusiness": true,
"externalRef": "<string>",
"endedAt": "2023-11-07T05:31:56Z",
"endReason": "CANCELED_BY_CUSTOMER",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"product": {
"id": "pro_abc123",
"name": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"status": "ACTIVE",
"priceCents": "<string>",
"currency": "<string>",
"recurringInterval": "DAY",
"recurringIntervalCount": 123,
"recurringCycleCount": 123,
"trialDurationCount": 123,
"trialDurationUnit": "DAY"
},
"customer": {
"id": "cus_abc123",
"email": "jsmith@example.com"
}
},
"scheduledChange": {
"id": "ssc_abc123",
"type": "UPGRADE",
"targetPriceId": "pro_9m2k1x8s7d6f",
"targetProduct": {
"id": "pro_abc123",
"name": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"status": "ACTIVE",
"priceCents": "<string>",
"currency": "<string>",
"recurringInterval": "DAY",
"recurringIntervalCount": 123,
"recurringCycleCount": 123,
"trialDurationCount": 123,
"trialDurationUnit": "DAY"
},
"scheduledFor": "2023-11-07T05:31:56Z",
"appliedAt": "2023-11-07T05:31:56Z",
"canceledAt": "2023-11-07T05:31:56Z"
},
"nextCharge": {
"amountCents": "2400",
"vatAmountCents": "<string>",
"currency": "EUR",
"dueAt": "2023-11-07T05:31:56Z",
"cycle": 123
},
"lifetime": {
"grossCents": "24000",
"refundedCents": "0",
"netCents": "24000",
"currency": "<string>",
"chargeCount": 123
},
"renewalAttempts": [
{
"id": "sra_abc123",
"cycle": 123,
"attemptNumber": 123,
"scheduledFor": "2023-11-07T05:31:56Z",
"attemptedAt": "2023-11-07T05:31:56Z",
"status": "PENDING",
"declineCategory": "SOFT",
"declineCode": "<string>",
"failureReason": "<string>",
"paymentId": "<string>"
}
],
"accesses": [
{
"id": "agr_abc123",
"definitionName": "<string>",
"definitionKind": "DISCORD_ROLE",
"status": "GRANTED",
"expiresAt": "2023-11-07T05:31:56Z",
"claimedAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z",
"revokeReason": "<string>",
"lastError": "<string>"
}
]
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found"
}Authorizations
Secret API key. sk_live_… (production) or sk_sandbox_… (sandbox).
Path Parameters
"sub_abc123"
Query Parameters
Comma-separated relations to join onto the subscription. Each is absent unless asked for, so a caller reconciling renewals by id pays for none of them. Every value names the field it fills.
product· the plan behind the subscription — name, description, image, its CURRENT price and cadence, its trial and agreed cycle count, and itsstatus(anARCHIVEDplan keeps billing the people already on it).customer· the buyer's id and email.nextCharge· what the next renewal will take and when, sized the way the renewal itself sizes it (the agreed price through this subscription's own VAT context).nullwhen nothing further is scheduled.lifetime· settled-charge totals over the whole subscription, aggregated server-side rather than folded from a page of charges.renewalAttempts· every renewal attempt, newest cycle first, with the issuer's own decline code and the payment behind it.accesses· the entitlements this subscription granted and whether the customer ever claimed them.
product and customer are the only two the LIST accepts. The other four
are per-subscription computations, and running them for every row of a page is
four more round trips per subscription — so the list refuses them with 422
rather than accepting the word and returning nothing, which would read as "this
subscription has none" on every row. Retrieve one subscription to get them.
An unrecognised value is refused with 422 rather than ignored.
"product,customer,nextCharge"
Was this page helpful?

