Skip to content

GET /apiv2/prices Deprecated

Deprecated

This endpoint is deprecated and will be removed in a future release. Please migrate to the new GET /apiv2/pricing endpoint which provides dynamic periods, service filtering, duration discounts, and a unified response format.

Get current energy rental prices for different time periods throughout the day.

Price may change during fulfillment

The price returned by this endpoint may change while an order is being processed. An energy provider can decline a delegation request, in which case Netts automatically routes the order to the next available provider. Netts is committed not only to offering the most competitive price, but also to ensuring a reliable energy supply — therefore an order may be fulfilled at a higher price than quoted. This applies only to orders of 300,000 energy units and above.

Endpoint URL

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

Request Headers

HeaderRequiredDescriptionValues
X-API-KEYYesYour API keystring
X-Real-IPYesIP address from whitelistIP address
X-FormatNoResponse format (default: extended JSON)now, compact, short, short1h, count

Request Parameters

No parameters required - returns all current pricing information.

Example Requests

cURL

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

Python

python
import requests

url = "https://netts.io/apiv2/prices"
headers = {
    "X-API-KEY": "your_api_key",
    "X-Real-IP": "your_whitelisted_ip"
}

response = requests.get(url, headers=headers)
data = response.json()

if response.status_code == 200:
    print(f"Status: {data.get('status')}")
    print(f"Current UTC time: {data.get('current_utc_time')}")
    print(f"Active period: {data.get('active_period')}")
    print(f"Host price: {data.get('host_price')} TRX")
    
    print("\nPrice periods:")
    for period in data.get('periods', []):
        is_active = period.get('is_active', False)
        active_marker = " *ACTIVE*" if is_active else ""
        print(f"\n{period.get('label')}{active_marker}:")
        print(f"  Time: {period.get('period')}")
        
        prices = period.get('prices', {})
        print(f"  < 200k energy: {prices.get('less_than_200k', {}).get('price_sun')} sun")
        print(f"  = 131k energy: {prices.get('equal_131k', {}).get('price_sun')} sun")  
        print(f"  > 200k energy: {prices.get('more_than_200k', {}).get('price_sun')} sun")
else:
    print(f"Error: {data.get('message', 'Unknown error')}")

Compact Response Format

New in v2.1: Use the X-Format header to get a compact text response instead of the full JSON structure.

When to Use

  • Integration with monitoring systems
  • Simple price displays
  • Automated price tracking
  • Minimal bandwidth requirements

Example Request

bash
curl -X GET https://netts.io/apiv2/prices \
  -H "X-API-KEY: your_api_key" \
  -H "X-Real-IP: your_whitelisted_ip" \
  -H "X-Format: now"

Compact Response Example

text
Daytime Hours (11:00-21:00 UTC): price=27 sun, 65k=1.755 TRX (0.52$), 131k=3.537 TRX (1.05$), 1m=27.000 TRX (7.99$)

Response Format Explanation

The compact format provides:

ComponentDescriptionExample
Period labelActive pricing periodDaytime Hours (11:00-21:00 UTC)
price=X sunPrice per energy unit in SUNprice=27 sun
65k=X.XXX TRX (X.XX$)Cost for 65,000 energy units65k=1.755 TRX (0.52$)
131k=X.XXX TRX (X.XX$)Cost for 131,000 energy units131k=3.537 TRX (1.05$)
1m=X.XXX TRX (X.XX$)Cost for 1,000,000 energy units1m=27.000 TRX (7.99$)

Calculation Formula

TRX cost = (price_sun / 1,000,000) × energy_amount
USD cost = TRX_cost × current_TRX_USD_rate

Note: TRX/USD exchange rate is retrieved from the chain_param table and cached for 30 minutes.

Content Type

  • Extended format: application/json
  • Compact format: text/plain

Python Example

python
import requests

url = "https://netts.io/apiv2/prices"
headers = {
    "X-API-KEY": "your_api_key",
    "X-Real-IP": "your_whitelisted_ip",
    "X-Format": "now"  # Request compact format
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    print("Compact price data:")
    print(response.text)
    # Output: Daytime Hours (11:00-21:00 UTC): price=27 sun, 65k=1.755 TRX (0.52$), ...
else:
    print(f"Error: {response.status_code}")

Ultra-Compact Response Format (short1h)

New in v2.2: Use the X-Format: short1h header to get an ultra-compact text response with only energy calculations, without the period label and price per unit.

When to Use

  • Monitoring dashboards with limited space
  • Mobile applications
  • Minimal bandwidth requirements
  • Focus on final costs only

Example Request

bash
curl -X GET https://netts.io/apiv2/prices \
  -H "X-API-KEY: your_api_key" \
  -H "X-Real-IP: your_whitelisted_ip" \
  -H "X-Format: short1h"

Ultra-Compact Response Example

text
65k=1.755 TRX (0.52$), 131k=3.537 TRX (1.05$), 1m=27.000 TRX (7.99$)

Response Format Explanation

The ultra-compact format provides only the essential cost calculations:

ComponentDescriptionExample
65k=X.XXX TRX (X.XX$)Cost for 65,000 energy units65k=1.755 TRX (0.52$)
131k=X.XXX TRX (X.XX$)Cost for 131,000 energy units131k=3.537 TRX (1.05$)
1m=X.XXX TRX (X.XX$)Cost for 1,000,000 energy units1m=27.000 TRX (7.99$)

Note: This format excludes the period label and price per energy unit for maximum compactness.

Content Type

  • Ultra-compact format: text/plain

Python Example

python
import requests

url = "https://netts.io/apiv2/prices"
headers = {
    "X-API-KEY": "your_api_key",
    "X-Real-IP": "your_whitelisted_ip",
    "X-Format": "short1h"  # Request ultra-compact format
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    print("Ultra-compact price data:")
    print(response.text)
    # Output: 65k=1.755 TRX (0.52$), 131k=3.537 TRX (1.05$), 1m=27.000 TRX (7.99$)
else:
    print(f"Error: {response.status_code}")

Count Response Format (count)

New in v2.3: Use the X-Format: count header to get bulk order pricing calculations showing costs for 1, 2, 3, 5, 10, and 20 orders.

When to Use

  • Bulk order pricing displays
  • Volume discount calculators
  • Price comparison tools
  • Order quantity planning
  • Cost estimation for multiple orders

Example Request

bash
curl -X GET https://netts.io/apiv2/prices \
  -H "X-API-KEY: your_api_key" \
  -H "X-Real-IP: your_whitelisted_ip" \
  -H "X-Format: count"

Count Response Example

text
1-1.690 TRX (0.50$), 2-3.380 TRX (1.00$), 3-5.070 TRX (1.50$), 5-8.450 TRX (2.50$), 10-16.900 TRX (5.00$), 20-33.800 TRX (10.00$)

Response Format Explanation

The count format provides calculated pricing for different order quantities:

ComponentDescriptionExample
1-X.XXX TRX (X.XX$)Cost for 1 order (65,000 energy units)1-1.690 TRX (0.50$)
2-X.XXX TRX (X.XX$)Cost for 2 orders (131,000 energy units)2-3.380 TRX (1.00$)
3-X.XXX TRX (X.XX$)Cost for 3 orders (3 × 65,000 energy)3-5.070 TRX (1.50$)
5-X.XXX TRX (X.XX$)Cost for 5 orders (5 × 65,000 energy)5-8.450 TRX (2.50$)
10-X.XXX TRX (X.XX$)Cost for 10 orders (10 × 65,000 energy)10-16.900 TRX (5.00$)
20-X.XXX TRX (X.XX$)Cost for 20 orders (20 × 65,000 energy)20-33.800 TRX (10.00$)

Calculation Formula

1 order:  TRX cost = (price_sun_65k / 1,000,000) × 65,000
2 orders: TRX cost = (price_sun_131k / 1,000,000) × 131,000
3+ orders: TRX cost = (price_sun_65k / 1,000,000) × 65,000 × quantity
USD cost = TRX_cost × current_TRX_USD_rate

Note: TRX/USD exchange rate is retrieved from the chain_param table and cached for 30 minutes.

Content Type

  • Count format: text/plain

Python Example

python
import requests

url = "https://netts.io/apiv2/prices"
headers = {
    "X-API-KEY": "your_api_key",
    "X-Real-IP": "your_whitelisted_ip",
    "X-Format": "count"  # Request count format
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    print("Bulk order pricing:")
    print(response.text)
    # Output: 1-1.690 TRX (0.50$), 2-3.380 TRX (1.00$), 3-5.070 TRX (1.50$), ...
else:
    print(f"Error: {response.status_code}")

Response

Success Response (200 OK)

json
{
    "status": "success",
    "current_utc_time": "2025-09-02 06:50:39",
    "current_utc_hour": 6,
    "active_period": "05:00-07:00",
    "last_update": "2025-09-02 08:05:03",
    "host_price": 2.989,
    "periods": [
        {
            "label": "Early Morning Hours (05:00-07:00 UTC)",
            "period": "05:00-07:00",
            "is_active": true,
            "prices": {
                "less_than_200k": {
                    "price_sun": 17
                },
                "equal_131k": {
                    "price_sun": 17
                },
                "more_than_200k": {
                    "price_sun": 17
                }
            }
        },
        {
            "label": "Morning Hours (07:00-11:00 UTC)",
            "period": "07:00-11:00",
            "is_active": false,
            "prices": {
                "less_than_200k": {
                    "price_sun": 17
                },
                "equal_131k": {
                    "price_sun": 17
                },
                "more_than_200k": {
                    "price_sun": 17
                }
            }
        }
    ]
}

Response Fields

FieldTypeDescription
statusstringAlways "success" for successful requests
current_utc_timestringCurrent server time in UTC
current_utc_hourintegerCurrent UTC hour (0-23)
active_periodstringCurrently active pricing period
last_updatestringLast time prices were updated
host_pricenumberCurrent host price in TRX
periodsarrayArray of all pricing periods
periods[].labelstringHuman-readable period name
periods[].periodstringTime range (HH:MM-HH:MM)
periods[].is_activebooleanWhether this period is currently active
periods[].prices.less_than_200k.price_sunintegerPrice in SUN for energy < 200,000 units
periods[].prices.equal_131k.price_sunintegerPrice in SUN for exactly 131,000 units
periods[].prices.more_than_200k.price_sunintegerPrice in SUN for energy > 200,000 units

Energy Amount Categories

CategoryDescriptionEnergy Range
less_than_200kSmall orders< 200,000 energy units
equal_131kStandard ordersExactly 131,000 energy units
more_than_200kLarge orders> 200,000 energy units

Time Periods

The API returns prices for 5 different time periods:

PeriodTime Range (UTC)Description
Early Morning05:00-07:00Lower demand period
Morning07:00-11:00Business hours start
Daytime11:00-21:00Peak business hours
Evening21:00-23:00Evening activity
Night23:00-05:00Lowest demand period

Rate Limits

The following rate limits apply to this endpoint (per IP address):

PeriodLimitDescription
1 minute1 requestMaximum 1 request per minute
1 hour60 requestsMaximum 60 requests per hour

Rate Limit Headers

http
RateLimit-Limit: 1
RateLimit-Remaining: 0
RateLimit-Reset: 21
X-RateLimit-Limit-Minute: 1
X-RateLimit-Remaining-Minute: 0
X-RateLimit-Limit-Hour: 60
X-RateLimit-Remaining-Hour: 59
Retry-After: 21

Rate Limit Exceeded (429)

json
{
    "message": "API rate limit exceeded"
}

Error Responses

Authentication Error (401)

json
{
    "status": "error",
    "code": 401,
    "message": "Invalid API key or IP not in whitelist"
}

Internal Server Error (500)

json
{
    "status": "error",
    "message": "Internal server error"
}

Notes

  • No request body required - this is a GET request
  • All prices are in SUN (1 TRX = 1,000,000 SUN)
  • Prices vary by energy amount and time of day (UTC)
  • Active period: Changes throughout the day based on demand
  • Rate limiting: Strict limits due to database-intensive operations
  • Price updates: Prices are refreshed from database periodically
  • Time zones: All times are in UTC