Filter
curl --request POST \
--url https://{defaultHost}/v1/subscriptions/filter \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filter": {
"type": "condition",
"attribute_name": "status",
"operator_label": "is",
"comparison_value": "active"
}
}
'import requests
url = "https://{defaultHost}/v1/subscriptions/filter"
payload = { "filter": {
"type": "condition",
"attribute_name": "status",
"operator_label": "is",
"comparison_value": "active"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filter: {
type: 'condition',
attribute_name: 'status',
operator_label: 'is',
comparison_value: 'active'
}
})
};
fetch('https://{defaultHost}/v1/subscriptions/filter', 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://{defaultHost}/v1/subscriptions/filter",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filter' => [
'type' => 'condition',
'attribute_name' => 'status',
'operator_label' => 'is',
'comparison_value' => 'active'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/subscriptions/filter"
payload := strings.NewReader("{\n \"filter\": {\n \"type\": \"condition\",\n \"attribute_name\": \"status\",\n \"operator_label\": \"is\",\n \"comparison_value\": \"active\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/subscriptions/filter")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {\n \"type\": \"condition\",\n \"attribute_name\": \"status\",\n \"operator_label\": \"is\",\n \"comparison_value\": \"active\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/subscriptions/filter")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": {\n \"type\": \"condition\",\n \"attribute_name\": \"status\",\n \"operator_label\": \"is\",\n \"comparison_value\": \"active\"\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"pagination": {
"count": 1,
"limit": 20,
"page": 1,
"url": "/v1/subscriptions/filter"
},
"data": [
{
"id": "f8825888-5b03-4007-96d8-4d060cd332b6",
"object": "subscription",
"ad_hoc_amount": null,
"affiliation_expires_at": null,
"cancel_at_period_end": false,
"currency": "usd",
"current_period_end_at": 1785077907,
"current_period_start_at": 1782485907,
"ended_at": null,
"finite": false,
"last_renewal_reminder_sent_at": null,
"live_mode": true,
"manual_payment": false,
"metadata": {},
"pending_update": {},
"price_readonly": false,
"portal_url": "http://app.example.com/portal_redirect/subscriptions/f8825888-5b03-4007-96d8-4d060cd332b6",
"quantity": 1,
"remaining_period_count": null,
"restart_on_completed": false,
"restore_at": null,
"subtotal_amount": 2900,
"status": "active",
"tax_enabled": false,
"trial_end_at": null,
"trial_start_at": null,
"variant_options": null,
"affiliation": null,
"current_cancellation_act": null,
"current_period": "44a97d1f-b748-4bc1-9b8a-7454d44620a0",
"customer": "b04fbd01-7e4f-485e-8369-0758ec001e6a",
"discount": null,
"manual_payment_method": null,
"payment_method": "ee673583-7b19-4e29-b101-37a56f3237ce",
"price": "43154265-e09d-4f44-8910-b144aefa7521",
"purchase": "4498f167-c329-4304-8961-cee380a1b9c6",
"shipping_method": null,
"variant": null,
"created_at": 1782485907,
"updated_at": 1782485907
}
]
}Subscriptions
Filter
Returns a list of subscriptions matching the supplied rule tree.
POST
/
v1
/
subscriptions
/
filter
Filter
curl --request POST \
--url https://{defaultHost}/v1/subscriptions/filter \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filter": {
"type": "condition",
"attribute_name": "status",
"operator_label": "is",
"comparison_value": "active"
}
}
'import requests
url = "https://{defaultHost}/v1/subscriptions/filter"
payload = { "filter": {
"type": "condition",
"attribute_name": "status",
"operator_label": "is",
"comparison_value": "active"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filter: {
type: 'condition',
attribute_name: 'status',
operator_label: 'is',
comparison_value: 'active'
}
})
};
fetch('https://{defaultHost}/v1/subscriptions/filter', 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://{defaultHost}/v1/subscriptions/filter",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filter' => [
'type' => 'condition',
'attribute_name' => 'status',
'operator_label' => 'is',
'comparison_value' => 'active'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/subscriptions/filter"
payload := strings.NewReader("{\n \"filter\": {\n \"type\": \"condition\",\n \"attribute_name\": \"status\",\n \"operator_label\": \"is\",\n \"comparison_value\": \"active\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/subscriptions/filter")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {\n \"type\": \"condition\",\n \"attribute_name\": \"status\",\n \"operator_label\": \"is\",\n \"comparison_value\": \"active\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/subscriptions/filter")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": {\n \"type\": \"condition\",\n \"attribute_name\": \"status\",\n \"operator_label\": \"is\",\n \"comparison_value\": \"active\"\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"pagination": {
"count": 1,
"limit": 20,
"page": 1,
"url": "/v1/subscriptions/filter"
},
"data": [
{
"id": "f8825888-5b03-4007-96d8-4d060cd332b6",
"object": "subscription",
"ad_hoc_amount": null,
"affiliation_expires_at": null,
"cancel_at_period_end": false,
"currency": "usd",
"current_period_end_at": 1785077907,
"current_period_start_at": 1782485907,
"ended_at": null,
"finite": false,
"last_renewal_reminder_sent_at": null,
"live_mode": true,
"manual_payment": false,
"metadata": {},
"pending_update": {},
"price_readonly": false,
"portal_url": "http://app.example.com/portal_redirect/subscriptions/f8825888-5b03-4007-96d8-4d060cd332b6",
"quantity": 1,
"remaining_period_count": null,
"restart_on_completed": false,
"restore_at": null,
"subtotal_amount": 2900,
"status": "active",
"tax_enabled": false,
"trial_end_at": null,
"trial_start_at": null,
"variant_options": null,
"affiliation": null,
"current_cancellation_act": null,
"current_period": "44a97d1f-b748-4bc1-9b8a-7454d44620a0",
"customer": "b04fbd01-7e4f-485e-8369-0758ec001e6a",
"discount": null,
"manual_payment_method": null,
"payment_method": "ee673583-7b19-4e29-b101-37a56f3237ce",
"price": "43154265-e09d-4f44-8910-b144aefa7521",
"purchase": "4498f167-c329-4304-8961-cee380a1b9c6",
"shipping_method": null,
"variant": null,
"created_at": 1782485907,
"updated_at": 1782485907
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
A rule tree describing how to filter records. May be a single rule_condition or a rule_group combining multiple conditions and nested groups with and / or. The valid attribute_name and operator_label values for each resource come from the corresponding GET /v1/<resource>/filter_schema endpoint.
- Option 1
- Option 2
Show child attributes
Show child attributes
Example:
{ "type": "group" }
Was this page helpful?
⌘I