Get the policy a capability's requests must declare right now
Tells an agent what a request for a capability must declare and carry right now: the policy name and version, the policy’s description, and its signals (every fact the rules read with its type, the facts that must equal a value of the in…
curl "https://parmana-api-real.vercel.app/policies/in-effect?capability=paytm%3Arefund" \
-H "Authorization: Bearer $PARMANA_API_KEY"import { ParmanaClient } from "@parmana/sdk";
const client = new ParmanaClient({
endpoint: "https://parmana-api-real.vercel.app",
apiKey: process.env.PARMANA_API_KEY!,
});
const inEffect = await client.policyInEffect("paytm:refund");
console.log(inEffect.policy, inEffect.signals.approval);import os
from parmana import ParmanaClient
client = ParmanaClient(
endpoint="https://parmana-api-real.vercel.app",
api_key=os.environ["PARMANA_API_KEY"],
)
in_effect = client.policy_in_effect("paytm:refund")
print(in_effect.policy, in_effect.signals.approval)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://parmana-sandbox.vercel.app/policies/in-effect', 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://parmana-sandbox.vercel.app/policies/in-effect",
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://parmana-sandbox.vercel.app/policies/in-effect"
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://parmana-sandbox.vercel.app/policies/in-effect")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://parmana-sandbox.vercel.app/policies/in-effect")
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{
"capability": "paytm:refund",
"policy": {
"name": "customer-refund",
"version": "1.2.0",
"schemaVersion": "1.0.0"
},
"description": "Authorizes customer refunds. Every refund above 0 and up to 100000 needs a signed manager approval for that order, covering that amount.",
"signals": {
"facts": [
"fraudCheckPassed",
"managerApproved",
"refundAmount",
"refundEligible"
],
"schema": {
"refundEligible": "boolean",
"managerApproved": "boolean",
"fraudCheckPassed": "boolean",
"refundAmount": "number"
},
"bound": {
"refundAmount": "parameters.amount"
},
"approval": {
"managerApproved": {
"resourceId": "parameters.orderId",
"value": "parameters.amount"
}
}
}
}{
"error": "capability is required, for example ?capability=paytm:refund."
}{
"error": "authentication required"
}{
"error": "Caller is not permitted to invoke this capability.",
"code": "CAPABILITY_NOT_ALLOWED"
}{
"error": "No policy is bound to capability \"test:fixture-execute\".",
"code": "CAPABILITY_NOT_BOUND"
}{
"error": "Every request for \"paytm:refund\" is refused right now: no version of policy \"customer-refund\", which capability \"paytm:refund\" requires, has been approved through policy governance.",
"code": "NO_APPROVED_POLICY_VERSION"
}{
"error": "Every request for \"paytm:refund\" is refused right now: the version of policy \"customer-refund\" in effect for capability \"paytm:refund\" could not be looked up: database unreachable.",
"code": "POLICY_VERSION_UNAVAILABLE"
}Authorizations
Caller API key issued by scripts/generate-api-key.ts. Sent as Authorization: Bearer . Verified against a stored SHA-256 hash in constant time by packages/api/src/auth/StaticKeyAuthenticator.ts. Required on every route not listed as exempt in this document's top-level description. See /api-reference/authentication.
Query Parameters
The action, as in intent.action, for example paytm:refund.
Response
What to declare and carry.
Show child attributes
Show child attributes
The policy author's description for people, or null.
What a request under this policy must carry.
Show child attributes
Show child attributes
Present only when the policy requires it. Your key needs a current authority grant for this capability, made through maker checker (/authority-grants), and each request must be within the grant's limits.
curl "https://parmana-api-real.vercel.app/policies/in-effect?capability=paytm%3Arefund" \
-H "Authorization: Bearer $PARMANA_API_KEY"import { ParmanaClient } from "@parmana/sdk";
const client = new ParmanaClient({
endpoint: "https://parmana-api-real.vercel.app",
apiKey: process.env.PARMANA_API_KEY!,
});
const inEffect = await client.policyInEffect("paytm:refund");
console.log(inEffect.policy, inEffect.signals.approval);import os
from parmana import ParmanaClient
client = ParmanaClient(
endpoint="https://parmana-api-real.vercel.app",
api_key=os.environ["PARMANA_API_KEY"],
)
in_effect = client.policy_in_effect("paytm:refund")
print(in_effect.policy, in_effect.signals.approval)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://parmana-sandbox.vercel.app/policies/in-effect', 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://parmana-sandbox.vercel.app/policies/in-effect",
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://parmana-sandbox.vercel.app/policies/in-effect"
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://parmana-sandbox.vercel.app/policies/in-effect")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://parmana-sandbox.vercel.app/policies/in-effect")
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{
"capability": "paytm:refund",
"policy": {
"name": "customer-refund",
"version": "1.2.0",
"schemaVersion": "1.0.0"
},
"description": "Authorizes customer refunds. Every refund above 0 and up to 100000 needs a signed manager approval for that order, covering that amount.",
"signals": {
"facts": [
"fraudCheckPassed",
"managerApproved",
"refundAmount",
"refundEligible"
],
"schema": {
"refundEligible": "boolean",
"managerApproved": "boolean",
"fraudCheckPassed": "boolean",
"refundAmount": "number"
},
"bound": {
"refundAmount": "parameters.amount"
},
"approval": {
"managerApproved": {
"resourceId": "parameters.orderId",
"value": "parameters.amount"
}
}
}
}{
"error": "capability is required, for example ?capability=paytm:refund."
}{
"error": "authentication required"
}{
"error": "Caller is not permitted to invoke this capability.",
"code": "CAPABILITY_NOT_ALLOWED"
}{
"error": "No policy is bound to capability \"test:fixture-execute\".",
"code": "CAPABILITY_NOT_BOUND"
}{
"error": "Every request for \"paytm:refund\" is refused right now: no version of policy \"customer-refund\", which capability \"paytm:refund\" requires, has been approved through policy governance.",
"code": "NO_APPROVED_POLICY_VERSION"
}{
"error": "Every request for \"paytm:refund\" is refused right now: the version of policy \"customer-refund\" in effect for capability \"paytm:refund\" could not be looked up: database unreachable.",
"code": "POLICY_VERSION_UNAVAILABLE"
}