Get the credit balance, saved card and monthly spend
curl --request GET \
--url https://api.rial.io/v1/me/credits \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.rial.io/v1/me/credits"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.rial.io/v1/me/credits', 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.rial.io/v1/me/credits",
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.rial.io/v1/me/credits"
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.rial.io/v1/me/credits")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rial.io/v1/me/credits")
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{
"balance_cents": 123,
"photos_available": 1,
"price_per_photo_cents": 123,
"packs": [
{
"photos": 123,
"amount_cents": 123
}
],
"payment_method": {
"brand": "<string>",
"last4": "<string>"
},
"monthly_cap_cents": 123,
"month_spent_cents": 123,
"plan": {
"tier": "free",
"photos_included": 1,
"photos_used": 1,
"photos_left": 1,
"renews_at": "<string>"
},
"photos_left": 1
}{
"error": {
"code": "<string>",
"message": "<string>",
"decline_code": "<string>",
"month_spent_cents": 123,
"monthly_cap_cents": 123,
"idempotency_key": "<string>"
}
}Get the credit balance, saved card and monthly spend
Your credit balance in photos, the packs on sale, the saved card and how much of the monthly cap is spent.
GET
/
v1
/
me
/
credits
Get the credit balance, saved card and monthly spend
curl --request GET \
--url https://api.rial.io/v1/me/credits \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.rial.io/v1/me/credits"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.rial.io/v1/me/credits', 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.rial.io/v1/me/credits",
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.rial.io/v1/me/credits"
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.rial.io/v1/me/credits")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rial.io/v1/me/credits")
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{
"balance_cents": 123,
"photos_available": 1,
"price_per_photo_cents": 123,
"packs": [
{
"photos": 123,
"amount_cents": 123
}
],
"payment_method": {
"brand": "<string>",
"last4": "<string>"
},
"monthly_cap_cents": 123,
"month_spent_cents": 123,
"plan": {
"tier": "free",
"photos_included": 1,
"photos_used": 1,
"photos_left": 1,
"renews_at": "<string>"
},
"photos_left": 1
}{
"error": {
"code": "<string>",
"message": "<string>",
"decline_code": "<string>",
"month_spent_cents": 123,
"monthly_cap_cents": 123,
"idempotency_key": "<string>"
}
}Authorizations
Secret API key, created in the dashboard under Settings → API. Send it as Authorization: Bearer rk_secret_… from your server only. Publishable keys (pk_live_…) are for the native SDKs and reach the capture endpoints alone. An unknown key returns 401.
Response
Free photos left in the plan, prepaid credits, the packs on sale and how much of the monthly cap is used.
Required range:
x >= 0Show child attributes
Show child attributes
Show child attributes
Show child attributes
The photos the plan includes, used before any credit.
Show child attributes
Show child attributes
Photos the account can still capture: free ones left plus what the credits buy. null when the account has no capture limit.
Required range:
x >= 0