{
  "openapi": "3.1.1",
  "info": {
    "title": "TronGasAi API",
    "description": "Rent TRON energy and bandwidth programmatically: check prices, buy resources, run automations and receive webhooks.\n\nAuthenticate with an API key in the `X-Api-Key` header. Keys are scoped (`read` ⊆ `purchase` ⊆ `full`) and can carry a daily spend limit — see the Authentication guide.\n\nMoney amounts are strings in TRX (e.g. `\"5.502\"`), never floats. Errors are RFC 7807 `application/problem+json` with a machine-readable `code`.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://trongas.ai"
    }
  ],
  "paths": {
    "/api/v1/address-checker": {
      "get": {
        "tags": [
          "AddressChecker"
        ],
        "summary": "Check a TRON address's available energy and bandwidth",
        "description": "Live energy/bandwidth for any TRON address, read from the network (not our balance, not order-related). Public — no API key required. Returns 400 if `address` isn't a syntactically valid TRON address, 503 with code `address_checker.unavailable` if the upstream node is unreachable.",
        "operationId": "address-checker-get",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "description": "TRON address (`T…`, base58) to look up.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AddressCheckerResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressCheckerResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressCheckerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [ ]
      }
    },
    "/api/v1/automations/options": {
      "get": {
        "tags": [
          "Automations"
        ],
        "summary": "Get automation limits and durations",
        "description": "Allowed durations, the unit one transaction costs, and the min/max volume for auto-refill and auto-renewal rules. Call this instead of hardcoding limits — they change.",
        "operationId": "automations-options",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationOptionsResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationOptionsResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationOptionsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/automations": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Create an auto-refill rule (energy)",
        "description": "**Required API-key scope:** `purchase`\n\nKeep an address topped up: whenever its energy falls below `minimal`, `volume` energy is delivered for `duration`.\n\nEach delivery is charged to your TRX balance at your price — there is no prepaid budget. If the balance can no longer cover the next delivery the rule is paused automatically; set `autoResume` to have it come back by itself once you top up.\n\nEnergy only — bandwidth has no automations.\n\n503 `pricing.unavailable` — the price is temporarily unknown; no rule was created, retry shortly.",
        "operationId": "automations-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAutomationRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAutomationRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAutomationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Automations"
        ],
        "summary": "List your automation rules",
        "description": "All your rules, newest first — active, paused and cancelled. A paused rule carries the reason it was paused (`System` when we ran out of balance, `User` when you paused it yourself).",
        "operationId": "automations-list",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutomationResponse"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutomationResponse"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutomationResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/automations/renewal": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Create an auto-renewal rule (energy)",
        "description": "**Required API-key scope:** `purchase`\n\nRenew a fixed `volume` of energy on an address once a day, regardless of how much is left — unlike auto-refill, which reacts to a threshold.\n\nEach renewal is charged to your TRX balance at your price. Creating the rule requires enough balance for at least one renewal, otherwise 402 `wallet.insufficient_balance`. If the balance can no longer cover the next one the rule is paused; set `autoResume` to have it come back by itself once you top up.\n\nEnergy only.\n\n503 `pricing.unavailable` — the price is temporarily unknown; no rule was created, retry shortly.",
        "operationId": "automations-create-renewal",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRenewalRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRenewalRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRenewalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        }
      }
    },
    "/api/v1/automations/smart": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Enable smart mode (energy)",
        "description": "**Required API-key scope:** `purchase`\n\nHand the timing to the provider: it watches the address and delivers energy when it decides the address needs it, rather than on a threshold or a schedule.\n\nEach delivery is roughly 131k energy and is charged to your TRX balance at your price. Enabling requires enough balance for one delivery, otherwise 402 `wallet.insufficient_balance`. If the balance can no longer cover the next one the rule is paused; set `autoResume` to have it come back by itself once you top up.\n\nEnergy only.\n\n503 `pricing.unavailable` — the price is temporarily unknown; smart mode was not enabled, retry shortly.",
        "operationId": "automations-create-smart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSmartRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSmartRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSmartRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        }
      }
    },
    "/api/v1/automations/preview": {
      "get": {
        "tags": [
          "Automations"
        ],
        "summary": "Preview what one firing costs",
        "description": "What a single firing of a rule would cost at your price, in TRX. `type` is `refill` (default) or `smart`. Read-only — charges nothing and creates nothing. 503 `pricing.unavailable` while the price is temporarily unknown — retry shortly.",
        "operationId": "automations-preview",
        "parameters": [
          {
            "name": "volume",
            "in": "query",
            "description": "Amount of the resource: energy units or bandwidth bytes. Limits: see `GET /orders/options` (orders) or `GET /automations/options` (automations).",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int64"
            }
          },
          {
            "name": "duration",
            "in": "query",
            "description": "Rental period, e.g. `15m`, `1h`, `1d`. Allowed values per resource: see `GET /orders/options`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Automation kind: `refill` (default) or `smart`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationPreviewResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationPreviewResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationPreviewResponse"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        }
      }
    },
    "/api/v1/automations/{id}/fires": {
      "get": {
        "tags": [
          "Automations"
        ],
        "summary": "List a rule's firings",
        "description": "The rule's recent firings (up to 50, newest first) — what was delivered, when, and what you were charged for it. `billingPending: true` means the energy was delivered while the price was temporarily unknown: the charge is calculated and applied a few minutes later, once (until then `priceTrx` is `0`).",
        "operationId": "automations-fires",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutomationFireResponse"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutomationFireResponse"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutomationFireResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/automations/{id}/pause": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Pause a rule",
        "description": "**Required API-key scope:** `purchase`\n\nStop the rule from firing, keeping it around to resume later. Pausing this way records the reason as `User`, so auto-resume will not revive it — only you can. The status changes only once delivery has actually stopped: if we can't confirm that right now you get `502` `provider.upstream_error` and the rule stays `Active` — retry. Pausing an already paused rule returns it unchanged.",
        "operationId": "automations-pause",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "502": {
            "description": "Bad Gateway"
          }
        }
      }
    },
    "/api/v1/automations/{id}/resume": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Resume a paused rule",
        "description": "**Required API-key scope:** `purchase`\n\nPut a paused rule back to work. Requires enough TRX balance for one more firing, otherwise it would just pause again. If we can't confirm the restart right now you get `502` `provider.upstream_error` and the rule stays `Paused` — retry. Smart mode only: 503 `pricing.unavailable` if the price of one delivery is temporarily unknown — the rule stays `Paused`, retry shortly.",
        "operationId": "automations-resume",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "502": {
            "description": "Bad Gateway"
          },
          "503": {
            "description": "Service Unavailable"
          }
        }
      }
    },
    "/api/v1/automations/{id}/cancel": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Cancel a rule",
        "description": "**Required API-key scope:** `purchase`\n\nStop the rule for good. Unlike pause, this is final — a cancelled rule cannot be resumed, create a new one instead. The rule becomes `Canceled` only once delivery has actually stopped: if we can't confirm that right now you get `502` `provider.upstream_error` and the rule keeps its previous status (and keeps firing) — retry, retries are safe. Cancelling an already cancelled rule returns it unchanged.",
        "operationId": "automations-cancel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "502": {
            "description": "Bad Gateway"
          }
        }
      }
    },
    "/api/v1/notifications": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "List notifications",
        "description": "Your notifications, newest first, with total and unread counts. Fixed page size of 20. Notifications are raised by the platform — e.g. an order settling, a deposit crediting, or an automation being paused or resumed.",
        "operationId": "notifications-list",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number.",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationListResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationListResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/notifications/unread-count": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "Count unread notifications",
        "description": "Number of unread notifications. Cheap enough to poll for a badge.",
        "operationId": "notifications-unread-count",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UnreadCountResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnreadCountResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnreadCountResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/notifications/{id}/read": {
      "post": {
        "tags": [
          "Notifications"
        ],
        "summary": "Mark a notification as read",
        "operationId": "notifications-mark-read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      }
    },
    "/api/v1/notifications/read-all": {
      "post": {
        "tags": [
          "Notifications"
        ],
        "summary": "Mark all notifications as read",
        "operationId": "notifications-mark-all-read",
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      }
    },
    "/api/v1/orders/options": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get order limits and durations",
        "description": "What you may order: per resource (`energy`, `bandwidth`) the allowed durations, the unit one transaction costs, and the min/max volume. Also the maximum address-activation fee. Call this instead of hardcoding limits — they change.",
        "operationId": "orders-options",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/OrderOptionsResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderOptionsResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderOptionsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/preview": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Preview an order's cost",
        "description": "Price an order before placing it: resource price, the address-activation fee if `target` is not activated yet, the estimated saving versus burning TRX (energy only), and your current TRX balance. Read-only — charges nothing. `resource` is `energy` (default) or `bandwidth`. 503 `pricing.unavailable` while the price is temporarily unknown — retry shortly.",
        "operationId": "orders-preview",
        "parameters": [
          {
            "name": "volume",
            "in": "query",
            "description": "Amount of the resource: energy units or bandwidth bytes. Limits: see `GET /orders/options` (orders) or `GET /automations/options` (automations).",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int64"
            }
          },
          {
            "name": "days",
            "in": "query",
            "description": "Rental period (despite the name): `15m`, `1h` or `1d`. Same values as `duration` elsewhere; see `GET /orders/options`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resource",
            "in": "query",
            "description": "`energy` or `bandwidth`. Defaults to `energy` where optional.",
            "schema": {
              "enum": [
                "energy",
                "bandwidth"
              ],
              "type": "string"
            }
          },
          {
            "name": "target",
            "in": "query",
            "description": "Recipient TRON address (`T…`). Lets the preview include the exact address-activation fee.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPreviewResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPreviewResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPreviewResponse"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        }
      }
    },
    "/api/v1/orders": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Place an order",
        "description": "**Required API-key scope:** `purchase`\n\nBuy energy or bandwidth for an address, paid from your TRX balance.\n\nRequires an `Idempotency-Key` header: retrying with the same key returns the original order instead of charging twice — always send one, and reuse it on retry.\n\nThe order settles asynchronously; it is `Created` on return and becomes `Filled` once the provider delivers. Subscribe to the `order.filled` / `order.failed` webhooks rather than polling.\n\n402 `wallet.insufficient_balance` — not enough TRX. 502 — provider failed and your balance was refunded. 503 `pricing.unavailable` — the price is temporarily unknown: nothing was charged and no order was created, so retry shortly with the same `Idempotency-Key`.",
        "operationId": "orders-create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Unique string per logical order (e.g. a UUID). Retrying with the same key returns the original order instead of charging twice. Required.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "List your orders",
        "description": "Your order history, newest first. Paginate with `page` and `pageSize` (max 100).",
        "operationId": "orders-list",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number.",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Items per page (max 100).",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPage"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPage"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPage"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/stats": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get your order stats",
        "description": "Headline numbers for your account: total orders placed, energy delivered in the current calendar month, all-time energy and bandwidth delivered, and the average price you paid per unit in SUN (null until the first delivery). `energyDaily` and `bandwidthDaily` hold the volume delivered on each of the last 14 UTC days, oldest first, ending with today.",
        "operationId": "orders-stats",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/OrderStatsResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderStatsResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderStatsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/energy-usage": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get your energy usage",
        "description": "Energy delivered to your addresses over time, split into consecutive intervals for charting: one-time orders that were filled plus every automation delivery. `range` accepts `24h`, `1w`, `1M` (default), `3M`, `1Y` or `all`; the interval length depends on the range and is returned as `bucketSeconds`.",
        "operationId": "orders-energy-usage",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "description": "Time range of the series: `24h`, `1w`, `1M` (default), `3M`, `1Y` or `all`.",
            "schema": {
              "type": "string",
              "default": "1M"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyUsageResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyUsageResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyUsageResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{id}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get an order",
        "description": "Fetch one of your orders by id. 404 if it does not exist or belongs to someone else.",
        "operationId": "orders-get-by-id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pricing": {
      "get": {
        "tags": [
          "Pricing"
        ],
        "summary": "Get the current energy price",
        "description": "Current energy price in TRX. Public — no API key required. Returns 503 with code `pricing.unavailable` while the upstream price source is unreachable.",
        "operationId": "pricing-get",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PricingResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingResponse"
                }
              }
            }
          }
        },
        "security": [ ]
      }
    },
    "/api/v1/pricing/list": {
      "get": {
        "tags": [
          "Pricing"
        ],
        "summary": "List prices per resource and duration",
        "description": "Storefront price list: for each resource, the price of one real-world unit (65,000 Energy — one USDT transfer to an existing holder; 1,000 Bandwidth — our minimum sellable volume) broken down by rental duration (`15m`/`1h`/`1d`). `priceTrx` is the live provider price with **no commission** — anonymous endpoints don't disclose our per-transaction fee; the itemized total is only shown to the authenticated owner of an order/automation preview. Per-user individual prices are not applied here. Public — no API key required.",
        "operationId": "pricing-list",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PriceListResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceListResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceListResponse"
                }
              }
            }
          }
        },
        "security": [ ]
      }
    },
    "/api/v1/pricing/quote": {
      "get": {
        "tags": [
          "Pricing"
        ],
        "summary": "Get an exact price quote for a resource, volume and duration",
        "description": "Exact price (TRX) for a specific `resource` (`energy`/`bandwidth`), `volume` and `duration` (`15m`/`1h`/`1d`) — same formula as a real order. `priceTrx` is the live provider price with **no commission** — anonymous endpoints don't disclose our per-transaction fee; the itemized total is only shown to the authenticated owner of an order/automation preview. Per-user individual prices are not applied here (anonymous). Public — no API key required. 503 `pricing.unavailable` while the price is temporarily unknown (never a zero price).",
        "operationId": "pricing-quote",
        "parameters": [
          {
            "name": "resource",
            "in": "query",
            "description": "`energy` or `bandwidth`. Defaults to `energy` where optional.",
            "required": true,
            "schema": {
              "enum": [
                "energy",
                "bandwidth"
              ],
              "type": "string"
            }
          },
          {
            "name": "duration",
            "in": "query",
            "description": "Rental period, e.g. `15m`, `1h`, `1d`. Allowed values per resource: see `GET /orders/options`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "volume",
            "in": "query",
            "description": "Amount of the resource: energy units or bandwidth bytes. Limits: see `GET /orders/options` (orders) or `GET /automations/options` (automations).",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PriceQuoteResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceQuoteResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceQuoteResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        },
        "security": [ ]
      }
    },
    "/api/v1/pricing/modes": {
      "get": {
        "tags": [
          "Pricing"
        ],
        "summary": "Get the smart mode price",
        "description": "Price of one smart-mode delivery (energy only) — no rental duration, a different unit than `/list` (one delivery, ~131,000 energy). `null` if no price is configured or it is temporarily unavailable (never a zero price). Public — no API key required.",
        "operationId": "pricing-modes",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PricingModesResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingModesResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingModesResponse"
                }
              }
            }
          }
        },
        "security": [ ]
      }
    },
    "/api/v1/pricing/history": {
      "get": {
        "tags": [
          "Pricing"
        ],
        "summary": "Get price history",
        "description": "Price history for charting. `range` accepts `1h`, `24h` (default), `7d` or `30d`. Public — no API key required.",
        "operationId": "pricing-history",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "description": "Time range of the series: `24h`, `1w`, `1M` (default), `3M`, `1Y` or `all`.",
            "schema": {
              "type": "string",
              "default": "24h"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PriceHistoryResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceHistoryResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceHistoryResponse"
                }
              }
            }
          }
        },
        "security": [ ]
      }
    },
    "/api/v1/rate": {
      "get": {
        "tags": [
          "Rate"
        ],
        "summary": "Get the TRX→USD rate",
        "description": "Current TRX→USD rate as a string. Returns \"0\" when the upstream source is unavailable. Public — no API key required.",
        "operationId": "rate-get",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/RateResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateResponse"
                }
              }
            }
          }
        },
        "security": [ ]
      }
    },
    "/api/v1/wallet/balance": {
      "get": {
        "tags": [
          "Wallet"
        ],
        "summary": "Get your balance",
        "description": "Your USDT-TRC20 and TRX balances. Orders and automations are always paid from the TRX balance.",
        "operationId": "wallet-balance",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallet/deposit-address": {
      "get": {
        "tags": [
          "Wallet"
        ],
        "summary": "Get your deposit address",
        "description": "Your personal TRC20 deposit address plus the minimum deposit per currency. The address is created on first call and stays stable afterwards.",
        "operationId": "wallet-deposit-address",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/DepositAddressResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositAddressResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositAddressResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallet/transactions": {
      "get": {
        "tags": [
          "Wallet"
        ],
        "summary": "List balance transactions",
        "description": "Your ledger history, newest first. Paginate with `page` and `pageSize` (max 100). Optional filters: `type` (e.g. `Deposit`) and `currency` (`USDT-TRC20` or `TRX`). Order charges and refunds carry the order `resource` (`energy` or `bandwidth`); other entries have `resource: null`.",
        "operationId": "wallet-transactions",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number.",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Items per page (max 100).",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Automation kind: `refill` (default) or `smart`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "Filter by currency: `TRX` or `USDT-TRC20`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionPage"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionPage"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionPage"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks/events": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List subscribable event types",
        "description": "Event types you can subscribe an endpoint to. Call this rather than hardcoding the list — it grows.",
        "operationId": "webhooks-events",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEventTypesResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEventTypesResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEventTypesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Register a webhook endpoint",
        "description": "**Required API-key scope:** `full`\n\nSubscribe an HTTPS URL to the events you pick, so you learn about orders settling, deposits crediting and rules pausing without polling.\n\nThe response includes the signing secret — **it is shown once and never again**. Store it now; if you lose it, rotate.\n\nUse the secret to verify the `X-TronGas-Signature` header on every delivery.",
        "operationId": "webhooks-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreatedResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreatedResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreatedResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List your webhook endpoints",
        "description": "Your registered endpoints. Secrets are never returned here — only once at creation and at rotation.",
        "operationId": "webhooks-list",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointResponse"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointResponse"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks/{id}/enable": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Enable an endpoint",
        "description": "**Required API-key scope:** `full`\n\nResume deliveries to a disabled endpoint.",
        "operationId": "webhooks-enable",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks/{id}/disable": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Disable an endpoint",
        "description": "**Required API-key scope:** `full`\n\nPause deliveries without deleting the endpoint or losing its secret — useful while your receiver is down.",
        "operationId": "webhooks-disable",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks/{id}/rotate-secret": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate an endpoint's signing secret",
        "description": "**Required API-key scope:** `full`\n\nIssue a new signing secret and invalidate the old one. Returns the new secret — **shown once**.\n\nDeliveries signed with the old secret stop verifying immediately, so update your receiver promptly.",
        "operationId": "webhooks-rotate",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/RotatedSecretResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotatedSecretResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotatedSecretResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks/{id}/ping": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a test event",
        "description": "**Required API-key scope:** `full`\n\nQueue a `webhook.ping` delivery so you can check your receiver and your signature verification end to end. Check the result in the endpoint's delivery log.",
        "operationId": "webhooks-ping",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      }
    },
    "/api/v1/webhooks/{id}": {
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete an endpoint",
        "description": "**Required API-key scope:** `full`\n\nRemove the endpoint and stop delivering to it. To pause temporarily, disable it instead — deleting loses the secret.",
        "operationId": "webhooks-delete",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      }
    },
    "/api/v1/webhooks/{id}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List an endpoint's deliveries",
        "description": "Recent delivery attempts with their response status and retry count — the place to look when events are not arriving.",
        "operationId": "webhooks-deliveries",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id (UUID).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookDeliveryResponse"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookDeliveryResponse"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookDeliveryResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/whoami": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Check your API key",
        "description": "Name, scope (`read` / `purchase` / `full`), daily spend limit and how much of it is spent today (UTC) for the API key used on this request. Call it first: a 401 means the key is wrong or revoked; otherwise you know what the key may do before trying. Charges nothing.",
        "operationId": "account-get",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WhoAmIResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WhoAmIResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WhoAmIResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AddressCheckerResponse": {
        "required": [
          "address",
          "activated",
          "energyLimit",
          "energyUsed",
          "energyAvailable",
          "bandwidthLimit",
          "bandwidthUsed",
          "bandwidthAvailable"
        ],
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "activated": {
            "type": "boolean"
          },
          "energyLimit": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "energyUsed": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "energyAvailable": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "bandwidthLimit": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "bandwidthUsed": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "bandwidthAvailable": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          }
        }
      },
      "AutomationFireResponse": {
        "required": [
          "volume",
          "duration",
          "priceTrx",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "volume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "duration": {
            "type": [
              "null",
              "string"
            ]
          },
          "priceTrx": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "billingPending": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "AutomationOptionsResponse": {
        "required": [
          "durations",
          "energyUnit",
          "minVolume",
          "maxVolume",
          "renewalMinVolume",
          "renewalMaxVolume"
        ],
        "type": "object",
        "properties": {
          "durations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "energyUnit": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "minVolume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "maxVolume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "renewalMinVolume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "renewalMaxVolume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          }
        }
      },
      "AutomationPreviewResponse": {
        "required": [
          "priceTrx",
          "baseCostTrx",
          "commissionTrx"
        ],
        "type": "object",
        "properties": {
          "priceTrx": {
            "type": "string"
          },
          "baseCostTrx": {
            "type": "string"
          },
          "commissionTrx": {
            "type": "string"
          }
        }
      },
      "AutomationResponse": {
        "required": [
          "id",
          "type",
          "resource",
          "targetAddress",
          "minimal",
          "volume",
          "duration",
          "spentTrx",
          "status",
          "pauseReason",
          "autoResume",
          "createdAt",
          "updatedAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "resource": {
            "type": "string"
          },
          "targetAddress": {
            "type": "string"
          },
          "minimal": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "volume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "duration": {
            "type": [
              "null",
              "string"
            ]
          },
          "spentTrx": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "pauseReason": {
            "type": [
              "null",
              "string"
            ]
          },
          "autoResume": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BalanceResponse": {
        "required": [
          "usdtTrc20",
          "trx"
        ],
        "type": "object",
        "properties": {
          "usdtTrc20": {
            "type": "string"
          },
          "trx": {
            "type": "string"
          }
        }
      },
      "CreateAutomationRequest": {
        "required": [
          "targetAddress",
          "minimal",
          "volume",
          "duration"
        ],
        "type": "object",
        "properties": {
          "targetAddress": {
            "type": "string"
          },
          "minimal": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "volume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "duration": {
            "type": "string"
          },
          "autoResume": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "CreateOrderRequest": {
        "required": [
          "targetAddress",
          "duration"
        ],
        "type": "object",
        "properties": {
          "resource": {
            "maxLength": 16,
            "type": [
              "null",
              "string"
            ]
          },
          "targetAddress": {
            "maxLength": 64,
            "type": "string"
          },
          "volume": {
            "maximum": 9223372036854776000,
            "minimum": 1,
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "duration": {
            "maxLength": 16,
            "type": "string"
          }
        }
      },
      "CreateRenewalRequest": {
        "required": [
          "targetAddress",
          "volume"
        ],
        "type": "object",
        "properties": {
          "targetAddress": {
            "type": "string"
          },
          "volume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "autoResume": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "CreateSmartRequest": {
        "required": [
          "targetAddress"
        ],
        "type": "object",
        "properties": {
          "targetAddress": {
            "type": "string"
          },
          "autoResume": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "CreateWebhookRequest": {
        "required": [
          "url",
          "events"
        ],
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "events": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DepositAddressResponse": {
        "required": [
          "network",
          "address",
          "minimums"
        ],
        "type": "object",
        "properties": {
          "network": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "minimums": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DepositMinimum"
            }
          }
        }
      },
      "DepositMinimum": {
        "required": [
          "currency",
          "amount"
        ],
        "type": "object",
        "properties": {
          "currency": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          }
        }
      },
      "EnergyUsagePoint": {
        "required": [
          "t",
          "energy",
          "trx"
        ],
        "type": "object",
        "properties": {
          "t": {
            "type": "string",
            "format": "date-time"
          },
          "energy": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "trx": {
            "type": "string"
          }
        }
      },
      "EnergyUsageResponse": {
        "required": [
          "range",
          "bucketSeconds",
          "points"
        ],
        "type": "object",
        "properties": {
          "range": {
            "type": "string"
          },
          "bucketSeconds": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnergyUsagePoint"
            }
          }
        }
      },
      "NotificationListResponse": {
        "required": [
          "items",
          "page",
          "pageSize",
          "total",
          "unread"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotificationResponse"
            }
          },
          "page": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "pageSize": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "total": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "unread": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "NotificationResponse": {
        "required": [
          "id",
          "type",
          "level",
          "title",
          "body",
          "link",
          "read",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "level": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "link": {
            "type": [
              "null",
              "string"
            ]
          },
          "read": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OrderOptionsResponse": {
        "required": [
          "resources",
          "activationMaxTrx"
        ],
        "type": "object",
        "properties": {
          "resources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResourceOptions"
            }
          },
          "activationMaxTrx": {
            "type": "string"
          }
        }
      },
      "OrderPage": {
        "required": [
          "items",
          "page",
          "pageSize",
          "total"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderResponse"
            }
          },
          "page": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "pageSize": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "total": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "OrderPreviewResponse": {
        "required": [
          "priceTrx",
          "baseCostTrx",
          "commissionTrx",
          "activationTrx",
          "burnCostTrx",
          "savingsPercent",
          "balanceTrx"
        ],
        "type": "object",
        "properties": {
          "priceTrx": {
            "type": "string"
          },
          "baseCostTrx": {
            "type": "string"
          },
          "commissionTrx": {
            "type": "string"
          },
          "activationTrx": {
            "type": "string"
          },
          "burnCostTrx": {
            "type": "string"
          },
          "savingsPercent": {
            "type": "string"
          },
          "balanceTrx": {
            "type": "string"
          }
        }
      },
      "OrderResponse": {
        "required": [
          "id",
          "resource",
          "targetAddress",
          "volume",
          "duration",
          "priceTrx",
          "activationTrx",
          "totalTrx",
          "status",
          "txId",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "resource": {
            "type": "string"
          },
          "targetAddress": {
            "type": "string"
          },
          "volume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "duration": {
            "type": "string"
          },
          "priceTrx": {
            "type": "string"
          },
          "activationTrx": {
            "type": "string"
          },
          "totalTrx": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "txId": {
            "type": [
              "null",
              "string"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OrderStatsResponse": {
        "required": [
          "totalOrders",
          "energyDeliveredThisMonth",
          "energyDelivered",
          "energyAvgSunPerUnit",
          "bandwidthDelivered",
          "bandwidthAvgSunPerUnit",
          "energyDaily",
          "bandwidthDaily"
        ],
        "type": "object",
        "properties": {
          "totalOrders": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "energyDeliveredThisMonth": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "energyDelivered": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "energyAvgSunPerUnit": {
            "type": [
              "null",
              "string"
            ]
          },
          "bandwidthDelivered": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "bandwidthAvgSunPerUnit": {
            "type": [
              "null",
              "string"
            ]
          },
          "energyDaily": {
            "type": "array",
            "items": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int64"
            }
          },
          "bandwidthDaily": {
            "type": "array",
            "items": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int64"
            }
          }
        }
      },
      "PriceHistoryResponse": {
        "required": [
          "range",
          "points"
        ],
        "type": "object",
        "properties": {
          "range": {
            "type": "string"
          },
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricePoint"
            }
          }
        }
      },
      "PriceListDuration": {
        "required": [
          "duration",
          "priceTrx"
        ],
        "type": "object",
        "properties": {
          "duration": {
            "type": "string"
          },
          "priceTrx": {
            "type": "string"
          }
        }
      },
      "PriceListItem": {
        "required": [
          "resource",
          "unitVolume",
          "durations"
        ],
        "type": "object",
        "properties": {
          "resource": {
            "type": "string"
          },
          "unitVolume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "durations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PriceListDuration"
            }
          }
        }
      },
      "PriceListResponse": {
        "required": [
          "items"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PriceListItem"
            }
          }
        }
      },
      "PricePoint": {
        "required": [
          "t",
          "pricePer100kTrx"
        ],
        "type": "object",
        "properties": {
          "t": {
            "type": "string",
            "format": "date-time"
          },
          "pricePer100kTrx": {
            "type": "string"
          }
        }
      },
      "PriceQuoteResponse": {
        "required": [
          "priceTrx"
        ],
        "type": "object",
        "properties": {
          "priceTrx": {
            "type": "string"
          }
        }
      },
      "PricingModesResponse": {
        "required": [
          "smart"
        ],
        "type": "object",
        "properties": {
          "smart": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PublicSmartModeItem"
              }
            ]
          }
        }
      },
      "PricingResponse": {
        "required": [
          "unitPriceSun",
          "pricePer100kTrx",
          "trxUsdRate",
          "burnCostTrx",
          "source",
          "asOf"
        ],
        "type": "object",
        "properties": {
          "unitPriceSun": {
            "type": "string"
          },
          "pricePer100kTrx": {
            "type": "string"
          },
          "trxUsdRate": {
            "type": "string"
          },
          "burnCostTrx": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "asOf": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "detail": {
            "type": [
              "null",
              "string"
            ]
          },
          "instance": {
            "type": [
              "null",
              "string"
            ]
          },
          "code": {
            "type": [
              "null",
              "string"
            ],
            "description": "Machine-readable error code, e.g. `wallet.insufficient_balance`. Branch on this, not on `title`. Always present: `validation_failed` for request validation (400, with per-field `errors`), `unauthorized` for 401, domain codes otherwise."
          }
        }
      },
      "PublicSmartModeItem": {
        "required": [
          "unitVolume",
          "priceTrx"
        ],
        "type": "object",
        "properties": {
          "unitVolume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "priceTrx": {
            "type": "string"
          }
        }
      },
      "RateResponse": {
        "required": [
          "trxUsdRate"
        ],
        "type": "object",
        "properties": {
          "trxUsdRate": {
            "type": "string"
          }
        }
      },
      "ResourceOptions": {
        "required": [
          "resource",
          "durations",
          "unit",
          "minVolume",
          "maxVolume"
        ],
        "type": "object",
        "properties": {
          "resource": {
            "type": "string"
          },
          "durations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unit": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "minVolume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "maxVolume": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          }
        }
      },
      "RotatedSecretResponse": {
        "required": [
          "secret"
        ],
        "type": "object",
        "properties": {
          "secret": {
            "type": "string"
          }
        }
      },
      "TransactionDto": {
        "required": [
          "id",
          "type",
          "currency",
          "amount",
          "txId",
          "status",
          "createdAt",
          "resource"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          },
          "txId": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "resource": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "TransactionPage": {
        "required": [
          "items",
          "page",
          "pageSize",
          "total"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TransactionDto"
            }
          },
          "page": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "pageSize": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "total": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "UnreadCountResponse": {
        "required": [
          "unread"
        ],
        "type": "object",
        "properties": {
          "unread": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "WebhookCreatedResponse": {
        "required": [
          "endpoint",
          "secret"
        ],
        "type": "object",
        "properties": {
          "endpoint": {
            "$ref": "#/components/schemas/WebhookEndpointResponse"
          },
          "secret": {
            "type": "string"
          }
        }
      },
      "WebhookDeliveryResponse": {
        "required": [
          "id",
          "eventType",
          "status",
          "attempts",
          "lastResponseCode",
          "lastError",
          "createdAt",
          "deliveredAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "eventType": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "attempts": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "lastResponseCode": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "lastError": {
            "type": [
              "null",
              "string"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "deliveredAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "WebhookEndpointResponse": {
        "required": [
          "id",
          "url",
          "events",
          "enabled",
          "lastStatus",
          "lastDeliveryAt",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "lastStatus": {
            "type": [
              "null",
              "string"
            ]
          },
          "lastDeliveryAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookEventTypesResponse": {
        "required": [
          "events"
        ],
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "WhoAmIResponse": {
        "required": [
          "name",
          "prefix",
          "scope",
          "maxSpendPerDayTrx",
          "spentTodayTrx",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "maxSpendPerDayTrx": {
            "type": [
              "null",
              "string"
            ]
          },
          "spentTodayTrx": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "description": "API key issued in the dashboard (dashboard → API keys, https://trongas.ai/dashboard/api-keys).",
        "name": "X-Api-Key",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "ApiKey": [ ]
    }
  ],
  "tags": [
    {
      "name": "AddressChecker"
    },
    {
      "name": "Automations"
    },
    {
      "name": "Notifications"
    },
    {
      "name": "Orders"
    },
    {
      "name": "Pricing"
    },
    {
      "name": "Rate"
    },
    {
      "name": "Wallet"
    },
    {
      "name": "WebhookEndpoints"
    },
    {
      "name": "WhoAmI"
    }
  ]
}