curl --request POST \
--url https://api.paygentic.io/v0/sourceRules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conditions": [
{
"value": "<string>"
}
],
"name": "<string>",
"sourceId": "<string>",
"description": "<string>",
"enabled": true,
"order": 0
}
'import requests
url = "https://api.paygentic.io/v0/sourceRules"
payload = {
"conditions": [{ "value": "<string>" }],
"name": "<string>",
"sourceId": "<string>",
"description": "<string>",
"enabled": True,
"order": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
conditions: [{value: '<string>'}],
name: '<string>',
sourceId: '<string>',
description: '<string>',
enabled: true,
order: 0
})
};
fetch('https://api.paygentic.io/v0/sourceRules', 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/sourceRules",
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([
'conditions' => [
[
'value' => '<string>'
]
],
'name' => '<string>',
'sourceId' => '<string>',
'description' => '<string>',
'enabled' => true,
'order' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.paygentic.io/v0/sourceRules"
payload := strings.NewReader("{\n \"conditions\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"name\": \"<string>\",\n \"sourceId\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"order\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.paygentic.io/v0/sourceRules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conditions\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"name\": \"<string>\",\n \"sourceId\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"order\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/sourceRules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"conditions\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"name\": \"<string>\",\n \"sourceId\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"order\": 0\n}"
response = http.request(request)
puts response.read_body{
"id": "rule_789012",
"conditions": [
{
"operator": "lessThan",
"type": "amount",
"value": 100
}
],
"createdAt": "2024-03-05T12:00:00Z",
"createdBy": "usr_merchant",
"description": "Automatically approve events with amount less than $100",
"enabled": true,
"evaluationCount": 0,
"lastEvaluatedAt": null,
"matchCount": 0,
"name": "Auto-approve small amounts",
"order": 1,
"sourceId": "src_x3y4z5a6b7c8d9e0",
"updatedAt": "2024-03-05T12:00:00Z"
}{
"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"
}Create Rule
Create a rule for automatically approving source events. When a pending source event matches ALL conditions in a rule, it will be automatically approved and converted to a usage event. Rules are evaluated in order (lowest order number first), and the first matching rule triggers auto-approval. Maximum 10 rules per source.
curl --request POST \
--url https://api.paygentic.io/v0/sourceRules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conditions": [
{
"value": "<string>"
}
],
"name": "<string>",
"sourceId": "<string>",
"description": "<string>",
"enabled": true,
"order": 0
}
'import requests
url = "https://api.paygentic.io/v0/sourceRules"
payload = {
"conditions": [{ "value": "<string>" }],
"name": "<string>",
"sourceId": "<string>",
"description": "<string>",
"enabled": True,
"order": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
conditions: [{value: '<string>'}],
name: '<string>',
sourceId: '<string>',
description: '<string>',
enabled: true,
order: 0
})
};
fetch('https://api.paygentic.io/v0/sourceRules', 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/sourceRules",
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([
'conditions' => [
[
'value' => '<string>'
]
],
'name' => '<string>',
'sourceId' => '<string>',
'description' => '<string>',
'enabled' => true,
'order' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.paygentic.io/v0/sourceRules"
payload := strings.NewReader("{\n \"conditions\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"name\": \"<string>\",\n \"sourceId\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"order\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.paygentic.io/v0/sourceRules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conditions\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"name\": \"<string>\",\n \"sourceId\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"order\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/sourceRules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"conditions\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"name\": \"<string>\",\n \"sourceId\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"order\": 0\n}"
response = http.request(request)
puts response.read_body{
"id": "rule_789012",
"conditions": [
{
"operator": "lessThan",
"type": "amount",
"value": 100
}
],
"createdAt": "2024-03-05T12:00:00Z",
"createdBy": "usr_merchant",
"description": "Automatically approve events with amount less than $100",
"enabled": true,
"evaluationCount": 0,
"lastEvaluatedAt": null,
"matchCount": 0,
"name": "Auto-approve small amounts",
"order": 1,
"sourceId": "src_x3y4z5a6b7c8d9e0",
"updatedAt": "2024-03-05T12:00:00Z"
}{
"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"
}Authorizations
API key authentication
Body
Conditions that must ALL be met (AND logic) for auto-acceptance. Sample values: customerEmail domain='@trusted.com' AND amount lessThan=1000, customerId equals='org_abc123' AND billableMetricId equals='bm_tokens', subscriptionId equals='sub_xyz789' AND quantity greaterThan=100
1 - 10 elementsShow child attributes
Show child attributes
Human-readable name for the source rule
Unique identifier for a source
^src_[a-zA-Z0-9]+$Detailed description of what this source rule does
Whether this rule should be active immediately
Evaluation priority (0-999). Lower numbers are evaluated first. First matching rule triggers auto-acceptance.
x >= 0Response
Rule created
An auto-acceptance rule that automatically approves source events matching specified conditions. Rules help automate the approval process for trusted customers or specific transaction patterns.
Unique identifier for the rule
List of conditions that must ALL be met (AND logic)
Show child attributes
Show child attributes
When the rule was created
Detailed description of what this source rule does
Whether this rule is currently active
Total number of times this rule has been evaluated
Number of times this rule has matched and auto-accepted an invoice
Human-readable name for the source rule
Priority order for rule evaluation (lower numbers are evaluated first)
ID of the source this rule belongs to
When the rule was last updated
User ID who created the rule
Last time this rule was evaluated against an invoice
Was this page helpful?