curl --request GET \
--url https://api.paygentic.io/v0/creditPools/{id}/grants \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paygentic.io/v0/creditPools/{id}/grants"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.paygentic.io/v0/creditPools/{id}/grants', 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.paygentic.io/v0/creditPools/{id}/grants",
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://api.paygentic.io/v0/creditPools/{id}/grants"
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://api.paygentic.io/v0/creditPools/{id}/grants")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/creditPools/{id}/grants")
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": "<string>",
"object": "grant",
"creditPoolId": "<string>",
"amount": 123,
"priority": 123,
"recurrencePeriod": "<string>",
"recurrenceAnchor": "2023-11-07T05:31:56Z",
"effectiveAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"voidedAt": "2023-11-07T05:31:56Z",
"status": "active",
"remainingBalance": 123,
"consumed": 123,
"grantedToDate": 123
}
],
"pagination": {
"limit": 123,
"offset": 123,
"total": 123
},
"asOf": "2023-11-07T05:31:56Z"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}List grants
Lists the grants on the pool, with the credits left on each. Active and scheduled grants come first, in the order they are spent: lowest priority first, then soonest expiry (no expiry last), then oldest. Expired and voided grants come after, newest first. remainingBalance is the grant’s balance from the same replay the ledger runs, computed at read time from the usage so far. It is 0 unless the grant is active. Statuses and balances are computed at one instant, returned as asOf. It defaults to the customer’s test clock time if an active subscription has one, otherwise now. Pass at to read at a different instant.
curl --request GET \
--url https://api.paygentic.io/v0/creditPools/{id}/grants \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paygentic.io/v0/creditPools/{id}/grants"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.paygentic.io/v0/creditPools/{id}/grants', 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.paygentic.io/v0/creditPools/{id}/grants",
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://api.paygentic.io/v0/creditPools/{id}/grants"
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://api.paygentic.io/v0/creditPools/{id}/grants")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/creditPools/{id}/grants")
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": "<string>",
"object": "grant",
"creditPoolId": "<string>",
"amount": 123,
"priority": 123,
"recurrencePeriod": "<string>",
"recurrenceAnchor": "2023-11-07T05:31:56Z",
"effectiveAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"voidedAt": "2023-11-07T05:31:56Z",
"status": "active",
"remainingBalance": 123,
"consumed": 123,
"grantedToDate": 123
}
],
"pagination": {
"limit": 123,
"offset": 123,
"total": 123
},
"asOf": "2023-11-07T05:31:56Z"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Query Parameters
Return only grants with this status.
Where the grant stands now. active grants have started and are neither expired nor voided; a fully used grant stays active with a remainingBalance of 0. scheduled grants start later. expired grants passed their expiry. voided grants were cancelled.
active, scheduled, expired, voided Response
The pool's grants
Was this page helpful?