Logs
6 min read
On this page5 sections
GET /api/v1/sources/{id}/logs
Searches a source's log lines. Same query language and
search as the log viewer UI; see the Query Language
docs for the field:value, level:error, status>=500, and free-text
syntax. Requires the logs:read ability.
Query parameters#
| Parameter | Type | Default | Notes |
|---|---|---|---|
q |
string | none (matches everything) | Query-language expression. At most 2000 characters and valid UTF-8. |
from |
ISO 8601 datetime | 1 hour before to |
Start of the time range, inclusive. |
to |
ISO 8601 datetime | now | End of the time range, inclusive. |
limit |
integer | 100 | 1 to 500. |
cursor |
string | none | Opaque token from a previous response's meta.next_cursor, for the next page. |
Time range rules#
from and to without an offset are read as UTC, and both bounds are
compared at millisecond precision. A request that breaks one of these rules is
refused with 422 (see Errors & Rate Limits),
with the offending field named in error.details:
frommust not be afterto.- Both dates must fall between 1900-01-01 and 2299-12-31, the range the log store can hold.
- The range may span at most 31 days by default (a Tailcove operator can change
this with
TAILCOVE_SEARCH_MAX_RANGE_DAYS; 31 covers the longest plan retention, 30 days). Fetch a longer period as several requests. - A date that does not parse is a
422too, never a server error.
q must be at most 2000 characters of valid UTF-8 and written in the
query language, or the request is a 422; the message names
the character where a query stops making sense (an unclosed parenthesis, an OR
with nothing after it).
Search text is literal: %, _ and \ in a word or phrase match themselves,
and a numeric comparison such as status>=abc with a value that is not a plain
number searches for that text in the message instead of comparing numbers. See
the Query Language.
Example#
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-07-03T00:00:00Z" \
--data-urlencode "to=2026-07-03T23:59:59Z"
{
"data": [
{
"source_id": "src_01jbx5q8k7m3n2p4r6s8t0v1w3",
"ts": "2026-07-03 18:41:02.418",
"level": "error",
"message": "Payment gateway timeout",
"host": "api-1"
}
],
"meta": {
"next_cursor": "eyJ0cyI6IjIwMjYtMDctMDMgMTg6NDE6MDIuNDE4IiwiaG9zdCI6ImFwaS0xIiwibGV2ZWwiOiJlcnJvciIsIm1lc3NhZ2UiOiJQYXltZW50IGdhdGV3YXkgdGltZW91dCIsInNraXAiOjF9"
}
}
meta.next_cursor is null once there are no more results. Pass it back as
cursor to fetch the next page, with the same q. The cursor carries the time
window of the first page (the one from and to gave, or the hour before the
first request when they were left out), so every page covers the same stretch of
time however long you take between requests; from and to sent with it are
not used:
curl -G https://tailcove.dev/api/v1/sources/src_01jbx5q8k7m3n2p4r6s8t0v1w3/logs \
-H "Authorization: Bearer YOUR_API_TOKEN" \
--data-urlencode "q=level:error" \
--data-urlencode "cursor=eyJ0cyI6IjIwMjYtMDctMDMgMTg6NDE6MDIuNDE4IiwiaG9zdCI6ImFwaS0xIiwibGV2ZWwiOiJlcnJvciIsIm1lc3NhZ2UiOiJQYXltZW50IGdhdGV3YXkgdGltZW91dCIsInNraXAiOjF9"
Cursors#
A cursor is an opaque, URL-safe string (base64url, no padding, so no character
in it needs escaping): treat it as a token and never build or edit one. It
names the position of the last row you were given, including how many identical
rows (same timestamp, host, level and message) were already returned, so a run
of identical lines that straddles a page boundary is neither skipped nor
repeated. Cursors issued by earlier versions (standard base64, without that
count) are still accepted and keep their old "strictly after this line"
meaning, so a client that is paging while Tailcove is updated is not broken. A
cursor issued before cursors carried a window pages with the request's own
from and to, so send the same ones with it.
A cursor that is malformed, was not issued by this endpoint, or is too long is a
422 ("The cursor is invalid or has expired."). Two cases need a narrower time
range or query rather than a retry:
- More than 100,000 identical rows in a row (one timestamp, host, level and message): paging cannot step past that run, and the next request is refused rather than silently skipping rows.
- A row whose host, level and message together hold more than about 96 KiB of
text cannot be the last row of a page, because its cursor would be refused.
Messages are cut at 64 KiB on ingest, so this takes an abnormal
hostor a line stored before that limit. A cursor that long can also be refused by the web server in front of the API when it is sent in a URL.
A source belonging to another team, or one that doesn't exist, or whose id is
not an id Tailcove issued, returns 404, per
Errors & Rate Limits. The token reads as the
person who created it: if that person is restricted to certain client groups,
sources outside them are 404 here too (see
API Authentication).
Correlate#
GET /api/v1/correlate
Every line that carries one id, across every source of the token's team that its
creator can see, oldest first: the API form of Correlate.
Requires the logs:read ability.
| Parameter | Type | Default | Notes |
|---|---|---|---|
id |
string | required | The id to follow: a trace id, a request id, or a field's value. At most 200 characters, no control characters. |
field |
string | the usual id keys | One top-level context key to look under (order_id). Without it: trace_id, request_id, correlation_id and spellings. |
at |
ISO 8601 datetime | none | The time of a line with the id; the window reaches both ways from it. |
window |
string | 15m around at, 1h before now |
One of 15m, 1h, 6h, 24h, 3d, 7d. |
limit |
integer | 500 | 1 to 500. |
curl -G https://tailcove.dev/api/v1/correlate \
-H "Authorization: Bearer YOUR_API_TOKEN" \
--data-urlencode "id=4bf92f3577b34da6a3ce929d0e0e4736" \
--data-urlencode "at=2026-11-25T10:00:00Z"
{
"data": [
{
"source_id": "src_01jbx5q8k7m3n2p4r6s8t0v1w3",
"ts": "2026-11-25 10:00:00.100",
"level": "info",
"message": "POST /checkout",
"host": "web-1",
"matched_key": "trace_id",
"context": { "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736", "user_id": 7 },
"context_truncated": false,
"message_truncated": false
}
],
"meta": {
"truncated": false,
"from": "2026-11-25T09:45:00.000000Z",
"to": "2026-11-25T10:15:00.000000Z",
"window": "15m",
"sources": [
{ "id": "src_01jbx5q8k7m3n2p4r6s8t0v1w3", "name": "checkout-api", "lines": 1, "errors": 0, "first": "2026-11-25T10:00:00.100000Z", "last": "2026-11-25T10:00:00.100000Z" }
],
"spans": []
}
}
context is the line's fields as an object; when they are longer than 4,000
characters it is the first 4,000 as text and context_truncated is true.
meta.truncated says the list stopped at limit; meta.sources holds the
true count of lines and errors per source either way. For a 32-hex trace id,
meta.spans says how many spans of the trace each source received, how long it
ran (duration_us) and which services took part. There is no cursor: narrow
the window, or page through one source with the search endpoint above.
Still stuck?
Email us and we will help you get it working.