API Documentation
- 1 Getting started with our API
- 2 Resources
- 2.1 Example Spreadsheet
- 2.2 Getting your API key
- 2.3 Current API Endpoints
- 2.3.1 User
- 2.3.2 Asset & Price Data
- 2.3.3 Orders
- 2.3.4 Trades
- 2.3.5 Market Information
- 2.3.6 Company
- 2.4 Detailed Documentation
- 2.5 Request and Response Formats
- 2.6 Authentication for API Access
Getting started with our API
We have several resources to make using our API easy, even for non-coders!
The API is an HTTP RESTful collection of endpoints you can hit with a browser or application, returning JSON payloads.
We send live price and market data via private and public WebSocket connections.
We have detailed Public API Documentation on Postman! Postman is a common tool for building, testing and writing documentation for APIs.
We have an official Free Excel Add-in available in the Microsoft Store that adds live TOD Markets price data to your existing spreadsheets: https://todmarkets.atlassian.net/wiki/spaces/TML/pages/217055233
We have an example Spreadsheet with pre-written VBA to hit our common API endpoints: https://todmarkets.atlassian.net/wiki/spaces/TML/pages/58064897/API+Documentation#Example-Spreadsheet
We have an open-source API and WebSocket example project for JavaScript and Python here: https://github.com/Temple-Electricity/TOD-Markets-API-Examples
Resources
Example Spreadsheet
We have also included an example file for you to experiment with. Historic versions are listed here, but you should download the latest version you see in this list.
Getting your API key
Visit your user profile using the top right user menu.
Then scroll to the bottom of the profile page to generate a new API Key:
Be sure to copy this API key into your system (excel or custom application) and don’t share it with anyone!
Current API Endpoints
Our API collection provides a range of endpoints corresponding to different resources and functionalities within the platform. The following are currently available.
User
GET
/user: returns the user, confirming that the API key works and who it is for.
Asset & Price Data
GET
/api/assets: Retrieve a list of available assetsGET
/api/assets/prices: Retrieve detailed information about a specific market.GET
/api/assets/close: Retrieve the recent close price of assets
Orders
GET
/api/orders: Retrieve a collection of company orders matching filter parametersPOST
/api/order: Place a new order.GET
/api/orders/{order_ULID}: Retrieve a single order record.
Trades
GET
/api/trades: Retrieves a collection of company trades matching filter parametersGET
/api/trade/{trade_ulid}: Retrieve a single trade record.
Market Information
GET
/api/market/trades: Retrieve the data for all trades by all companies on the market for up to 24 hours.
Company
GET
/api/counterparties: Retrieve a list of all of your existing counterparty connection (and their ULIDs) as well as a list of all other active participants who are not yet connected.
Detailed Documentation
We have detailed Public API Documentation on Postman! Postman is a common tool for building, testing and writing documentation for APIs.
Request and Response Formats
Requests
Headers:
Content-Type: application/jsonfor endpoints accepting data.Authorization: Bearer <API_KEY>for authenticated requests.
Body:
For endpoints that accept data (e.g., POST, PATCH), the request body must be in JSON format, containing the relevant attributes for the resource being created or updated.
Responses
Body:
All successful responses will return data in JSON format.
The structure of the response will depend on the endpoint but will typically include attributes of the resource(s) being retrieved or a confirmation of the action taken.
Authentication for API Access
The API will employ a secure authentication mechanism using API keys to ensure that only authorized users can access the API. The authentication process will be as follows:
API Key Generation:
API keys can be generated through the user's account settings in the platform's UI. Keys can be issued at a company level or for individual users, depending on the required scope of access.
API Key Usage:
To authenticate an API request, the user must include their API key in the
Authorizationheader as a bearer token.
Security Measures:
All API requests must be sent over HTTPS to ensure the security of data in transit.
Rate limiting and other security measures are implemented to protect the API from abuse and to ensure the stability of the platform.