> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.ada.cx/reference/data-export/getting-started/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ada.cx/_mcp/server. # Getting started The following example demonstrates how to use the Data Export API to retrieve messages from a specific time range. In this case, the code fetches all messages from the previous day, handling pagination until all data is retrieved. The sample code is provided in both JavaScript and Python to help you get started quickly. > **Note** > > Replace placeholders like `` and `` with your own credentials to begin fetching data. ### Fetch All Messages from the Previous Day **`JavaScript`** ```javascript title="JavaScript" import fetch from "node-fetch" async function fetchMessages() { const API_KEY = "" const startOfYesterday = new Date(), endOfYesterday = new Date() startOfYesterday.setDate(new Date().getDate() - 1) startOfYesterday.setHours(0) startOfYesterday.setMinutes(0) startOfYesterday.setSeconds(0) endOfYesterday.setDate(new Date().getDate() - 1) endOfYesterday.setHours(23) endOfYesterday.setMinutes(59) endOfYesterday.setSeconds(59) let endpoint = `api/v2/export/messages?created_since=${startOfYesterday.toISOString()}&created_to=${endOfYesterday.toISOString()}` while (endpoint) { const res = await fetch(`https://.ada.support/${endpoint}`, { headers: { Authorization: `Bearer ${API_KEY}` } } ) const json = await res.json() saveToDatabase(json.data) endpoint = json.meta?.next_page_uri } } ``` **`Python`** ```python title="Python" from datetime import timedelta, date from requests import get def fetch_messages(): API_KEY = "" yesterday = date.today() - timedelta(days=1) headers = {"Authorization": f"Bearer {API_KEY}"} endpoint = f"api/v2/export/messages?created_since={yesterday}T00:00:00&created_to={yesterday}T23:59:59" while endpoint: res = get(f"https://.ada.support/{endpoint}", headers=headers) json = res.json() save_to_database(json["data"]) endpoint = json["meta"]["next_page_uri"] if json.get("meta") else None ```