Get active subscription
curl --request GET \
--url https://commet.co/api/v1/subscriptions/active \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://commet.co/api/v1/subscriptions/active', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://commet.co/api/v1/subscriptions/active"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://commet.co/api/v1/subscriptions/active"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-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://commet.co/api/v1/subscriptions/active")
.header("x-api-key", "<api-key>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://commet.co/api/v1/subscriptions/active",
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-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"data": {
"id": "<string>",
"customerId": "<string>",
"plan": {
"id": "<string>",
"name": "<string>",
"basePrice": 123
},
"name": "<string>",
"description": "<string>",
"status": "draft",
"billingInterval": "weekly",
"trialEndsAt": "2023-11-07T05:31:56Z",
"currentPeriod": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"daysRemaining": 123
},
"cancellation": {
"scheduledAt": "2023-11-07T05:31:56Z",
"reason": "<string>",
"effectiveAt": "2023-11-07T05:31:56Z"
},
"cancelAtPeriodEnd": true,
"scheduledPlanChange": {
"changeType": "plan_downgrade",
"newPlanId": "<string>",
"newPlanName": "<string>",
"newBillingInterval": "<string>",
"scheduledFor": "2023-11-07T05:31:56Z"
},
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"billingDayOfMonth": 0,
"nextBillingDate": "2023-11-07T05:31:56Z",
"checkoutUrl": "<string>",
"hasPaymentMethod": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"planVersion": {
"id": "<string>",
"label": "<string>"
},
"scheduledVersionChange": {
"planVersionId": "<string>",
"label": "<string>",
"effectiveAt": "2023-11-07T05:31:56Z"
},
"consumptionModel": "metered",
"features": [
{
"code": "<string>",
"name": "<string>",
"type": "boolean",
"enabled": true
}
],
"credits": {
"remaining": 123,
"included": 123,
"purchased": 123,
"plan": 123,
"total": 123
},
"balance": {
"remaining": 123,
"included": 123,
"currency": "<string>",
"plan": 123,
"purchased": 123,
"total": 123
},
"object": "subscription",
"livemode": true,
"discount": {
"type": "percentage",
"value": 123,
"name": "<string>",
"endsAt": "2023-11-07T05:31:56Z"
}
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}Subscriptions
Get active subscription
Get the active subscription for a customer. Returns null if none.
GET
/
subscriptions
/
active
Get active subscription
curl --request GET \
--url https://commet.co/api/v1/subscriptions/active \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://commet.co/api/v1/subscriptions/active', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://commet.co/api/v1/subscriptions/active"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://commet.co/api/v1/subscriptions/active"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-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://commet.co/api/v1/subscriptions/active")
.header("x-api-key", "<api-key>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://commet.co/api/v1/subscriptions/active",
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-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"data": {
"id": "<string>",
"customerId": "<string>",
"plan": {
"id": "<string>",
"name": "<string>",
"basePrice": 123
},
"name": "<string>",
"description": "<string>",
"status": "draft",
"billingInterval": "weekly",
"trialEndsAt": "2023-11-07T05:31:56Z",
"currentPeriod": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"daysRemaining": 123
},
"cancellation": {
"scheduledAt": "2023-11-07T05:31:56Z",
"reason": "<string>",
"effectiveAt": "2023-11-07T05:31:56Z"
},
"cancelAtPeriodEnd": true,
"scheduledPlanChange": {
"changeType": "plan_downgrade",
"newPlanId": "<string>",
"newPlanName": "<string>",
"newBillingInterval": "<string>",
"scheduledFor": "2023-11-07T05:31:56Z"
},
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"billingDayOfMonth": 0,
"nextBillingDate": "2023-11-07T05:31:56Z",
"checkoutUrl": "<string>",
"hasPaymentMethod": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"planVersion": {
"id": "<string>",
"label": "<string>"
},
"scheduledVersionChange": {
"planVersionId": "<string>",
"label": "<string>",
"effectiveAt": "2023-11-07T05:31:56Z"
},
"consumptionModel": "metered",
"features": [
{
"code": "<string>",
"name": "<string>",
"type": "boolean",
"enabled": true
}
],
"credits": {
"remaining": 123,
"included": 123,
"purchased": 123,
"plan": 123,
"total": 123
},
"balance": {
"remaining": 123,
"included": 123,
"currency": "<string>",
"plan": 123,
"purchased": 123,
"total": 123
},
"object": "subscription",
"livemode": true,
"discount": {
"type": "percentage",
"value": 123,
"name": "<string>",
"endsAt": "2023-11-07T05:31:56Z"
}
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}This reference describes API version
2026-06-10. Send Commet-Version: 2026-06-10 with your request.Encabezados
¿Esta página le ayudó?