Start an export of a site's logs
Starts a file of the site's matching lines, up to 50,000 lines or 64 MiB, and answers the export with its capability, which is shown only once. Read the export with GET / until state is ready, then collect the file once, within 24 hours.
Path parameters
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
Body
The site row id of another environment of the same website to read instead of {site}. At least 1.
Filters applied beside the query.
The start of the time range, as a date and time. It must be inside the time your logs are kept for.
A LogsQL query, sent as written. Every line when left out. Up to 4 KB. Up to 4,096 characters.
How far back from now to read. One hour when neither range nor from is sent. Ignored when from is sent.
env reads the one environment. site reads every environment of the website that you can see. Defaults to env.
envsitenullA log source. all reads every source. search and queue exist only on platforms that run them; the sources list says which ones an environment has. Defaults to all.
allweb-accessweb-errorphpappcrondatabasecachesearchqueueThe end of the time range, as a date and time. Now when left out.
csv, or json for one JSON object a line.
csvjsonReturns
202 The export, which is being prepared, and its one-time capability. Poll the operation until it finishes.
Fields of the 202 answer
What opens the file, once. Answered here and never again.
An export of log lines.
Fields
The size of the file. Null until it is ready.
Why the export failed. Null otherwise.
When the export can no longer be collected. Format: date-time.
csvjsonThe {download} of the export endpoints.
The lines in the file. Null until it is ready.
preparing, then ready. expired once it was collected or its time ran out. failed when it could not be made.
preparingreadyexpiredfailedTrue when the file was cut at 50,000 lines or 64 MiB.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
409 | logs_not_collected | Logs are not being collected for the environment yet. Try again later, or contact support. |
409 | logs_range | The time range is outside the days logs are kept for. Choose a range inside the days the message names. |
409 | logs_unavailable | Logs could not be read, or are not collected for the site yet. Read the message; try again shortly. |
409 | query_too_wide | The search covers too much. Choose a shorter range or a narrower search. |
422 | invalid | Fix the field named in field; errors says why. |
429 | rate_limited | Wait for the seconds in Retry-After. |
503 | logs_busy | Logs are busy at the moment. Try again in a few seconds. |
503 | logs_cluster_unavailable | Logs are not available at the moment. Try again shortly. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/logs/exports \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"format": "csv",
"range": "24h",
"source": "web-access"
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/corestack/sites/1042/logs/exports', [
'format' => 'csv',
'range' => '24h',
'source' => 'web-access',
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/logs/exports', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
format: 'csv',
range: '24h',
source: 'web-access',
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.post(
"https://manage.corefinity.com/api/corestack/sites/1042/logs/exports",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"format": "csv",
"range": "24h",
"source": "web-access",
},
)
data = res.json() if res.content else None{
"capability": "Example-export-capability-0000000000000000000001",
"download": {
"bytes": null,
"error": null,
"expires_at": "2026-11-04T10:00:00Z",
"format": "csv",
"id": "01JB2Y8N7Q4X3R5T6V8W9Z0A1B",
"lines": null,
"state": "preparing",
"truncated": false
}
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "logs_not_collected",
"message": "Logs are not being collected for this environment yet",
"reason": "logs_not_collected"
}{
"code": "invalid",
"errors": {
"query": [
"Keep the query under 4 KB."
]
},
"field": "query",
"message": "Keep the query under 4 KB.",
"reason": "invalid"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}{
"code": "logs_busy",
"message": "Logs are busy at the moment. Try again in a few seconds",
"reason": "logs_busy"
}Try it is off for this endpointIt has not been cleared for the console. Copy the request and run it yourself when you are sure.