> For the complete documentation index, see [llms.txt](https://tronex.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tronex.gitbook.io/docs/api-documentation/api-v1/bandwidth.md).

# Bandwidth

## Get bandwidth price

> Request for preliminary calculation of bandwidth purchase cost. The user provides an authentication token, as well as the parameters: bandwidth usage period \`days\` and bandwidth volume \`volume\`. A preliminary cost estimate is returned in the response.\
> \
> \*\*Limits:\*\*\
> \- Bandwidth duration period (Possible values: 1h = 1 hour, 3d = 3 days, 7d = 7 days)\
> \- Bandwidth volume \`volume\` must be at least 1K and no more than 2M.\
> \- Bandwidth cannot be transferred to \*\*inactive wallets\*\*.\
> \
> \*\*Usage example:\*\*\
> \`\`\`http\
> &#x20; POST <https://api.tronex.energy/api/v1/precountBandwidth\\>
> &#x20; Content-Type: application/json\
> &#x20; X-API-KEY: authentication\_token\
> \
> &#x20; {\
> &#x20;   "days": "1h",\
> &#x20;   "volume": 1000\
> &#x20; }\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Tronex API","version":"1.0.0"},"servers":[{"url":"https://api.tronex.energy","description":"API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key for authentication"}}},"paths":{"/api/v1/precountBandwidth":{"post":{"summary":"Get bandwidth price","tags":["Bandwidth"],"description":"Request for preliminary calculation of bandwidth purchase cost. The user provides an authentication token, as well as the parameters: bandwidth usage period `days` and bandwidth volume `volume`. A preliminary cost estimate is returned in the response.\n\n**Limits:**\n- Bandwidth duration period (Possible values: 1h = 1 hour, 3d = 3 days, 7d = 7 days)\n- Bandwidth volume `volume` must be at least 1K and no more than 2M.\n- Bandwidth cannot be transferred to **inactive wallets**.\n\n**Usage example:**\n```http\n  POST https://api.tronex.energy/api/v1/precountBandwidth\n  Content-Type: application/json\n  X-API-KEY: authentication_token\n\n  {\n    \"days\": \"1h\",\n    \"volume\": 1000\n  }\n```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"string","enum":["1h","3d","7d"]},"volume":{"type":"number","minimum":1000,"maximum":2000000,"description":"Amount of bandwidth to buy"}},"required":["days","volume"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"duration":{"type":"string","enum":["1h","3d","7d"],"description":"Bandwidth rental period"},"volume":{"type":"number"},"price":{"type":"number"},"summa":{"type":"number"}},"required":["duration","volume","price","summa"],"additionalProperties":false,"description":"Preliminary cost"}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number","enum":[400]},"code":{"default":"BAD_REQUEST","type":"string"},"error":{"default":"Bad Request","type":"string"},"message":{"default":"Bad Request","type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"],"additionalProperties":false}}},"required":["statusCode","code","error","message"],"additionalProperties":false,"description":"Bad request error"}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number","enum":[401]},"code":{"default":"UNAUTHORIZED","type":"string"},"error":{"default":"Unauthorized","type":"string"},"message":{"default":"Invalid authorization token","type":"string"}},"required":["statusCode","code","error","message"],"additionalProperties":false,"description":"Unauthorized error"}}}}}}}}}
````

## Buy bandwidth

> Request to purchase bandwidth with parameters: Bandwidth duration period, Bandwidth volume, and target address. The user provides an authentication token in the request header and sends a JSON payload. The response returns the status of the operation.\
> \
> \*\*Limits:\*\*\
> \- Bandwidth duration period (Possible values: 1h, 1d)\
> \- Bandwidth volume \`volume\` must be at least 1K and no more than 30K.\
> \- Bandwidth cannot be transferred to \*\*inactive wallets\*\*.\
> \
> \*\*Usage example:\*\*\
> \
> &#x20; \`\`\`http\
> &#x20; POST <https://api.tronex.energy/api/v1/buybandwidth\\>
> &#x20; Content-Type: application/json\
> &#x20; X-API-KEY: authentication\_token\
> \
> {\
> &#x20; "days": "1h",\
> &#x20; "volume": 1000,\
> &#x20; "target": "TVVX6svz6vXGVACeH9jNMk5M3dH5SvcT71"\
> } \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Tronex API","version":"1.0.0"},"servers":[{"url":"https://api.tronex.energy","description":"API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key for authentication"}}},"paths":{"/api/v1/buybandwidth":{"post":{"summary":"Buy bandwidth","tags":["Bandwidth"],"description":"Request to purchase bandwidth with parameters: Bandwidth duration period, Bandwidth volume, and target address. The user provides an authentication token in the request header and sends a JSON payload. The response returns the status of the operation.\n\n**Limits:**\n- Bandwidth duration period (Possible values: 1h, 1d)\n- Bandwidth volume `volume` must be at least 1K and no more than 30K.\n- Bandwidth cannot be transferred to **inactive wallets**.\n\n**Usage example:**\n\n  ```http\n  POST https://api.tronex.energy/api/v1/buybandwidth\n  Content-Type: application/json\n  X-API-KEY: authentication_token\n\n{\n  \"days\": \"1h\",\n  \"volume\": 1000,\n  \"target\": \"TVVX6svz6vXGVACeH9jNMk5M3dH5SvcT71\"\n} ```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"days":{"default":"1h","description":"Bandwidth rental period","type":"string","enum":["1h","1d"]},"volume":{"default":1000,"description":"Amount of bandwidth to buy","type":"number","minimum":1000,"maximum":30000},"target":{"type":"string","description":"Wallet address to receive bandwidth"}},"required":["target"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"string","enum":["1h","1d"]},"volume":{"type":"number"},"price":{"type":"number"},"summa":{"type":"number"},"target":{"type":"string"},"order_id":{"type":"number"},"status":{"type":"string","enum":["Filled","Pending","Cancelled"]},"txid":{"nullable":true,"type":"string"}},"required":["days","volume","price","summa","target","order_id","status","txid"],"additionalProperties":false,"description":"Order created successfully"}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number","enum":[400]},"code":{"default":"BAD_REQUEST","type":"string"},"error":{"default":"Bad Request","type":"string"},"message":{"default":"Bad Request","type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"],"additionalProperties":false}}},"required":["statusCode","code","error","message"],"additionalProperties":false,"description":"Bad request error"}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number","enum":[401]},"code":{"default":"UNAUTHORIZED","type":"string"},"error":{"default":"Unauthorized","type":"string"},"message":{"default":"Invalid authorization token","type":"string"}},"required":["statusCode","code","error","message"],"additionalProperties":false,"description":"Unauthorized error"}}}},"402":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number","enum":[402]},"code":{"default":"INSUFFICIENT_FUNDS","type":"string"},"error":{"default":"Payment Required","type":"string"},"message":{"default":"Insufficient funds to create an order","type":"string"}},"required":["statusCode","code","error","message"],"additionalProperties":false,"description":"Insufficient funds error"}}}}}}}}}
````
