Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Trace API

Every route of the Currents trace API, with its options and real output: the trace summary, the player, screen frames, filmstrips and animations, the page at any time in five formats, network requests

The trace API lets an agent read a Playwright trace one part at a time. Each trace has its own trace API link. Add a path to the link to get one part of the trace: the summary, the page at a moment, a network request, or an image. This page lists every route with its options and real output. For how an agent uses the trace API, see Explore a trace.

The REST API needs an API key with results:read; a Read Only key is enough. To get a link for a test from a script, use the IDs in the test's dashboard link, /instance/<instanceId>/test/<testId>. ttlSeconds sets how long the link lasts:

curl -X POST https://api.currents.dev/v1/instances/$INSTANCE_ID/trace-link \
  -H "Authorization: Bearer $CURRENTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"testId": "'$TEST_ID'", "ttlSeconds": 604800}'

The response has the trace API link in data.url and its expiry time in data.expiresAt. For a trace in a session, use POST /v1/sessions/{sessionId}/attachments/{attachmentId}/trace-link.

For who can open a trace API link and how long it lasts, see Share links.

Routes

Every route is a GET on the trace API link. The full specification is at t.crts.sh/docs, and as OpenAPI at t.crts.sh/openapi.json.

Route
Returns

The summary: the actions with their times, the failed action, page errors, console errors and failed requests. Start here.

A player for people: the screencast, the actions and the frames

The list of screen frames, or one frame as an image

Frames from the whole recording in one image

The recording as an animated image

The list of page snapshots, or the page at one moment in five formats

The files the test saved in the trace

The trace zip

Times (t) are milliseconds from the start of the trace; the summary gives the time of each action. A route that takes t returns the frame or snapshot at or before that time.

The examples on this page come from two traces. Each example says which:

  • A failed test, SAVE10 takes 10% off the total. The test expected a total of $206.55 and got $183.60.

  • The checkout session from Explore a trace, where the Apply button stays on Applying…. Nothing in it failed, but the page threw a TypeError.

Summary

Route
Returns

/digest

The actions with their times, the failed action and its error, page errors, console errors, failed requests, the files in the trace, and the screencast

Parameter
Values

format

json (default) or md

timeline

auto (default) keeps the actions near the failure and leaves out the rest. full lists every action.

/digest?format=md is the first call. It names the failed action and its error, links to the screen and the page at the failure, and lists the actions with their times.

/digest?format=md, the failed test, shortened:

/digest, the checkout session, shortened:

Player

Route
Returns

No path

A page for people: the screencast, the actions with their times, the frames, and a link to the Playwright Trace Viewer

The checkout session:

The trace API player: the screencast of the checkout with a play button and frame thumbnails, and the list of 9 actions with their times, 0 failed, 3 requests
The trace API link without a path: the checkout session in the player

Screen frames

Route
Returns

/frames

The list of screen frames, with the time of each

/frames/failure

The frame when the test failed. When nothing failed, the last frame.

/frames/{t}

The frame at or before time t

Parameter
Values

format

jpeg (default) or webp

width

16 to 3840: a WebP of this width

placeholder

1, on /frames/failure only. See Placeholders.

Response header
Value

x-trace-timestamp

The time of the frame returned

content-location

The time of the frame returned, as a path next to the one asked for

x-dashboard-url

On /frames: the test's page in the Currents dashboard, when the link names a test. Opening it needs a Currents login.

/frames, the checkout session, shortened:

/frames/2464 in the checkout session returns the frame from before that time, and says which in its headers:

/frames/failure, the failed test:

The checkout at the failure: SAVE10 applied, a discount of −$22.95 and a total of $183.60
/frames/failure: the screen when the test failed

Filmstrip

Route
Returns

/filmstrip

Frames from the whole recording in one WebP image

Parameter
Values

frames

2 to 25. Default 9.

width

The width of each frame, 64 to 1280. Default 320.

height

The largest height of each frame, 16 to 1280

layout

grid (default) or row

end

failure: stop at the frame /frames/failure returns, the last one before the failure, and outline it in red. When nothing failed, the whole recording with no outline.

placeholder

1. See Placeholders.

Response header
Value

x-filmstrip-timestamps

The time of each frame, such as [678,1787,2498,3981]

/filmstrip?frames=4&width=640, the checkout session:

Four frames of the checkout in a grid: the empty discount field, save10 being typed, then twice the Apply button greyed out as Applying… with the total unchanged at $229.50
/filmstrip?frames=4&width=640: four frames of the checkout session

/filmstrip?end=failure&layout=row&width=480, the failed test. The trace has three frames up to the failure, and the last one has a red outline:

Three frames of the checkout in one row: save10 typed into the discount field with a total of $229.50, then the same, then outlined in red: SAVE10 applied: 10% off, a discount of −$22.95 and a total of $183.60
/filmstrip?end=failure&layout=row&width=480: the failed test up to the failure

Animation

Route
Returns

/animation

The recording as an animated image

Parameter
Values

format

webp (default) or gif

frames

1 to 150. Default 60. A trace with fewer frames gives fewer.

width

The largest width, 16 to 2560. Default 720.

quality

The quality of a WebP, 1 to 100. Default 75.

overlay

progress: draw the frame number, such as 11/12, in the bottom right corner of each frame

Response header
Value

x-animation-frames

The frames in the animation

x-animation-source-frames

The frames in the trace

/animation?overlay=progress&width=640, the checkout session. The trace has 12 frames, so x-animation-frames and x-animation-source-frames are both 12:

An animation of the checkout with the frame number in the bottom right corner: save10 is typed into the discount field, Apply is clicked, and the button stays on Applying… while the total stays at $229.50
/animation?overlay=progress&width=640: the checkout session as a WebP, with the frame number

Page snapshots

Route
Returns

/snapshots

The list of page snapshots, with the time of each

/snapshots/failure

The page when the test failed. When nothing failed, the last snapshot.

/snapshots/{id}

One snapshot. {id} is a time, or a name from the list when the trace has names.

Parameter
Values

format

json (default): the snapshot's entry and the formats it has. text, aria, dom or html: the page.

placeholder

1, on /snapshots/failure?format=html only. See Placeholders.

Response header
Value

x-trace-timestamp

The time of the snapshot returned

content-location

The snapshot returned, as a path next to the one asked for, such as 2463.971?format=text

/snapshots, the checkout session, shortened. callId is the action in the summary that took the snapshot:

/snapshots/2464, the checkout session:

The four page formats, from the failed test:

/snapshots/failure?format=text returns the page text, with input values and buttons:

/snapshots/failure?format=aria returns the accessibility tree, in the format of Playwright's ariaSnapshot(). Roles and names come from the HTML only, so an element that a stylesheet hides still shows:

/snapshots/failure?format=dom returns the HTML of the page as plain text, to search or compare. Part of it:

/snapshots/failure?format=html returns a page that a browser opens with the styles from the trace. The trace API removes the scripts, so buttons and links do nothing. Opened in a browser:

The checkout page rebuilt from the DOM snapshot at the failure: save10 in the discount field, SAVE10 applied: 10% off, a discount of −$22.95 and a total of $183.60
/snapshots/failure?format=html: the page when the test failed, opened in a browser

Network requests

Route
Returns

/requests

The requests the page made

/requests/{index}

One request

/requests/{index}/body

The body the server returned

/requests/{index}/request-body

The body the page sent

Parameter
Values

status

4xx, 5xx, failed, or a status code such as 404. failed is a request that got no response, or a 4xx or 5xx response.

url

Text that the URL contains

requestBody

Text that the body the page sent contains, such as a GraphQL operation name. Up to 1000 characters. When the bodies to search are over 32 MB together, it returns 422: filter with url or status first.

format

json (default) or har: a HAR 1.2 file without bodies, which opens in the browser's developer tools

/requests?url=app.js, the checkout session:

/requests/2 returns the same request as one object. bodySha1 is null because the trace has no body for this response, so /requests/2/body returns 404.

In the failed test, every GraphQL call goes to the same /graphql URL, so /requests?requestBody=ApplyDiscount finds the call by the operation name it sent:

Then /requests/7/request-body and /requests/7/body:

The server sent a total of 18360 cents: the subtotal minus the discount, twice. The bug is in the server, not in the page.

/requests?format=har, the checkout session, shortened:

A wrong status returns 400 with the values it takes: {"error":"status must be 4xx, 5xx, failed, or a 3-digit code"}.

Attachments

Route
Returns

/attachments

The files the test saved in the trace, such as the video, the screenshot and error-context, with the name, content type and SHA-1 hash of each

/attachments/{id}

One file, by its hash or its name, with the file's own content type

Parameter
Values

name

On /attachments: text that the file name contains, such as /attachments?name=error

Response header
Value

x-attachment-name, x-attachment-sha1

On /attachments/{id}: the name and the SHA-1 hash of the file returned

A retry can save a file with the same name again, so a name returns the last file with that name.

/attachments, the failed test. callId is the step that saved the file:

/attachments/error-context is the failure summary that Playwright writes for an agent: the test name, the error, the element at the failure as an accessibility tree, and the test source. The failed test, shortened:

The checkout session has no files, so its /attachments returns [].

Trace zip

Route
Returns

/download

The trace zip, as trace.zip

To open it in Playwright's trace viewer, give the viewer the link: https://trace.playwright.dev/?trace=<trace API link>/download.

Placeholders

/filmstrip, /frames/failure and /snapshots/failure?format=html take placeholder=1. With it, they return a grey image or a short page with status 200 instead of an error. Use it for images in a pull request comment, so that they do not break after the link expires.

Response header
Value

x-placeholder

Why a placeholder was returned. notFound: the link is wrong or expired. routeError: the trace has nothing to show, such as no screen frames, or a parameter is wrong. unavailable: the trace could not be read.

A filmstrip of an expired link, /filmstrip?placeholder=1&width=640:

A grey box with the text This link has expired
/filmstrip?placeholder=1&width=640 after the link expires

Last updated

Was this helpful?