List build logs
Retrieve the build output of a deployment as a list of log entries, in the order the build printed them. A log entry is one chunk of build output, and can contain several lines or part of a line.
Poll this endpoint to follow a running build:
- Send the
pagination.cursorof the last response ascursor. The response contains only the entries after it. - When
hasMoreis true, request again now. - When
hasMoreis false, you have all entries so far. Wait, then request again with the same cursor. - The cursor is absent only when the request had no cursor and the build has no entries yet.
- A response can contain fewer than
limitentries and still havehasMore: truewhen the entries are large.
New entries become visible up to a few seconds after the build prints
them. To know that a build is done, check the deployment status with
getDeployment. After the status is no longer building, request until
you get an empty response at least 5 seconds later.
When a build attempt is retried, an entry from the earlier attempt can arrive after the cursor has moved past it, and a poll does not return it. A request without a cursor returns it. A deployment from a prebuilt image has no build and returns no entries. Build logs are kept for 3 months.
Required Permissions
Your root key must have the following permission:
unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/deployments/<deployment_id>/buildLogs#read
Authorizations
Unkey uses bearer tokens for authentication. Public integrations use root keys, while the dashboard proxy uses short-lived JWTs. To authenticate, include the token in the Authorization header of each request:
Root keys have specific permissions attached to them, controlling what operations they can perform. Resource permissions use Unkey Resource Names plus actions, like unkey:v1:ws_123:projects/*/keyspaces/*/keys/*#write.
Security best practices:
- Keep root keys secure and never expose them in client-side code
- Use different root keys for different environments
- Rotate keys periodically, especially after team member departures
- Create keys with minimal necessary permissions following least privilege principle
- Monitor key usage with audit logs.
Body
Retrieve the build log entries of a deployment. Get the deployment id from
createDeployment or listDeployments.
Return only the log entries of this build step. Use the stepId of an
entry from a previous response. An unknown step returns no entries.
Omit this field to return the entries of every step.
1 - 256"sha256:3f9c2b7e1d4a6f8c0b5e9d2a7c4f1e8b3d6a9c2f5e8b1d4a7c0f3e6b9d2a5c8f"
Response
Successfully retrieved the build log entries.