Introduction

The OpenElectricity API provides programmatic access to Australian electricity market data, including real-time generation, demand, price information and historical data across the National Electricity Market (NEM) and Western Australian Wholesale Electricity Market (WEM).

Data License

Unless stated otherwise, the data provided by the OpenElectricity API is licensed under the CC BY 4.0 license. Proper attribution to OpenElectricity at openelectricity.org.au as the source is required.

Authentication

All API endpoints require authentication using an API key. You’ll need to include your API key in the Authorization header of your requests:

Authorization: Bearer your_api_key_here

To obtain and manage your API key, please register for an account at the OpenElectricity Platform.

Base URL

The base URL for all API endpoints is:

https://api.openelectricity.org.au/v4

Response Format

All responses are returned in JSON format. Successful responses will have a 2xx status code and follow this structure:

{
  "version": "4.0",
  "created_at": "2024-03-20T10:00:00Z",
  "success": true,
  "data": [
    // Response data
  ],
  "total_records": 100
}

Error Handling

Errors are returned with appropriate HTTP status codes and include detailed error messages:

{
  "error": {
    "code": "validation_error",
    "message": "Invalid parameters",
    "details": [
      {
        "loc": ["parameter_name"],
        "msg": "Error description",
        "type": "error_type"
      }
    ]
  }
}

Common error status codes:

  • 400 Bad Request - Invalid parameters or request
  • 401 Unauthorized - Missing or invalid API key
  • 403 Forbidden - Insufficient permissions
  • 422 Validation Error - Invalid input parameters
  • 500 Internal Server Error - Server-side error