Membership Contracts
Get valid membership contract IDs for customer
Retrieves a list of all valid (active, paused, or pending) membership contract IDs associated with a specific customer. This endpoint is useful for quickly checking which memberships a customer has without retrieving full contract details.
Key Features:
- Quick Lookup: Returns only contract IDs, not full contract details
- Active Memberships Only: Excludes cancelled or expired contracts
- Set Response: Returns unique contract IDs (no duplicates)
- Fast Performance: Lightweight query for list views
Included Membership Statuses:
- ACTIVE: Currently active recurring memberships
- PAUSED: Temporarily paused but valid memberships
- PENDING: Scheduled to start in the future
Excluded Membership Statuses:
- CANCELLED: Customer-cancelled memberships
- EXPIRED: Reached max cycles or end date
- FAILED: Failed billing with no recovery
Common Use Cases:
- Membership Count: Quickly determine how many active memberships a customer has
- Access Control: Verify customer has valid memberships before showing portal
- List Navigation: Build dropdown or list of customer’s memberships
- Bulk Operations: Get all contract IDs for batch processing
- Validation: Check if customer has any active memberships
- Dashboard Display: Show membership count without full data
Example Response:
[12345, 12346, 12389]
Parameters:
- customerId (required, path): The Shopify customer ID
Response: Returns a Set of Long values representing valid membership contract IDs
Authentication: Requires API key authentication via X-API-Key header or api_key parameter
GET
/
api
/
external
/
v2
/
subscription-customers
/
valid
/
{customerId}
Get valid membership contract IDs for customer
curl --request GET \
--url https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}import requests
url = "https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}';
const options = {method: 'GET'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}",
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://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}")
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"<string>"[
123
][
123
][
123
]Headers
Path Parameters
Shopify customer ID
Query Parameters
API Key (Deprecated - Use Header X-API-Key instead)
Response
Valid membership contract IDs retrieved successfully (may be empty set if customer has no active memberships)
The response is of type string.
⌘I
Get valid membership contract IDs for customer
curl --request GET \
--url https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}import requests
url = "https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}';
const options = {method: 'GET'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}",
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://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://membership-admin.appstle.com/api/external/v2/subscription-customers/valid/{customerId}")
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"<string>"[
123
][
123
][
123
]