Skip to main content
POST
/
policy
/
rules
/
quota
TypeScript
const response: Promise<FireblocksResponse<PolicyRuleQuotaResponse>> = fireblocks.policyEditorV2Beta.getPolicyRuleQuota(policyEditorV2BetaApiGetPolicyRuleQuotaRequest);
CompletableFuture<ApiResponse<PolicyRuleQuotaResponse>> response = fireblocks.policyEditorV2Beta().getPolicyRuleQuota(policyRuleQuotaRequest, idempotencyKey);
response = fireblocks.policy_editor_v2_beta.get_policy_rule_quota(policy_rule_quota_request, idempotency_key);
curl --request POST \
--url https://api.fireblocks.io/v1/policy/rules/quota \
--header 'Content-Type: application/json' \
--data '
{
"ruleId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"initiator": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"source": {
"id": "123",
"type": "VAULT"
},
"destination": {
"id": "123",
"type": "VAULT"
}
}
'
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
ruleId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
initiator: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
source: {id: '123', type: 'VAULT'},
destination: {id: '123', type: 'VAULT'}
})
};

fetch('https://api.fireblocks.io/v1/policy/rules/quota', 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.fireblocks.io/v1/policy/rules/quota",
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([
'ruleId' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'initiator' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'source' => [
'id' => '123',
'type' => 'VAULT'
],
'destination' => [
'id' => '123',
'type' => 'VAULT'
]
]),
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.fireblocks.io/v1/policy/rules/quota"

payload := strings.NewReader("{\n \"ruleId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"initiator\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"source\": {\n \"id\": \"123\",\n \"type\": \"VAULT\"\n },\n \"destination\": {\n \"id\": \"123\",\n \"type\": \"VAULT\"\n }\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))

}
require 'uri'
require 'net/http'

url = URI("https://api.fireblocks.io/v1/policy/rules/quota")

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 \"ruleId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"initiator\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"source\": {\n \"id\": \"123\",\n \"type\": \"VAULT\"\n },\n \"destination\": {\n \"id\": \"123\",\n \"type\": \"VAULT\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "amount": "10000",
  "quotaConfig": {
    "range": {
      "min": "100",
      "max": "10000"
    },
    "currency": "USD",
    "timePeriod": {
      "seconds": "86400",
      "initiator": "PER_SINGLE_MATCH",
      "source": "PER_SINGLE_MATCH",
      "destination": "PER_SINGLE_MATCH"
    }
  },
  "currency": "USD",
  "windowStart": 1699913600,
  "windowEnd": 1700000000,
  "transactionCount": 5
}
{
"message": "<string>",
"code": 123
}
{
"message": "<string>",
"code": 123
}
{
"message": "<string>",
"code": 123
}
{
"message": "<string>",
"code": 123
}
{
"message": "<string>",
"code": 123
}
{
"message": "<string>",
"code": 123
}

Headers

Idempotency-Key
string

A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours.

Body

application/json
ruleId
string
required

The ID of the policy rule to calculate AOT quota for

Example:

"a1b2c3d4-e5f6-7890-abcd-ef1234567890"

initiator
string

Optional initiator identifier for the AOT calculation

Example:

"a1b2c3d4-e5f6-7890-abcd-ef1234567890"

source
object

Participant identifier for AOT quota calculation

Example:
{ "id": "123", "type": "VAULT" }
destination
object

Participant identifier for AOT quota calculation

Example:
{ "id": "123", "type": "VAULT" }

Response

The calculated AOT quota for the rule

amount
string

The calculated Amount Over Time (AOT) quota for the rule

Example:

"10000"

quotaConfig
object

Amount over time configuration

currency
string

The currency of the AOT amount

Example:

"USD"

windowStart
number

Unix timestamp (seconds) of the start of the current AOT time window

Example:

1699913600

windowEnd
number

Unix timestamp (seconds) of the end of the current AOT time window (when the AOT was calculated)

Example:

1700000000

transactionCount
number

Number of transactions in the current AOT time window

Example:

5