Query your logs from scripts with the API
Create a read-only API token and pull search results into scripts, reports and your own tools, with cursor pagination.
Before you start
- A Tailcove source with logs
- curl or Python 3
The read API exposes the same search as the log viewer, so anything you can find in the UI you can also fetch from a script: a nightly error report, a CLI for your team, or a check in your deploy pipeline.
On this page7 sections
1. Create an API token#
Open your user menu, go to Settings → API tokens, and create a token with the logs:read ability. Add issues:read too if you want to list grouped errors.
The token is shown once. It is scoped to the team you were working in, and it reads as you: if you leave the team, it stops working.
2. Find your source id#
curl https://tailcove.dev/api/v1/sources \
-H "Authorization: Bearer YOUR_API_TOKEN"
Each source in the response has an id, a public id such as src_01jbx5q8k7m3n2p4r6s8t0v1w3.
3. Search a time range#
curl -G https://tailcove.dev/api/v1/sources/src_01jbx5q8k7m3n2p4r6s8t0v1w3/logs \
-H "Authorization: Bearer YOUR_API_TOKEN" \
--data-urlencode "q=level:error" \
--data-urlencode "from=2026-10-19T00:00:00Z" \
--data-urlencode "to=2026-10-19T23:59:59Z" \
--data-urlencode "limit=500"
q uses the same query language as the search bar. Without from, the API searches the hour before to. A single request can span at most 31 days.
4. Page through results#
Responses include meta.next_cursor. Pass it back as cursor, with the same q, from and to, until it is null. In Python:
import os
import requests
API = "https://tailcove.dev/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['TAILCOVE_API_TOKEN']}"}
def errors(source_id, start, end):
params = {"q": "level:error", "from": start, "to": end, "limit": 500}
while True:
response = requests.get(f"{API}/sources/{source_id}/logs", headers=HEADERS, params=params)
response.raise_for_status()
body = response.json()
yield from body["data"]
if not body["meta"]["next_cursor"]:
break
params["cursor"] = body["meta"]["next_cursor"]
for line in errors("src_01jbx5q8k7m3n2p4r6s8t0v1w3", "2026-10-19T00:00:00Z", "2026-10-19T23:59:59Z"):
print(line["ts"], line["host"], line["message"])
Treat cursors as opaque: never build or edit one.
5. Respect the rate limit#
Each token can make 60 requests per minute. With limit=500 that is plenty for reports; if you hit 429, wait and retry rather than opening more tokens.
Ideas#
- A daily summary of error counts per host, posted to your team chat.
- A deploy-pipeline step that fails if new errors appear in the minutes after a release. The deploy check does this for you:
tailcove deploy --waitexits1when a release made errors worse. - A quick terminal command for the queries you run most. The
tailcovecommand line tool wraps this endpoint:tailcove searchpages through it, and--jsonhands each line tojq.
Next steps#
- Endpoint details in the logs API reference.
- Error codes in errors and rate limits.
Ready to try it on your own logs?
The Free plan includes a source, live tail, search and alerts. No credit card.