Message history
Overview
The Message History endpoint allows you to export all thread messages and their responses as a JSONL (JSON Lines) file.
This endpoint requires a service account token with the analytics scope. See the Authorization guide for details on obtaining a service account token.
Endpoint
Query parameters
Date filtering behavior
- If
start_dateis not provided, returns all messages on and before theend_date(UTC 23:59:59) - If
end_dateis not provided, returns all messages on and after thestart_date(UTC 00:00:00) - If both dates are not provided, returns all messages
Response format
The endpoint returns a streamed JSONL file with each line having the following structure:
If an error occurs during the streaming process, the final line in the file will have the following structure:
Response fields
Important Notes
The messages provided by this endpoint will be on a 1 day delay, meaning it will not be able to fetch message history for messages made on the same day.
Example usage
The JSONL format requires one JSON object per line. Each line must be valid JSON, but the file as a whole is not a JSON array.
FAQ
What is the maximum date range I can query?
There is no hard limit on the date range, but larger date ranges will take longer to process and return larger files. Consider breaking up very large date ranges into smaller chunks.
