{
  "openapi": "3.1.1",
  "info": {
    "title": "Rentron Energy API",
    "description": "Production TRON Energy rental API. Sign the exact method, path, query and body bytes with HMAC-SHA256.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.rentron.xyz"
    }
  ],
  "paths": {
    "/v1/time": {
      "get": {
        "tags": [
          "Energy API v1"
        ],
        "operationId": "RentronEnergyApiTime",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyApiTimeResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/balance": {
      "get": {
        "tags": [
          "Energy API v1"
        ],
        "operationId": "RentronEnergyApiBalance",
        "parameters": [
          {
            "name": "X-Request-Timestamp",
            "in": "header",
            "description": "Unix timestamp in seconds. Must be within five minutes of server time.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyApiBalanceResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "HmacSha256": [ ]
          }
        ]
      }
    },
    "/v1/energy/options": {
      "get": {
        "tags": [
          "Energy API v1"
        ],
        "operationId": "RentronEnergyApiOptions",
        "parameters": [
          {
            "name": "X-Request-Timestamp",
            "in": "header",
            "description": "Unix timestamp in seconds. Must be within five minutes of server time.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyApiOptionsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "HmacSha256": [ ]
          }
        ]
      }
    },
    "/v1/energy/quotes": {
      "post": {
        "tags": [
          "Energy API v1"
        ],
        "operationId": "RentronEnergyApiQuote",
        "parameters": [
          {
            "name": "X-Request-Timestamp",
            "in": "header",
            "description": "Unix timestamp in seconds. Must be within five minutes of server time.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEnergyApiQuoteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyApiQuoteResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "413": {
            "description": "Payload Too Large",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "HmacSha256": [ ]
          }
        ]
      }
    },
    "/v1/energy/orders": {
      "post": {
        "tags": [
          "Energy API v1"
        ],
        "operationId": "RentronEnergyApiCreateOrder",
        "parameters": [
          {
            "name": "X-Request-Timestamp",
            "in": "header",
            "description": "Unix timestamp in seconds. Must be within five minutes of server time.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEnergyApiOrderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyApiOrderResponse"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyApiOrderResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "413": {
            "description": "Payload Too Large",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "HmacSha256": [ ]
          }
        ]
      },
      "get": {
        "tags": [
          "Energy API v1"
        ],
        "operationId": "RentronEnergyApiListOrders",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Request-Timestamp",
            "in": "header",
            "description": "Unix timestamp in seconds. Must be within five minutes of server time.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyApiOrderListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "HmacSha256": [ ]
          }
        ]
      }
    },
    "/v1/energy/orders/{id}": {
      "get": {
        "tags": [
          "Energy API v1"
        ],
        "operationId": "RentronEnergyApiGetOrder",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Request-Timestamp",
            "in": "header",
            "description": "Unix timestamp in seconds. Must be within five minutes of server time.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyApiOrderResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "HmacSha256": [ ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ApiProblemDetails": {
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code"
        ],
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "format": "int32"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "field": {
            "type": [
              "null",
              "string"
            ]
          },
          "errors": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ApiProblemError"
            }
          }
        }
      },
      "ApiProblemError": {
        "required": [
          "code",
          "field",
          "message"
        ],
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "field": {
            "type": [
              "null",
              "string"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "CreateEnergyApiOrderRequest": {
        "required": [
          "client_request_id",
          "address",
          "energy",
          "duration_hours",
          "expected_total_trx"
        ],
        "type": "object",
        "properties": {
          "client_request_id": {
            "type": [
              "null",
              "string"
            ]
          },
          "address": {
            "type": [
              "null",
              "string"
            ]
          },
          "energy": {
            "type": "integer",
            "format": "int64"
          },
          "duration_hours": {
            "type": "integer",
            "format": "int32"
          },
          "expected_total_trx": {
            "pattern": "^[0-9]+\\.[0-9]{6}$",
            "type": [
              "null",
              "string"
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateEnergyApiQuoteRequest": {
        "required": [
          "address",
          "energy",
          "duration_hours"
        ],
        "type": "object",
        "properties": {
          "address": {
            "type": [
              "null",
              "string"
            ]
          },
          "energy": {
            "type": "integer",
            "format": "int64"
          },
          "duration_hours": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "EnergyApiBalanceResponse": {
        "required": [
          "available_trx",
          "held_trx",
          "status"
        ],
        "type": "object",
        "properties": {
          "available_trx": {
            "pattern": "^\\d+\\.\\d{6}$",
            "type": "string"
          },
          "held_trx": {
            "pattern": "^\\d+\\.\\d{6}$",
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "EnergyApiOptionsResponse": {
        "required": [
          "energy_per_portion",
          "max_energy",
          "duration_hours",
          "intake_enabled"
        ],
        "type": "object",
        "properties": {
          "energy_per_portion": {
            "type": "integer",
            "format": "int64"
          },
          "max_energy": {
            "type": "integer",
            "format": "int64"
          },
          "duration_hours": {
            "type": "array",
            "items": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          "intake_enabled": {
            "type": "boolean"
          }
        }
      },
      "EnergyApiOrderFailureResponse": {
        "required": [
          "code",
          "message"
        ],
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "EnergyApiOrderListResponse": {
        "required": [
          "items",
          "next_cursor"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnergyApiOrderResponse"
            }
          },
          "next_cursor": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "EnergyApiOrderResponse": {
        "required": [
          "id",
          "client_request_id",
          "address",
          "energy",
          "duration_hours",
          "total_trx",
          "status",
          "lifecycle_final",
          "delivery_final",
          "created_at",
          "updated_at",
          "failure"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "client_request_id": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "energy": {
            "type": "integer",
            "format": "int64"
          },
          "duration_hours": {
            "type": "integer",
            "format": "int32"
          },
          "total_trx": {
            "pattern": "^\\d+\\.\\d{6}$",
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "lifecycle_final": {
            "type": "boolean"
          },
          "delivery_final": {
            "type": "boolean"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          },
          "failure": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/EnergyApiOrderFailureResponse"
              }
            ]
          }
        }
      },
      "EnergyApiQuoteResponse": {
        "required": [
          "address",
          "energy",
          "duration_hours",
          "energy_trx",
          "activation_trx",
          "total_trx",
          "can_afford"
        ],
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "energy": {
            "type": "integer",
            "format": "int64"
          },
          "duration_hours": {
            "type": "integer",
            "format": "int32"
          },
          "energy_trx": {
            "pattern": "^\\d+\\.\\d{6}$",
            "type": "string"
          },
          "activation_trx": {
            "pattern": "^\\d+\\.\\d{6}$",
            "type": [
              "null",
              "string"
            ]
          },
          "total_trx": {
            "pattern": "^\\d+\\.\\d{6}$",
            "type": "string"
          },
          "can_afford": {
            "type": "boolean"
          }
        }
      },
      "EnergyApiTimeResponse": {
        "required": [
          "unix_time"
        ],
        "type": "object",
        "properties": {
          "unix_time": {
            "type": "integer",
            "format": "int64"
          }
        }
      }
    },
    "securitySchemes": {
      "HmacSha256": {
        "type": "apiKey",
        "description": "Send `Authorization: HMAC-SHA256 {apiKey}:{base64_signature}` and `X-Request-Timestamp: {unix_seconds}`. Canonical payload: `{timestamp}\\n{METHOD}\\n{path}\\n{query}\\n{sha256_hex(body)}`. Preserve the exact query string and body bytes. `/v1/time` is anonymous.",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "tags": [
    {
      "name": "Energy API v1"
    }
  ]
}