# Get build logs (/docs/api-reference/templates/get-build-logs)

<!-- agent-signals: reading_time_min: 2 · est_tokens: 1329 · updated: 2026-07-30 -->
Related: [Create template (v3)](/docs/api-reference/templates/create-template-v3.md), [List templates (v2)](/docs/api-reference/templates/list-templates-v2.md), [Create template (v2)](/docs/api-reference/templates/create-template-v2.md), [Get build upload link](/docs/api-reference/templates/get-build-upload-link.md), [List templates](/docs/api-reference/templates/list-templates.md), [Create template](/docs/api-reference/templates/create-template.md)

# Get build logs

`GET /templates/{templateID}/builds/{buildID}/logs`

Get template build logs

## OpenAPI

```json
{
  "security": [
    {
      "AccessTokenAuth": []
    },
    {
      "ApiKeyAuth": []
    }
  ],
  "parameters": [
    {
      "name": "templateID",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "buildID",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "schema": {
        "type": "integer",
        "format": "int64",
        "minimum": 0
      },
      "description": "Starting timestamp of the logs that should be returned in milliseconds"
    },
    {
      "in": "query",
      "name": "limit",
      "schema": {
        "default": 100,
        "type": "integer",
        "format": "int32",
        "minimum": 0,
        "maximum": 100
      },
      "description": "Maximum number of logs that should be returned"
    },
    {
      "in": "query",
      "name": "direction",
      "schema": {
        "type": "string",
        "description": "Direction of the logs that should be returned",
        "enum": [
          "forward",
          "backward"
        ],
        "x-enum-varnames": [
          "LogsDirectionForward",
          "LogsDirectionBackward"
        ]
      }
    },
    {
      "in": "query",
      "name": "level",
      "schema": {
        "type": "string",
        "description": "Severity level for log entries (e.g. info, warn, error)"
      }
    },
    {
      "in": "query",
      "name": "source",
      "schema": {
        "type": "string",
        "description": "Source of the logs that should be returned",
        "enum": [
          "temporary",
          "persistent"
        ],
        "x-enum-varnames": [
          "LogsSourceTemporary",
          "LogsSourcePersistent"
        ]
      },
      "description": "Source of the logs that should be returned from"
    }
  ],
  "responses": {
    "200": {
      "description": "Successfully returned the template build logs",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "logs"
            ],
            "properties": {
              "logs": {
                "default": [],
                "description": "Build logs structured",
                "type": "array",
                "items": {
                  "required": [
                    "timestamp",
                    "message",
                    "level"
                  ],
                  "properties": {
                    "timestamp": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Timestamp of the log entry"
                    },
                    "message": {
                      "type": "string",
                      "description": "Log message content"
                    },
                    "level": {
                      "type": "string",
                      "description": "Severity level for log entries (e.g. info, warn, error)"
                    },
                    "step": {
                      "type": "string",
                      "description": "Step in the build process related to the log entry"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "type": "object"
          }
        }
      }
    },
    "401": {
      "description": "Authentication error",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Error code"
              },
              "message": {
                "type": "string",
                "description": "Error"
              }
            },
            "type": "object"
          }
        }
      }
    },
    "404": {
      "description": "Not found",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Error code"
              },
              "message": {
                "type": "string",
                "description": "Error"
              }
            },
            "type": "object"
          }
        }
      }
    },
    "500": {
      "description": "Server error",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Error code"
              },
              "message": {
                "type": "string",
                "description": "Error"
              }
            },
            "type": "object"
          }
        }
      }
    }
  }
}
```
