> For the complete documentation index, see [llms.txt](https://docs.lighter.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lighter.xyz/api/orders/export.md).

# export

Export trade or funding history for an account. Supply both start\_timestamp and end\_timestamp in Unix milliseconds, or omit both for available history. If supplied, start\_timestamp must be on or after 2025-01-01 UTC and earlier than end\_timestamp. Exports are processed asynchronously; large histories may require smaller date ranges. The current implementation limits output to 40 GiB and processing to four hours; a completed export URL is valid for six hours.

```json
{"openapi":"3.0.0","info":{"title":"Lighter API","version":"1.0.0"},"tags":[{"name":"orders"}],"servers":[{"url":"https://mainnet.zklighter.elliot.ai","description":"Lighter mainnet"},{"url":"https://api.testnet.lighter.xyz","description":"Lighter testnet"},{"url":"https://api.rh.lighter.xyz","description":"Lighter on Robinhood Chain mainnet"},{"url":"https://api.rh-testnet.lighter.xyz","description":"Lighter on Robinhood Chain testnet"}],"paths":{"/api/v1/export":{"get":{"summary":"export","operationId":"export","tags":["orders"],"description":"Export trade or funding history for an account. Supply both start_timestamp and end_timestamp in Unix milliseconds, or omit both for available history. If supplied, start_timestamp must be on or after 2025-01-01 UTC and earlier than end_timestamp. Exports are processed asynchronously; large histories may require smaller date ranges. The current implementation limits output to 40 GiB and processing to four hours; a completed export URL is valid for six hours.","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Auth token in the Authorization header."},{"name":"account_index","in":"query","required":false,"schema":{"type":"integer","format":"int64","default":-1},"description":"Account index to query."},{"name":"market_id","in":"query","required":false,"schema":{"type":"integer","format":"int16","default":255},"description":"Public market identifier returned by orderBooks or events."},{"name":"type","in":"query","required":true,"schema":{"type":"string","enum":["funding","trade"]},"description":"Select one of the listed record types."},{"name":"start_timestamp","in":"query","required":false,"schema":{"type":"integer","format":"int64","minimum":1735689600000,"maximum":1830297600000},"description":"Inclusive start of the requested time range, as a Unix timestamp in milliseconds."},{"name":"end_timestamp","in":"query","required":false,"schema":{"type":"integer","format":"int64","minimum":1735689600000,"maximum":1830297600000},"description":"End of the requested time range, as a Unix timestamp in milliseconds."},{"name":"side","in":"query","required":false,"schema":{"type":"string","enum":["all","long","short"],"default":"all"},"description":"Position or trade side filter."},{"name":"role","in":"query","required":false,"schema":{"type":"string","enum":["all","maker","taker"],"default":"all"},"description":"Select fills where the account was the maker or taker, or all fills."},{"name":"trade_type","in":"query","required":false,"schema":{"type":"string","enum":["all","trade","liquidation","deleverage","market-settlement"],"default":"all"},"description":"Trade type to include in the export."},{"name":"aggregate","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Include remaining fills for the last order on the page; requires account_index."}],"responses":{"200":{"description":"A successful response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportData"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultCode"}}}}}}}},"components":{"schemas":{"ExportData":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"},"data_url":{"type":"string"}},"title":"ExportData","required":["code","data_url"]},"ResultCode":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}},"title":"ResultCode","required":["code"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lighter.xyz/api/orders/export.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
