### Deposit History cURL Request Examples Source: https://apibetadocs.lighter.xyz/reference/deposit_history Provides examples of how to make a GET request to the deposit history endpoint using cURL. Includes setting the URL and necessary headers. ```Shell curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/deposit/history \ --header 'accept: application/json' ``` -------------------------------- ### Get Account Information (cURL) Source: https://apibetadocs.lighter.xyz/reference/account-1 Example of how to retrieve account information using a cURL request. It specifies the GET method, the API endpoint, and the 'accept' header for JSON. ```Shell curl --request GET \ --url 'https://mainnet.zklighter.ellixt.ai/api/v1/account?by=index' \ --header 'accept: application/json' ``` -------------------------------- ### cURL GET Request for txFromL1TxHash Source: https://apibetadocs.lighter.xyz/reference/txfroml1txhash Demonstrates how to make a GET request to the txFromL1TxHash API endpoint using cURL. This example shows the URL and headers required for the request. ```Shell curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/txFromL1TxHash \ --header 'accept: application/json' ``` -------------------------------- ### Get L1 Metadata (Node.js) Source: https://apibetadocs.lighter.xyz/reference/l1metadata Example of fetching L1 metadata using Node.js with the 'node-fetch' library. Demonstrates making a GET request to the ZKLighter API. ```JavaScript const fetch = require('node-fetch'); const url = 'https://mainnet.zklighter.elliot.ai/api/v1/l1Metadata'; fetch(url, { method: 'GET', headers: { 'accept': 'application/json' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Get L1 Metadata (Python) Source: https://apibetadocs.lighter.xyz/reference/l1metadata Python example for retrieving L1 metadata using the 'requests' library. Shows how to send a GET request and handle the JSON response. ```Python import requests url = 'https://mainnet.zklighter.elliot.ai/api/v1/l1Metadata' headers = { 'accept': 'application/json' } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f'Error: {response.status_code}') ``` -------------------------------- ### nextNonce cURL Request Source: https://apibetadocs.lighter.xyz/reference/nextnonce Example of how to make a GET request to the nextNonce endpoint using cURL. It specifies the URL and the expected content type. ```Shell curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/nextNonce \ --header 'accept: application/json' ``` -------------------------------- ### Get Recent Trades (Python) Source: https://apibetadocs.lighter.xyz/reference/recenttrades Example Python request using the 'requests' library to get recent trades from the ZKLighter API. Demonstrates making a GET request and printing the JSON response. ```python import requests url = "https://mainnet.zklighter.elliot.ai/api/v1/recentTrades" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Transaction by Hash (cURL) Source: https://apibetadocs.lighter.xyz/reference/tx Example cURL request to retrieve a transaction by its hash. It specifies the GET method, the API endpoint, and the expected JSON response format. ```Shell curl --request GET \ --url 'https://mainnet.zklighter.ellixt.ai/api/v1/tx?by=hash' \ --header 'accept: application/json' ``` -------------------------------- ### Get Recent Trades (Node.js) Source: https://apibetadocs.lighter.xyz/reference/recenttrades Example Node.js request using the 'node-fetch' library to get recent trades from the ZKLighter API. Demonstrates setting headers and handling responses. ```javascript import fetch from 'node-fetch'; const url = "https://mainnet.zklighter.elliot.ai/api/v1/recentTrades"; const options = { method: "GET", headers: { accept: "application/json" } }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error('error')); ``` -------------------------------- ### Get Trades Request (PHP) Source: https://apibetadocs.lighter.xyz/reference/trades An example of making a GET request to retrieve trade data using PHP, likely with cURL functions or Guzzle. It details setting the URL and the 'accept' header. ```php ``` -------------------------------- ### Get Trades Request (Python) Source: https://apibetadocs.lighter.xyz/reference/trades Illustrates how to retrieve trade data using Python, typically with the 'requests' library. The example includes setting the request method, URL, and headers. ```python import requests url = "https://mainnet.zklighter.elliot.ai/api/v1/trades?sort_by=block_height" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Get Announcement (Python) Source: https://apibetadocs.lighter.xyz/reference/announcement-1 This snippet shows how to make a GET request to the announcement API using Python's 'requests' library. It includes setting the URL and the 'accept' header. ```python import requests url = "https://mainnet.zklighter.elliot.ai/api/v1/announcement" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### cURL GET Request for Account Limits Source: https://apibetadocs.lighter.xyz/reference/accountlimits Demonstrates how to make a GET request to the accountLimits endpoint using cURL. It includes the URL and necessary headers for a successful API call. ```Shell curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/accountLimits \ --header 'accept: application/json' ``` -------------------------------- ### Get Blocks - cURL Request Source: https://apibetadocs.lighter.xyz/reference/blocks Example cURL request to retrieve blocks from the ZkLighter API. It specifies the GET method, the API endpoint URL, and the expected response format (application/json). ```Shell curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/blocks \ --header 'accept: application/json' ``` -------------------------------- ### Get Account API Keys (cURL) Source: https://apibetadocs.lighter.xyz/reference/apikeys Demonstrates how to make a GET request to retrieve account API keys using cURL. It includes the endpoint URL and necessary headers. ```shell curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/apikeys \ --header 'accept: application/json' ``` -------------------------------- ### Get Trades Request (Node.js) Source: https://apibetadocs.lighter.xyz/reference/trades Provides an example of fetching trade data using Node.js, likely utilizing a library like 'axios' or the built-in 'fetch'. It shows how to configure the request with headers and parameters. ```javascript fetch('https://mainnet.zklighter.elliot.ai/api/v1/trades?sort_by=block_height', { method: 'GET', headers: { 'accept': 'application/json' } }) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.error('There was a problem with the fetch operation:', error); }); ``` -------------------------------- ### cURL GET Request for Fundings Source: https://apibetadocs.lighter.xyz/reference/fundings Demonstrates how to make a GET request to the fundings endpoint using cURL to retrieve funding data for a specific resolution. ```shell curl --request GET \ --url 'https://mainnet.zklighter.ellixt.ai/api/v1/fundings?resolution=1h' \ --header 'accept: application/json' ``` -------------------------------- ### Get Candlesticks (Ruby) Source: https://apibetadocs.lighter.xyz/reference/candlesticks Illustrates how to make a GET request to the candlesticks endpoint using Ruby. This example would likely utilize the 'net/http' library for making HTTP requests. ```Ruby # Example using net/http # require 'net/http' # require 'uri' # uri = URI.parse('https://mainnet.zklighter.elliot.ai/api/v1/candlesticks?resolution=1m') # http = Net::HTTP.new(uri.host, uri.port) # http.use_ssl = true # request = Net::HTTP::Get.new(uri.request_uri) # request['accept'] = 'application/json' # response = http.request(request) # puts response.body ``` -------------------------------- ### Get Order Book Orders (cURL) Source: https://apibetadocs.lighter.xyz/reference/orderbookorders Demonstrates how to retrieve order book orders using a GET request to the Zklighter API. Includes example headers and URL structure. Requires a valid API endpoint. ```Shell curl --request GET \ --url https://mainnet.zklighter.ellixt.ai/api/v1/orderBookOrders \ --header 'accept: application/json' ``` -------------------------------- ### Get Transactions (cURL) Source: https://apibetadocs.lighter.xyz/reference/txs Example of how to retrieve transactions using cURL. This request targets the mainnet API endpoint for transactions. ```Shell curl --request GET \ --url https://mainnet.zklighter.ellixt.ai/api/v1/txs \ --header 'accept: application/json' ``` -------------------------------- ### Ruby GET Request for Candlesticks Source: https://apibetadocs.lighter.xyz/reference/candlestick Shows how to retrieve candlestick data using Ruby's Net::HTTP library. This example covers setting up the HTTP request, including the URL and headers, and processing the response. ```ruby require 'uri' require 'net/http' uri = URI.parse('https://mainnet.zklighter.elliot.ai/api/v1/candlesticks?resolution=1m') Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| request = Net::HTTP::Get.new(uri) request['accept'] = 'application/json' response = http.request(request) puts response.body end ``` -------------------------------- ### Get Recent Trades (Ruby) Source: https://apibetadocs.lighter.xyz/reference/recenttrades Example Ruby request using the 'net/http' library to retrieve recent trades from the ZKLighter API. Shows how to construct the request and parse the JSON response. ```ruby require 'uri' require 'net/http' require 'json' url = URI("https://mainnet.zklighter.elliot.ai/api/v1/recentTrades") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["accept"] = "application/json" response = http.request(request) puts JSON.pretty_generate(JSON.parse(response.body)) ``` -------------------------------- ### Get Liquidations (cURL) Source: https://apibetadocs.lighter.xyz/reference/liquidations This snippet demonstrates how to make a GET request to the liquidations endpoint using cURL. It includes the URL, required headers, and specifies the desired response format. ```shell curl --request GET \ --url https://mainnet.zklighter.ellixt.ai/api/v1/liquidations \ --header 'accept: application/json' ``` -------------------------------- ### Get Announcement (PHP) Source: https://apibetadocs.lighter.xyz/reference/announcement-1 This snippet illustrates how to fetch announcements using PHP's cURL extension. It sets the GET request, the target URL, and the 'accept' header for JSON. ```php ``` -------------------------------- ### Get Trades Request (Ruby) Source: https://apibetadocs.lighter.xyz/reference/trades Shows how to fetch trade data in Ruby, commonly using the 'Net::HTTP' library. The code demonstrates setting up the HTTP request with the correct URL and headers. ```ruby require 'net/http' require 'uri' uri = URI.parse('https://mainnet.zklighter.elliot.ai/api/v1/trades?sort_by=block_height') request = Net::HTTP::Get.new(uri) request['accept'] = 'application/json' response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.body ``` -------------------------------- ### Get Candlesticks (PHP) Source: https://apibetadocs.lighter.xyz/reference/candlesticks Shows a PHP implementation for retrieving candlestick data. This example would typically use cURL or stream contexts to perform the GET request. ```PHP uri.scheme == 'https') do |http| request = Net::HTTP::Get.new(uri) request['accept'] = 'application/json' response = http.request(request) puts response.body end ``` -------------------------------- ### Get Candlesticks (Node.js) Source: https://apibetadocs.lighter.xyz/reference/candlesticks Provides an example of fetching candlestick data using Node.js. This snippet would typically use a library like 'node-fetch' or the built-in 'https' module to make the GET request. ```Node.js // Example using node-fetch (install with: npm install node-fetch) // import fetch from 'node-fetch'; /* fetch('https://mainnet.zklighter.elliot.ai/api/v1/candlesticks?resolution=1m', { method: 'GET', headers: { 'accept': 'application/json' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); */ ``` -------------------------------- ### Get Funding Rates (cURL) Source: https://apibetadocs.lighter.xyz/reference/funding-rates Demonstrates how to retrieve funding rates using a cURL command. This request targets the mainnet API endpoint and expects a JSON response containing funding rate data for different markets. ```shell curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/funding-rates \ --header 'accept: application/json' ``` -------------------------------- ### PHP GET Request for Candlesticks Source: https://apibetadocs.lighter.xyz/reference/candlestick An example using PHP's cURL functions to make a GET request for candlestick data. It demonstrates setting the URL, request headers, and outputting the response body. ```php ``` -------------------------------- ### Get accounts by L1 address (cURL) Source: https://apibetadocs.lighter.xyz/reference/accountsbyl1address Example cURL request to fetch accounts associated with a specific L1 address. It specifies the GET method, the API endpoint URL, and the expected JSON accept header. ```Shell curl --request GET \ --url https://mainnet.zklighter.ellixt.ai/api/v1/accountsByL1Address \ --header 'accept: application/json' ``` -------------------------------- ### Get Funding Rates Source: https://apibetadocs.lighter.xyz/reference/funding-rates Retrieves the latest funding rates for supported markets. ```APIDOC ## GET /api/v1/funding-rates ### Description Retrieves the latest funding rates for supported markets. ### Method GET ### Endpoint https://mainnet.zklighter.elliot.ai/api/v1/funding-rates ### Parameters ### Request Example ```bash curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/funding-rates \ --header 'accept: application/json' ``` ### Response #### Success Response (200) - **code** (int32) - Required - **message** (string) - **funding_rates** (array of objects) - Required - **market_id** (uint8) - Required - **exchange** (string) - Required - Enum: `binance`, `bybit`, `hyperliquid`, `lighter` - **symbol** (string) - Required - **rate** (double) - Required #### Response Example ```json { "code": 200, "message": "Success", "funding_rates": [ { "market_id": 1, "exchange": "binance", "symbol": "BTC/USDT", "rate": 0.0001 } ] } ``` #### Error Response (400) - **code** (int32) - Required - **message** (string) #### Response Example ```json { "code": 400, "message": "Bad request" } ``` ``` -------------------------------- ### GET /api/v1/candlesticks Source: https://apibetadocs.lighter.xyz/reference/candlestick Retrieves candlestick data for a specified market and resolution. Requires market ID, resolution, start and end timestamps, and count back. ```APIDOC ## GET /api/v1/candlesticks ### Description Retrieves candlestick data for a specified market and resolution. This endpoint allows users to fetch historical trading data, such as open, high, low, close prices, and volume, for a given financial instrument over a specific period. ### Method GET ### Endpoint https://mainnet.zklighter.elliot.ai/api/v1/candlesticks ### Parameters #### Query Parameters - **market_id** (uint8) - Required - The unique identifier for the market. - **resolution** (string) - Required - The time interval for the candlesticks (e.g., 1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w). - **start_timestamp** (int64) - Required - The starting timestamp for the data retrieval (Unix epoch time). - **end_timestamp** (int64) - Required - The ending timestamp for the data retrieval (Unix epoch time). - **count_back** (int64) - Required - The number of candlestick intervals to retrieve. - **set_timestamp_to_end** (boolean) - Optional - Defaults to false. If true, the timestamp will be set to the end of the period. ### Request Example ``` { "example": "curl --request GET \ --url 'https://mainnet.zklighter.elliot.ai/api/v1/candlesticks?resolution=1m&market_id=1&start_timestamp=1678886400&end_timestamp=1678972800&count_back=100' \ --header 'accept: application/json'" } ``` ### Response #### Success Response (200) - **code** (int32) - Required - Status code indicating success. - **message** (string) - Required - A message confirming the success of the operation. - **resolution** (string) - Required - The resolution of the returned candlesticks. - **candlesticks** (array of objects) - Required - An array of candlestick objects. - **timestamp** (int64) - Required - The timestamp of the candlestick. - **open** (double) - Required - The opening price. - **high** (double) - Required - The highest price. - **low** (double) - Required - The lowest price. - **close** (double) - Required - The closing price. - **volume0** (double) - Required - The volume for the first volume metric. - **volume1** (double) - Required - The volume for the second volume metric. - **last_trade_id** (int64) - Required - The ID of the last trade. #### Response Example ``` { "example": "{\n \"code\": 200,\n \"message\": \"Success\",\n \"resolution\": \"1m\",\n \"candlesticks\": [\n {\n \"timestamp\": 1678886400,\n \"open\": 100.50,\n \"high\": 101.20,\n \"low\": 100.10,\n \"close\": 101.00,\n \"volume0\": 500.75,\n \"volume1\": 250.30,\n \"last_trade_id\": 12345\n }\n ]\n}" } ``` #### Error Response (400) - **code** (int32) - Required - Status code indicating a bad request. - **message** (string) - Required - A message describing the error. ``` -------------------------------- ### cURL Request to Get Referral Points Source: https://apibetadocs.lighter.xyz/reference/referral_points This snippet demonstrates how to make a GET request to the referral points API endpoint using cURL. It includes the URL and the necessary Accept header for JSON response. ```Shell curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/referral/points \ --header 'accept: application/json' ``` -------------------------------- ### GET /api/v1/funding-rates Source: https://apibetadocs.lighter.xyz/reference/funding Retrieves the current funding rates for different markets. Authentication may be required for full request history. ```APIDOC ## GET /api/v1/funding-rates ### Description Retrieves the current funding rates for different markets. Authentication may be required for full request history. ### Method GET ### Endpoint https://mainnet.zklighter.elliot.ai/api/v1/funding-rates ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```bash curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/funding-rates \ --header 'accept: application/json' ``` ### Response #### Success Response (200) - **code** (int32) - Required - **message** (string) - **funding_rates** (array of objects) - Required - **market_id** (uint8) - Required - **exchange** (string) - Required (enum: `binance`, `bybit`, `hyperliquid`, `lighter`) - **symbol** (string) - Required - **rate** (double) - Required #### Response Example (200) ```json { "code": 0, "message": "Success", "funding_rates": [ { "market_id": 1, "exchange": "binance", "symbol": "BTCUSDT", "rate": 0.0001 } ] } ``` #### Error Response (400) - **code** (int32) - Required - **message** (string) #### Response Example (400) ```json { "code": 400, "message": "Bad request" } ``` ``` -------------------------------- ### Get Recent Trades (cURL) Source: https://apibetadocs.lighter.xyz/reference/recenttrades Example cURL request to fetch recent trades from the ZKLighter API. Requires specifying the API endpoint and accepting JSON. ```shell curl --request GET \ --url https://mainnet.zklighter.elliot.ai/api/v1/recentTrades \ --header 'accept: application/json' ``` -------------------------------- ### GET /api/v1/export Source: https://apibetadocs.lighter.xyz/reference/export Exports data from the ZKLighter platform. Requires authentication and specifies the type of data to export. ```APIDOC ## GET /api/v1/export ### Description Exports data from the ZKLighter platform. Users can specify the type of data (funding or trade) and optionally provide authentication details and market information. ### Method GET ### Endpoint https://mainnet.zklighter.elliot.ai/api/v1/export ### Parameters #### Query Parameters - **auth** (string) - Optional - Authentication token or credentials. - **account_index** (int64) - Optional - The account index, defaults to -1. - **market_id** (uint8) - Optional - The market ID, defaults to 255. - **type** (string) - Required - The type of data to export. Allowed values: `funding`, `trade`. ### Request Example ```json { "example": "GET https://mainnet.zklighter.elliot.ai/api/v1/export?type=funding&auth=your_auth_token" } ``` ### Response #### Success Response (200) - **code** (int32) - Required - Indicates the success of the operation. - **message** (string) - A message describing the result of the operation. - **data_url** (string) - Required - A URL pointing to the exported data. #### Response Example (200) ```json { "code": 200, "message": "Export successful", "data_url": "https://example.com/path/to/your/exported_data.zip" } ``` #### Error Response (400) - **code** (int32) - Required - Indicates a bad request. - **message** (string) - A message describing the bad request error. #### Response Example (400) ```json { "code": 400, "message": "Invalid type parameter provided." } ``` ``` -------------------------------- ### Get Account PnL Chart (cURL) Source: https://apibetadocs.lighter.xyz/reference/pnl Example cURL request to retrieve account PnL chart data. Requires specifying the 'by' and 'resolution' query parameters. ```shell curl --request GET \ --url 'https://mainnet.zklighter.ellixt.ai/api/v1/pnl?by=index&resolution=1m' \ --header 'accept: application/json' ``` -------------------------------- ### Get Recent Trades (PHP) Source: https://apibetadocs.lighter.xyz/reference/recenttrades Example PHP request using cURL to fetch recent trades from the ZKLighter API. Includes setting the request method, URL, and headers. ```php