Skip to main content
POST
https://api-dev.weir.ai/
/
console
/
logs
/
export
curl -X POST 'https://api.weir.ai/console/logs/export' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'x-source: console' \
  -d '{
    "format": "csv",
    "startDate": "2024-01-01",
    "endDate": "2024-01-31",
    "type": "ERROR"
  }'
{
  "data": {
    "exportId": "export_123456789",
    "format": "csv",
    "status": "processing",
    "downloadUrl": null,
    "expiresAt": "2024-01-23T15:30:00Z"
  },
  "message": "Log export initiated successfully",
  "status": "success"
}

Export Logs

Export organization logs to CSV or JSON format for analysis or archival.
curl -X POST 'https://api.weir.ai/console/logs/export' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'x-source: console' \
  -d '{
    "format": "csv",
    "startDate": "2024-01-01",
    "endDate": "2024-01-31",
    "type": "ERROR"
  }'
{
  "data": {
    "exportId": "export_123456789",
    "format": "csv",
    "status": "processing",
    "downloadUrl": null,
    "expiresAt": "2024-01-23T15:30:00Z"
  },
  "message": "Log export initiated successfully",
  "status": "success"
}

Request Body

format
string
required
Export format: “csv” or “json”.
startDate
string
Start date for logs (YYYY-MM-DD).
endDate
string
End date for logs (YYYY-MM-DD).
type
string
Filter by log type (INFO, WARNING, ERROR).

Usage Examples

const exportLogs = async (exportOptions, accessToken) => {
  const response = await fetch('https://api.weir.ai/console/logs/export', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${accessToken}`,
      'Content-Type': 'application/json',
      'x-source': 'console'
    },
    body: JSON.stringify(exportOptions)
  });
  if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
  return await response.json();
};
Export may take time for large datasets. Check the export status and download when ready.