# Get sandbox logs (v2) (/docs/api-reference/sandboxes/get-sandbox-logs-v2)

<!-- agent-signals: reading_time_min: 2 · est_tokens: 1280 · updated: 2026-07-30 -->
Related: [List sandboxes](/docs/api-reference/sandboxes/list-sandboxes.md), [Create sandbox](/docs/api-reference/sandboxes/create-sandbox.md), [List sandboxes (v2)](/docs/api-reference/sandboxes/list-sandboxes-v2.md), [List sandbox metrics](/docs/api-reference/sandboxes/list-sandbox-metrics.md), [Get sandbox logs](/docs/api-reference/sandboxes/get-sandbox-logs.md), [Get sandbox](/docs/api-reference/sandboxes/get-sandbox.md)

# Get sandbox logs (v2)

`GET /v2/sandboxes/{sandboxID}/logs`

Get sandbox logs

## OpenAPI

```json
{
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "parameters": [
    {
      "name": "sandboxID",
      "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": 1000,
        "type": "integer",
        "format": "int32",
        "minimum": 0,
        "maximum": 1000
      },
      "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"
        ]
      },
      "description": "Direction of the logs that should be returned"
    },
    {
      "in": "query",
      "name": "level",
      "schema": {
        "type": "string",
        "description": "Severity level for log entries (e.g. info, warn, error)"
      },
      "description": "Minimum log level to return. Logs below this level are excluded"
    },
    {
      "in": "query",
      "name": "search",
      "schema": {
        "type": "string",
        "maxLength": 256
      },
      "description": "Case-sensitive substring match on log message content"
    }
  ],
  "responses": {
    "200": {
      "description": "Successfully returned the sandbox logs",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "logs"
            ],
            "properties": {
              "logs": {
                "default": [],
                "description": "Sandbox logs structured",
                "type": "array",
                "items": {
                  "required": [
                    "timestamp",
                    "level",
                    "message",
                    "fields"
                  ],
                  "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)"
                    },
                    "fields": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "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"
          }
        }
      }
    }
  }
}
```
