Creating a Monitor

This guide explains how to create and configure a monitor for real-time blockchain event monitoring using Crypitor's API and curl commands.

Step 1: Create a Monitor

To create a monitor, use the following curl command:

curl -X 'POST' \
  'http://localhost:3000/monitor' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "projectId": "DefaultProject",
  "network": "Ethereum",
  "condition": {
    "native": true,
    "internal": false,
    "erc721": true,
    "erc20": true,
    "specific": false,
    "cryptos": {
      "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174": true
    }
  },
  "notification": {
    "method": "Webhook",
    "url": "https://example.com",
    "authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA==",
    "secretToken": ""
  },
  "type": "all",
  "note": "My crypitor monitoring",
  "tags": [
      "Hello",
      "Crypitor"
  ],
  "name": "My First Monitor"
}'

Response:

On successful creation, the response will include details about the monitor:

{
  "code": 0,
  "message": "OK",
  "data": {
    "projectId": "DefaultProject",
    "monitorId": "mo_AAGBUxOjyqbCYjt8",
    "network": "Ethereum",
    "name": "My First Monitor",
    "condition": {
      "native": true,
      "internal": false,
      "erc721": true,
      "erc20": true,
      "specific": false,
      "cryptos": {
        "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174": true
      }
    },
    "notification": {
      "method": "Webhook",
      "url": "https://example.com",
      "authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
    },
    "type": "all",
    "note": "My crypitor monitoring",
    "tags": [
      "Hello",
      "Crypitor"
    ],
    "dateCreated": "2024-06-11T08:19:17.975Z",
    "disabled": false,
    "addressCount": 0,
    "webhookCount": 0
  }
}

Step 2: Add an Address to the Monitor

After creating the monitor, you can add addresses to it using the monitor ID from the previous response. Use the following curl command to add an address:

curl -X 'POST' \
  'http://localhost:3002/address' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "monitorId": "mo_AAGBUxOjyqbCYjt8",
  "addresses": [
    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
  ]
}'

Response

{
  "code": 0,
  "message": "OK",
  "data": [
    {
      "monitorId": "mo_AAGBUxOjyqbCYjt8",
      "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "network": "Ethereum",
      "dateCreated": "2024-06-11T08:24:24.691Z"
    }
  ]
}

Last updated