Add Trigger

Create a new trigger to monitor a pool for specific market conditions.

Endpoint

POST https://enterprise.guardis.io/v1/triggers/add

Authentication

Include your API key in the X-API-Key header.

X-API-Key: your_api_key_here

Request Body

{
  "trigger_id": "my-unique-trigger-001",
  "pair_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
  "conditions": [
    {
      "field": "total_volume_usd",
      "operator": "gt",
      "value": "100000"
    },
    {
      "field": "sol_amount",
      "operator": "lt",
      "value": "500"
    }
  ]
}
Field
Type
Required
Description

trigger_id

string

Yes

Your unique identifier for this trigger (max 64 characters)

pair_address

string

Yes

The on-chain address of the liquidity pool to monitor

conditions

array

Yes

One or more conditions that must be met to fire the trigger

Condition Object

Field
Type
Required
Description

field

string

Yes

The pool metric to monitor

operator

string

Yes

Comparison operator: gt (greater than) or lt (less than)

value

string

Yes

Threshold value for the condition

Note: When multiple conditions are specified, ALL conditions must be met for the trigger to fire (AND logic).

Available Fields

Field
Type
Description

sol_amount

decimal

Amount of SOL currently in the pool

token_amount

decimal

Amount of tokens currently in the pool

number_of_buys

integer

Total buy transactions on the pool

number_of_sells

integer

Total sell transactions on the pool

buy_volume_usd

decimal

Cumulative buy volume in USD

sell_volume_usd

decimal

Cumulative sell volume in USD

total_volume_usd

decimal

Total trading volume in USD


Example Request

curl -X POST "https://enterprise.guardis.io/v1/triggers/add" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "trigger_id": "my-unique-trigger-001",
    "pair_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "conditions": [
      {
        "field": "total_volume_usd",
        "operator": "gt",
        "value": "100000"
      }
    ]
  }'

Response

Success (201 Created)

{
  "trigger_id": "my-unique-trigger-001",
  "pair_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
  "conditions": [
    {
      "field": "total_volume_usd",
      "operator": "gt",
      "value": "100000"
    }
  ],
  "status": "active",
  "created_at": "2025-01-15T14:32:08.000Z"
}

Example Usage

JavaScript:

const response = await fetch("https://enterprise.guardis.io/v1/triggers/add", {
  method: "POST",
  headers: {
    "X-API-Key": "your_api_key_here",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    trigger_id: "volume-alert-001",
    pair_address: "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    conditions: [
      { field: "total_volume_usd", operator: "gt", value: "100000" },
      { field: "sol_amount", operator: "lt", value: "500" }
    ]
  })
});

const trigger = await response.json();
console.log(`Trigger created: ${trigger.trigger_id}`);

Python:

import requests

response = requests.post(
    "https://enterprise.guardis.io/v1/triggers/add",
    headers={
        "X-API-Key": "your_api_key_here",
        "Content-Type": "application/json"
    },
    json={
        "trigger_id": "volume-alert-001",
        "pair_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
        "conditions": [
            {"field": "total_volume_usd", "operator": "gt", "value": "100000"},
            {"field": "sol_amount", "operator": "lt", "value": "500"}
        ]
    }
)

trigger = response.json()
print(f"Trigger created: {trigger['trigger_id']}")

Error Responses

Status Code
Description

400

Invalid request body or missing required fields

401

Missing or invalid API key

409

Trigger with this ID already exists

422

Invalid field name, operator, or value format

500

Internal server error

{
  "code": 409,
  "message": "Trigger with ID 'my-unique-trigger-001' already exists"
}
{
  "code": 422,
  "message": "Invalid field 'invalid_field'. Valid fields: sol_amount, token_amount, number_of_buys, number_of_sells, buy_volume_usd, sell_volume_usd, total_volume_usd"
}

Last updated