Consent
Get Customer Consents
Retrieve all consent records for a specific customer, grouped by consent type.
GET
/
v1
/
customers
/
{id}
/
consents
List a customer's consents
curl --request GET \
--url https://billing.example.com/v1/customers/{id}/consents \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/customers/{id}/consents"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://billing.example.com/v1/customers/{id}/consents', 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://billing.example.com/v1/customers/{id}/consents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://billing.example.com/v1/customers/{id}/consents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://billing.example.com/v1/customers/{id}/consents")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/customers/{id}/consents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"consent_type": "recurring_billing",
"granted": true,
"granted_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"ip_address": "<string>",
"user_agent": "<string>",
"consent_text": "<string>",
"version": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The unique identifier of the customer (e.g., cust_8Hx4kLm2Qr). |
Example Request
curl -X GET https://api.recurso.dev/v1/customers/cust_8Hx4kLm2Qr/consents \
-H "Authorization: Bearer rsk_live_7f3a9b2c1d4e8f0a"
Response
{
"data": {
"marketing": [
{
"id": "cons_Tn4vW9xKpL",
"channel": "email",
"granted": true,
"ip_address": "203.0.113.42",
"timestamp": "2026-06-23T14:32:10Z",
"revoked_at": null
},
{
"id": "cons_Qm7yR3bFwJ",
"channel": "sms",
"granted": false,
"ip_address": "203.0.113.42",
"timestamp": "2026-06-20T09:15:00Z",
"revoked_at": null
}
],
"billing": [
{
"id": "cons_Xk2pN8dVsH",
"channel": "email",
"granted": true,
"ip_address": "198.51.100.14",
"timestamp": "2026-05-10T11:00:00Z",
"revoked_at": null
}
],
"data_processing": [
{
"id": "cons_Lw9eA5gCtR",
"channel": "email",
"granted": true,
"ip_address": "198.51.100.14",
"timestamp": "2026-05-10T11:00:05Z",
"revoked_at": null
}
]
},
"customer_id": "cust_8Hx4kLm2Qr"
}
Notes
- Consents are grouped by
type(marketing,billing,data_processing) for easy lookup. - Each group contains all consent records for that type, including both active and revoked consents.
- A consent with
granted: trueandrevoked_at: nullis currently active. - A consent with a non-null
revoked_atwas previously granted but has since been revoked.
Use this endpoint to build a consent management UI that shows customers their current consent preferences.
⌘I
List a customer's consents
curl --request GET \
--url https://billing.example.com/v1/customers/{id}/consents \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/customers/{id}/consents"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://billing.example.com/v1/customers/{id}/consents', 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://billing.example.com/v1/customers/{id}/consents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://billing.example.com/v1/customers/{id}/consents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://billing.example.com/v1/customers/{id}/consents")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/customers/{id}/consents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"consent_type": "recurring_billing",
"granted": true,
"granted_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"ip_address": "<string>",
"user_agent": "<string>",
"consent_text": "<string>",
"version": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}