- Submit a report generation request
- Poll the export status (or wait for a webhook)
- Download the completed file
Prerequisites
- An active Layer account and API credentials
- A valid access token (see Initial Setup)
- Optional: a webhook endpoint configured to receive
export.completedandexport.failed(see Webhooks)
Workflow
1
Submit the report request
Call the report-specific creation endpoint. For billing reports:Layer responds with Save the export
202 Accepted and an Export resource:id. You will use it to poll for completion.2
Poll for status
Call Fetch export until Status values:
status is completed or failed:You can also list recent exports with List exports.
3
Download the file
When Use
status is completed, download the artifact from download_url. The URL is a short-lived presigned link.file_name from the export response when saving the file locally.Prefer webhooks instead of polling
If you do not want to poll, subscribe to export lifecycle webhooks in the Layer developer portal:export.completedā the export finished successfullyexport.failedā the export failed
id, type, and data, and does not include top-level business_id / business_external_id fields used by business-scoped webhooks.
Example export.completed payload:
export.completed, call Fetch export to retrieve the download_url.
See Webhooks for endpoint setup and signature verification, and the Event Catalog for the full list of event types.