curl --request GET \
--url https://api.beta.suby.fi/v3/subscriptions \
--header 'X-Suby-Api-Key: <api-key>'import requests
url = "https://api.beta.suby.fi/v3/subscriptions"
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', 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",
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"
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")
.header("X-Suby-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/subscriptions")
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": {
"items": [
{
"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"
}
}
],
"pagination": {
"nextCursor": "<string>",
"hasMore": true,
"total": 123
}
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "VALIDATION_ERROR",
"message": "Validation failed",
"data": {
"fieldErrors": [
{
"field": "method",
"message": "method is a required field"
}
]
}
}List subscriptions
There is no POST /v3/subscriptions. A subscription opens from a checkout
session in mode: "subscription" on a billingMode: subscription product.
Starting one here meant sending a card token in the request body, which is
not a shape this API accepts.
These routes drive a subscription that already exists.
curl --request GET \
--url https://api.beta.suby.fi/v3/subscriptions \
--header 'X-Suby-Api-Key: <api-key>'import requests
url = "https://api.beta.suby.fi/v3/subscriptions"
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', 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",
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"
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")
.header("X-Suby-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/subscriptions")
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": {
"items": [
{
"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"
}
}
],
"pagination": {
"nextCursor": "<string>",
"hasMore": true,
"total": 123
}
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "VALIDATION_ERROR",
"message": "Validation failed",
"data": {
"fieldErrors": [
{
"field": "method",
"message": "method is a required field"
}
]
}
}Authorizations
Secret API key. sk_live_… (production) or sk_sandbox_… (sandbox).
Query Parameters
Page size (1–100).
1 <= x <= 100Opaque pagination cursor from a previous pagination.nextCursor.
"cus_abc123"
"pro_abc123"
INCOMPLETE, TRIALING, PENDING_3DS, PENDING_REDIRECT, ACTIVE, PAST_DUE, PAUSED, CANCELED, EXPIRED 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?

