Create aggregation
curl --request POST \
--url https://api.privy.io/v1/aggregations \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"name": "Daily ETH transfer limit on Base",
"method": "eth_signTransaction",
"metric": {
"field": "value",
"field_source": "ethereum_transaction",
"function": "sum"
},
"window": {
"type": "rolling",
"seconds": 86400
},
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "chain_id",
"operator": "eq",
"value": "84532"
}
],
"group_by": [
{
"field": "to",
"field_source": "ethereum_transaction"
}
]
}
'HttpResponse<String> response = Unirest.post("https://api.privy.io/v1/aggregations")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Daily ETH transfer limit on Base\",\n \"method\": \"eth_signTransaction\",\n \"metric\": {\n \"field\": \"value\",\n \"field_source\": \"ethereum_transaction\",\n \"function\": \"sum\"\n },\n \"window\": {\n \"type\": \"rolling\",\n \"seconds\": 86400\n },\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"field\": \"chain_id\",\n \"operator\": \"eq\",\n \"value\": \"84532\"\n }\n ],\n \"group_by\": [\n {\n \"field\": \"to\",\n \"field_source\": \"ethereum_transaction\"\n }\n ]\n}")
.asString();const options = {
method: 'POST',
headers: {
'privy-app-id': '<privy-app-id>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Daily ETH transfer limit on Base',
method: 'eth_signTransaction',
metric: {field: 'value', field_source: 'ethereum_transaction', function: 'sum'},
window: {type: 'rolling', seconds: 86400},
conditions: [
{
field_source: 'ethereum_transaction',
field: 'chain_id',
operator: 'eq',
value: '84532'
}
],
group_by: [{field: 'to', field_source: 'ethereum_transaction'}]
})
};
fetch('https://api.privy.io/v1/aggregations', 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.privy.io/v1/aggregations",
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([
'name' => 'Daily ETH transfer limit on Base',
'method' => 'eth_signTransaction',
'metric' => [
'field' => 'value',
'field_source' => 'ethereum_transaction',
'function' => 'sum'
],
'window' => [
'type' => 'rolling',
'seconds' => 86400
],
'conditions' => [
[
'field_source' => 'ethereum_transaction',
'field' => 'chain_id',
'operator' => 'eq',
'value' => '84532'
]
],
'group_by' => [
[
'field' => 'to',
'field_source' => 'ethereum_transaction'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"privy-app-id: <privy-app-id>"
],
]);
$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.privy.io/v1/aggregations"
payload := strings.NewReader("{\n \"name\": \"Daily ETH transfer limit on Base\",\n \"method\": \"eth_signTransaction\",\n \"metric\": {\n \"field\": \"value\",\n \"field_source\": \"ethereum_transaction\",\n \"function\": \"sum\"\n },\n \"window\": {\n \"type\": \"rolling\",\n \"seconds\": 86400\n },\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"field\": \"chain_id\",\n \"operator\": \"eq\",\n \"value\": \"84532\"\n }\n ],\n \"group_by\": [\n {\n \"field\": \"to\",\n \"field_source\": \"ethereum_transaction\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("privy-app-id", "<privy-app-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}{
"name": "<string>",
"method": "eth_signTransaction",
"metric": {
"field": "<string>",
"field_source": "<string>",
"function": "sum",
"abi": [
{
"type": "function",
"name": "<string>",
"inputs": [
{
"type": "<string>",
"name": "<string>",
"components": [
{}
],
"indexed": true,
"internalType": "<string>"
}
],
"outputs": [
{
"type": "<string>",
"name": "<string>",
"components": [
{}
],
"indexed": true,
"internalType": "<string>"
}
],
"stateMutability": "pure",
"anonymous": true
}
]
},
"window": {
"type": "rolling",
"seconds": 131400
},
"id": "<string>",
"created_at": 123,
"owner_id": "<string>",
"conditions": [],
"group_by": []
}Aggregations
Create aggregation
Create a new aggregation to track and measure metrics over a time window.
POST
/
v1
/
aggregations
Create aggregation
curl --request POST \
--url https://api.privy.io/v1/aggregations \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"name": "Daily ETH transfer limit on Base",
"method": "eth_signTransaction",
"metric": {
"field": "value",
"field_source": "ethereum_transaction",
"function": "sum"
},
"window": {
"type": "rolling",
"seconds": 86400
},
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "chain_id",
"operator": "eq",
"value": "84532"
}
],
"group_by": [
{
"field": "to",
"field_source": "ethereum_transaction"
}
]
}
'HttpResponse<String> response = Unirest.post("https://api.privy.io/v1/aggregations")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Daily ETH transfer limit on Base\",\n \"method\": \"eth_signTransaction\",\n \"metric\": {\n \"field\": \"value\",\n \"field_source\": \"ethereum_transaction\",\n \"function\": \"sum\"\n },\n \"window\": {\n \"type\": \"rolling\",\n \"seconds\": 86400\n },\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"field\": \"chain_id\",\n \"operator\": \"eq\",\n \"value\": \"84532\"\n }\n ],\n \"group_by\": [\n {\n \"field\": \"to\",\n \"field_source\": \"ethereum_transaction\"\n }\n ]\n}")
.asString();const options = {
method: 'POST',
headers: {
'privy-app-id': '<privy-app-id>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Daily ETH transfer limit on Base',
method: 'eth_signTransaction',
metric: {field: 'value', field_source: 'ethereum_transaction', function: 'sum'},
window: {type: 'rolling', seconds: 86400},
conditions: [
{
field_source: 'ethereum_transaction',
field: 'chain_id',
operator: 'eq',
value: '84532'
}
],
group_by: [{field: 'to', field_source: 'ethereum_transaction'}]
})
};
fetch('https://api.privy.io/v1/aggregations', 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.privy.io/v1/aggregations",
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([
'name' => 'Daily ETH transfer limit on Base',
'method' => 'eth_signTransaction',
'metric' => [
'field' => 'value',
'field_source' => 'ethereum_transaction',
'function' => 'sum'
],
'window' => [
'type' => 'rolling',
'seconds' => 86400
],
'conditions' => [
[
'field_source' => 'ethereum_transaction',
'field' => 'chain_id',
'operator' => 'eq',
'value' => '84532'
]
],
'group_by' => [
[
'field' => 'to',
'field_source' => 'ethereum_transaction'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"privy-app-id: <privy-app-id>"
],
]);
$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.privy.io/v1/aggregations"
payload := strings.NewReader("{\n \"name\": \"Daily ETH transfer limit on Base\",\n \"method\": \"eth_signTransaction\",\n \"metric\": {\n \"field\": \"value\",\n \"field_source\": \"ethereum_transaction\",\n \"function\": \"sum\"\n },\n \"window\": {\n \"type\": \"rolling\",\n \"seconds\": 86400\n },\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"field\": \"chain_id\",\n \"operator\": \"eq\",\n \"value\": \"84532\"\n }\n ],\n \"group_by\": [\n {\n \"field\": \"to\",\n \"field_source\": \"ethereum_transaction\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("privy-app-id", "<privy-app-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}{
"name": "<string>",
"method": "eth_signTransaction",
"metric": {
"field": "<string>",
"field_source": "<string>",
"function": "sum",
"abi": [
{
"type": "function",
"name": "<string>",
"inputs": [
{
"type": "<string>",
"name": "<string>",
"components": [
{}
],
"indexed": true,
"internalType": "<string>"
}
],
"outputs": [
{
"type": "<string>",
"name": "<string>",
"components": [
{}
],
"indexed": true,
"internalType": "<string>"
}
],
"stateMutability": "pure",
"anonymous": true
}
]
},
"window": {
"type": "rolling",
"seconds": 131400
},
"id": "<string>",
"created_at": 123,
"owner_id": "<string>",
"conditions": [],
"group_by": []
}SDK methods
Learn more about creating aggregations and using them in policies here.Authorizations
Headers
Body
application/json
Input for creating an aggregation.
conditions
(EthereumTransactionCondition · object | EthereumCalldataCondition · object | EthereumTypedDataDomainCondition · object | EthereumTypedDataMessageCondition · object | Ethereum7702AuthorizationCondition · object | TempoTransactionCondition · object | SolanaProgramInstructionCondition · object | SolanaInstructionDataCondition · object | SolanaSystemProgramInstructionCondition · object | SolanaTokenProgramInstructionCondition · object | SystemCondition · object | TronTransactionCondition · object | TronCalldataCondition · object | XrplTransactionCondition · object | SuiTransactionCommandCondition · object | SuiTransferObjectsCommandCondition · object | ActionRequestBodyCondition · object | AggregationCondition · object | MessageSigningCondition · object)[]
Optional conditions to filter events before aggregation.
Maximum array length:
100The verbatim Ethereum transaction object in an eth_signTransaction or eth_sendTransaction request.
- EthereumTransactionCondition
- EthereumCalldataCondition
- EthereumTypedDataDomainCondition
- EthereumTypedDataMessageCondition
- Ethereum7702AuthorizationCondition
- TempoTransactionCondition
- SolanaProgramInstructionCondition
- SolanaInstructionDataCondition
- SolanaSystemProgramInstructionCondition
- SolanaTokenProgramInstructionCondition
- SystemCondition
- TronTransactionCondition
- TronCalldataCondition
- XrplTransactionCondition
- SuiTransactionCommandCondition
- SuiTransferObjectsCommandCondition
- ActionRequestBodyCondition
- AggregationCondition
- MessageSigningCondition
Show child attributes
Show child attributes
Response
200 - application/json
Created aggregation object.
An aggregation that measures and tracks metrics over a period of time.
conditions
(EthereumTransactionCondition · object | EthereumCalldataCondition · object | EthereumTypedDataDomainCondition · object | EthereumTypedDataMessageCondition · object | Ethereum7702AuthorizationCondition · object | TempoTransactionCondition · object | SolanaProgramInstructionCondition · object | SolanaInstructionDataCondition · object | SolanaSystemProgramInstructionCondition · object | SolanaTokenProgramInstructionCondition · object | SystemCondition · object | TronTransactionCondition · object | TronCalldataCondition · object | XrplTransactionCondition · object | SuiTransactionCommandCondition · object | SuiTransferObjectsCommandCondition · object | ActionRequestBodyCondition · object | AggregationCondition · object | MessageSigningCondition · object)[]
Optional conditions to filter events before aggregation.
Maximum array length:
100The verbatim Ethereum transaction object in an eth_signTransaction or eth_sendTransaction request.
- EthereumTransactionCondition
- EthereumCalldataCondition
- EthereumTypedDataDomainCondition
- EthereumTypedDataMessageCondition
- Ethereum7702AuthorizationCondition
- TempoTransactionCondition
- SolanaProgramInstructionCondition
- SolanaInstructionDataCondition
- SolanaSystemProgramInstructionCondition
- SolanaTokenProgramInstructionCondition
- SystemCondition
- TronTransactionCondition
- TronCalldataCondition
- XrplTransactionCondition
- SuiTransactionCommandCondition
- SuiTransferObjectsCommandCondition
- ActionRequestBodyCondition
- AggregationCondition
- MessageSigningCondition
Show child attributes
Show child attributes
Was this page helpful?

