Skip to main content

How to export data from your Layer Workspace

How to get a deeper look into event data from your workspace generations with data exporting.

Updated this week

This guide explains how to export event data from your Layer.ai workspace.

Prerequisites

  1. A valid Layer.ai account

  2. Access to the workspace you want to export data from

Authentication

  1. Create a Personal Access Token:

    • Navigate to Layer.ai Settings

    • Generate a new personal access token

    • Save this token securely (you won't be able to see it again)

  2. Using the Token:

    • Include the token in the Authorization header of your requests:

      Authorization: Bearer YOUR_ACCESS_TOKEN

Export Process

1. Initiate Export

Make a POST request to the export endpoint with the following details:

POST /backend/api/v1/workspaces/{workspace_id}/events/exports
Host: app.layer.ai
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

{
"start_date": "2025-05-27T00:00:00Z",
"end_date": "2025-05-27T23:59:59Z"
}

Parameters:

  • workspace_id: Your workspace's unique identifier

  • start_date: Start of the export range (ISO 8601 format)

  • end_date: End of the export range (ISO 8601 format)

Response:

{
"export_id": "1234567890"
}

2. Check Export Status

Poll the status endpoint to check if your export is ready:

GET /backend/api/v1/workspaces/{workspace_id}/events/exports/{export_id}
Host: app.layer.ai
Authorization: Bearer YOUR_ACCESS_TOKEN

Response (when complete):

{
"status": "completed",
"download_url": "https://storage.googleapis.com/layer-exports-gcp- app/...",
"expiration_date": "2025-05-28T15:42:28.813443Z"
}

3. Download the Export File

  1. Use the download_url from the status response to download your export

  2. The file is in CSV format, compressed with gzip

  3. The download link is valid for 24 hours

Notes

  • The export process may take time depending on the data volume

  • Ensure you download the file before the expiration_date

  • The CSV will be gzipped (ends with .csv.gz) - you'll need to extract it before viewing

Error Handling

  • If the export fails, the status will show "failed"

  • Common issues include invalid date ranges or insufficient permissions

  • For large exports, consider breaking them into smaller date ranges

Did this answer your question?