Skip to main content
POST
/
v1
/
sdk
/
limits
Check usage limits for a customer and product
curl --request POST \
  --url https://api.example.com/v1/sdk/limits \
  --header 'Content-Type: application/json' \
  --data '
{
  "customerRef": "<string>",
  "productRef": "<string>",
  "meterName": "<string>",
  "usageType": "<string>"
}
'
import requests

url = "https://api.example.com/v1/sdk/limits"

payload = {
"customerRef": "<string>",
"productRef": "<string>",
"meterName": "<string>",
"usageType": "<string>"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
customerRef: '<string>',
productRef: '<string>',
meterName: '<string>',
usageType: '<string>'
})
};

fetch('https://api.example.com/v1/sdk/limits', 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.example.com/v1/sdk/limits",
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([
'customerRef' => '<string>',
'productRef' => '<string>',
'meterName' => '<string>',
'usageType' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/v1/sdk/limits"

payload := strings.NewReader("{\n \"customerRef\": \"<string>\",\n \"productRef\": \"<string>\",\n \"meterName\": \"<string>\",\n \"usageType\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

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://api.example.com/v1/sdk/limits")
.header("Content-Type", "application/json")
.body("{\n \"customerRef\": \"<string>\",\n \"productRef\": \"<string>\",\n \"meterName\": \"<string>\",\n \"usageType\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/sdk/limits")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerRef\": \"<string>\",\n \"productRef\": \"<string>\",\n \"meterName\": \"<string>\",\n \"usageType\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "remaining": 997,
  "withinLimits": true,
  "activationRequired": true,
  "balance": {
    "creditBalance": 123,
    "creditsPerUnit": 123,
    "currency": "<string>",
    "remainingUnits": 123
  },
  "checkoutSessionId": "e3f1c2d4b6a89f001122334455667788",
  "checkoutUrl": "https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788",
  "confirmationUrl": "<string>",
  "creditBalance": 123,
  "creditsPerUnit": 123,
  "currency": "<string>",
  "meterName": "requests",
  "plans": [
    {
      "currency": "<string>",
      "price": 123,
      "reference": "<string>",
      "requiresPayment": true,
      "type": "<string>",
      "billingCycle": "<string>",
      "billingModel": "<string>",
      "creditsPerUnit": 123,
      "freeUnits": 123,
      "name": "<string>"
    }
  ],
  "product": {
    "reference": "<string>",
    "name": "<string>"
  }
}

Body

application/json
customerRef
string
required
Minimum string length: 1
productRef
string
required
Minimum string length: 1
meterName
string
usageType
string

Response

Limit check result

remaining
number
required

Remaining usage units before hitting the limit

Example:

997

withinLimits
boolean
required

Whether the customer is within their usage limits

Example:

true

activationRequired
boolean

True when the customer must activate a priced default plan before usage is allowed

balance
object

Prepaid usage balance context when the default plan is usage-based

checkoutSessionId
string

Checkout session ID if payment is required

Example:

"e3f1c2d4b6a89f001122334455667788"

checkoutUrl
string

Checkout URL if payment is required

Example:

"https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788"

confirmationUrl
string

Customer portal confirmation URL when activation is required (fallback when not starting checkout)

creditBalance
number

Credit balance in mils (for pre-paid usage-based plans)

creditsPerUnit
number

Credits per usage unit (for pre-paid usage-based plans)

currency
string

ISO 4217 currency code for credit fields

meterName
string

The meter name to use when tracking usage events

Example:

"requests"

plans
object[]

Active plans on the product available for activation or checkout

product
object

Product the limit check applies to