Get Event Export
curl --request GET \
--url https://app.cometly.com/public-api/v1/events/exports/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.cometly.com/public-api/v1/events/exports/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.cometly.com/public-api/v1/events/exports/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.cometly.com/public-api/v1/events/exports/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.cometly.com/public-api/v1/events/exports/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.cometly.com/public-api/v1/events/exports/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cometly.com/public-api/v1/events/exports/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"export_id": 123,
"status": "<string>",
"created_at": "<string>",
"message": "<string>",
"download_url": "<string>",
"completed_at": "<string>",
"expires_at": "<string>"
}Events
Get Event Export
Check the status of an export job and retrieve the download URL when ready
GET
/
public-api
/
v1
/
events
/
exports
/
{id}
Get Event Export
curl --request GET \
--url https://app.cometly.com/public-api/v1/events/exports/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.cometly.com/public-api/v1/events/exports/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.cometly.com/public-api/v1/events/exports/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.cometly.com/public-api/v1/events/exports/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.cometly.com/public-api/v1/events/exports/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.cometly.com/public-api/v1/events/exports/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cometly.com/public-api/v1/events/exports/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"export_id": 123,
"status": "<string>",
"created_at": "<string>",
"message": "<string>",
"download_url": "<string>",
"completed_at": "<string>",
"expires_at": "<string>"
}Overview
This endpoint retrieves the current status of an export job created with the Create Event Export endpoint. Once the export is complete, it provides a presigned download URL for the exported file. Poll this endpoint regularly to check when your export is ready for download.Path Parameters
integer
required
The export ID returned from the Create Event Export endpoint.Example:
123Response
Export Status Fields
integer
The unique identifier for this export job
string
Current status of the export jobPossible values:
queued- Export job is waiting to be processedprocessing- Export is currently being generatedcompleted- Export is complete and ready for downloadfailed- Export failed
string
ISO 8601 timestamp when the export was created
string
User-friendly status message (present when status is
queued, processing, or failed)Additional Fields (When Status = completed)
string
Presigned S3 URL to download the export file. This URL expires after 15 minutes for security.The file is in gzipped NDJSON format (Newline-Delimited JSON, compressed with gzip).
string
ISO 8601 timestamp when the export finished processing
string
ISO 8601 timestamp when the download URL will expire (15 minutes from request time)
Example Requests
# Check export status
curl -G "https://app.cometly.com/public-api/v1/events/exports/123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json"
// Check export status
const exportId = 123;
const response = await fetch(`https://app.cometly.com/public-api/v1/events/exports/${exportId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json'
}
});
const exportData = await response.json();
console.log(`Status: ${exportData.status}`);
if (exportData.status === 'completed') {
console.log(`Download URL: ${exportData.download_url}`);
console.log(`Expires at: ${exportData.expires_at}`);
}
<?php
// Check export status
$exportId = 123;
$baseUrl = "https://app.cometly.com/public-api/v1/events/exports/{$exportId}";
$headers = [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $baseUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$exportData = json_decode($response, true);
curl_close($ch);
echo "Status: {$exportData['status']}\n";
if ($exportData['status'] === 'completed') {
echo "Download URL: {$exportData['download_url']}\n";
echo "Expires at: {$exportData['expires_at']}\n";
}
?>
import requests
# Check export status
export_id = 123
base_url = f'https://app.cometly.com/public-api/v1/events/exports/{export_id}'
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json'
}
response = requests.get(base_url, headers=headers)
export_data = response.json()
print(f"Status: {export_data['status']}")
if export_data['status'] == 'completed':
print(f"Download URL: {export_data['download_url']}")
print(f"Expires at: {export_data['expires_at']}")
Example Responses
Queued Export
{
"export_id": 123,
"status": "queued",
"created_at": "2024-01-15T10:30:00Z",
"message": "Export is being processed. Please check back in a few minutes."
}
Processing Export
{
"export_id": 123,
"status": "processing",
"created_at": "2024-01-15T10:30:00Z",
"message": "Export is being processed. Please check back in a few minutes."
}
Completed Export
{
"export_id": 123,
"status": "completed",
"created_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:33:42Z",
"download_url": "https://bucket.s3.amazonaws.com/exports/a3f2c8d9-1234-5678-9abc-def012345678.json.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&...",
"expires_at": "2024-01-15T10:48:42Z"
}
Failed Export
{
"export_id": 123,
"status": "failed",
"created_at": "2024-01-15T10:30:00Z",
"message": "Export failed. Please try again in a few minutes. If the problem persists, contact support."
}
Status Codes
| Status Code | Description |
|---|---|
| 200 | Export status retrieved successfully |
| 401 | Missing or invalid API key |
| 403 | API key doesn’t have permission or subscription is inactive |
| 404 | Export not found or belongs to a different space |
| 429 | Too many requests - rate limit exceeded. See Rate Limiting |
Notes
- Rate Limit: This endpoint has a limit of 30 requests per minute per Space. See Rate Limiting for details.
- Download URL Expiration: The presigned download URL expires 15 minutes after you retrieve it. If it expires, make another GET request to this endpoint to get a fresh URL.
- Space Isolation: You can only access exports created by your space. Attempting to access another space’s export returns 404.
- File Security: Export files use UUID-based filenames to prevent enumeration. Download URLs are cryptographically signed and time-limited.
- Processing Time: Exports typically complete within seconds to a few minutes. Large exports (100,000+ events) may take longer.
- Retry Logic: If an export fails, create a new export job rather than retrying the same one.
- Storage: Export files are stored for retrieval but should be downloaded promptly. Don’t rely on long-term storage of export files in Cometly’s system.
See Also
- Create Event Export - Create a new export job
- Exports vs Pagination - Understand when to use exports
- List Events - Alternative for smaller datasets