# Prices Endpoint

The /prices endpoint provides real-time pricing information for energy rentals during different time periods of the day.

# Endpoint URL

GET https://netts.io/apiv2/prices

# Authentication

This endpoint requires authentication via an API key. See the Authentication page for details.

# Request Headers

Header Required Description
X-API-KEY Yes Your NETTS API key
X-Real-IP Yes IP address that is whitelisted for your API key
Content-Type No application/json

# IP Whitelist

All API requests must come from IP addresses that have been added to your whitelist. You can add up to 3 IP addresses to your whitelist on the dashboard page (opens new window).

# How to Add an IP to Your Whitelist

  1. Log in to your NETTS dashboard
  2. Navigate to the API tab: https://www.netts.io/workspace/dashboard.php?tab=api
  3. In the "IP Whitelist" section, click the "Add IP Address" button
  4. Enter a valid IPv4 or IPv6 address
  5. Confirm the addition

Note: Requests from IP addresses that are not included in your whitelist will be rejected with an authentication error.

# Response

The response includes the current UTC time, active pricing period, host price, and detailed pricing information for all time periods.

# Response Parameters

Parameter Type Description
status string Request status ("success" or "error")
current_utc_time string Current UTC time in "YYYY-MM-DD HH:MM:SS" format
current_utc_hour integer Current UTC hour (0-23)
active_period string Currently active time period (e.g., "05:00-07:00")
last_update string Time of the last price update
host_price number Current host price in TRX
periods array List of pricing periods

# Period Object Structure

Each period in the periods array contains:

Parameter Type Description
label string Human-readable label for the period
period string Time range in "HH:MM-HH:MM" format
is_active boolean Whether this period is currently active
prices object Price information for different energy amounts

# Prices Object Structure

The prices object within each period contains:

Parameter Type Description
less_than_200k object Pricing for energy amounts less than 200,000
equal_131k object Pricing for exactly 131,000 energy
more_than_200k object Pricing for energy amounts more than 200,000

Each pricing option includes:

Parameter Type Description
price_sun integer Price in SUN (1 TRX = 1,000,000 SUN)

# Example Requests

# CURL Example

curl -X GET "https://netts.io/apiv2/prices" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: your_api_key" \
  -H "X-Real-IP: your_whitelisted_ip"

# Python Example

import requests
import json

# Request configuration
url = "https://netts.io/apiv2/prices"
api_key = "your_api_key"  # Your API key

headers = {
    "Content-Type": "application/json",
    "X-API-KEY": api_key,
    "X-Real-IP": "your_whitelisted_ip"  # IP from your whitelist
}

try:
    # Send GET request to the prices API
    response = requests.get(url, headers=headers, timeout=15)
    
    # Process JSON response
    if response.status_code == 200:
        data = response.json()
        print(json.dumps(data, ensure_ascii=False, indent=2))
    else:
        print(f"Error: {response.status_code}")
        print(response.text)
except Exception as e:
    print(f"An error occurred: {str(e)}")

# Example Response

{
  "status": "success",
  "current_utc_time": "2025-04-23 14:30:45",
  "current_utc_hour": 14,
  "active_period": "11:00-21:00",
  "last_update": "2025-04-23 14:15:22",
  "host_price": 0.075,
  "periods": [
    {
      "label": "Early Morning",
      "period": "05:00-07:00",
      "is_active": false,
      "prices": {
        "less_than_200k": {
          "price_sun": 420
        },
        "equal_131k": {
          "price_sun": 410
        },
        "more_than_200k": {
          "price_sun": 400
        }
      }
    },
    {
      "label": "Morning",
      "period": "07:00-11:00",
      "is_active": false,
      "prices": {
        "less_than_200k": {
          "price_sun": 450
        },
        "equal_131k": {
          "price_sun": 440
        },
        "more_than_200k": {
          "price_sun": 430
        }
      }
    },
    {
      "label": "Day",
      "period": "11:00-21:00",
      "is_active": true,
      "prices": {
        "less_than_200k": {
          "price_sun": 480
        },
        "equal_131k": {
          "price_sun": 470
        },
        "more_than_200k": {
          "price_sun": 460
        }
      }
    },
    {
      "label": "Evening",
      "period": "21:00-23:00",
      "is_active": false,
      "prices": {
        "less_than_200k": {
          "price_sun": 440
        },
        "equal_131k": {
          "price_sun": 430
        },
        "more_than_200k": {
          "price_sun": 420
        }
      }
    },
    {
      "label": "Night",
      "period": "23:00-05:00",
      "is_active": false,
      "prices": {
        "less_than_200k": {
          "price_sun": 400
        },
        "equal_131k": {
          "price_sun": 390
        },
        "more_than_200k": {
          "price_sun": 380
        }
      }
    }
  ]
}

# Error Responses

Status Code Description
401 Authentication error (invalid API key or IP not in whitelist)
403 Access forbidden (IP address not added to whitelist)
429 Rate limit exceeded (too many requests)
500 Internal server error

# Error Response Examples

{
  "status": "error",
  "code": -1,
  "msg": "Invalid API key or IP not in whitelist"
}
{
  "status": "error",
  "code": -2,
  "msg": "Your IP address is not whitelisted"
}

# Notes

  • All times are in UTC.
  • Prices are denominated in SUN (1 TRX = 1,000,000 SUN).
  • The active period is determined based on the current UTC time.
  • Price updates may occur multiple times per day.