> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Query Logs

GET https://api.bigcommerce.com/stores/{store_hash}/v3/infrastructure/logs/{project_uuid}

Returns historical worker logs for a project within a time window. Supports filtering by HTTP method, status code, URL, and minimum severity level, plus cursor-based pagination.

The `start` and `end` query parameters are both required, and the window between them cannot exceed 7 days.

> **Note**: To stream logs in real time instead, use the [Tail Worker Logs](#tail-worker-logs) endpoint.

Reference: https://docs.bigcommerce.com/developer/api-reference/rest/admin/management/infrastructure-hosting/logs/query-logs

## Authentication

- `X-Auth-Token` header (required) — ### OAuth scopes | UI Name | Permission | Parameter | |:--------|:-----------|:----------| | Infrastructure Deployments | read-only | `store_infrastructure_deployments_read_only` | | Infrastructure Deployments | create preview | `store_infrastructure_deployments_create_preview` | | Infrastructure Deployments | manage | `store_infrastructure_deployments_manage` | | Infrastructure Projects | read-only | `store_infrastructure_projects_read_only` | | Infrastructure Projects | manage | `store_infrastructure_projects_manage` | | Infrastructure Logs | read-only | `store_infrastructure_logs_read_only` | ### Authentication header | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#api-accounts). | ### Further reading For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-fundamentals/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).

## Request

### Path parameters

- `project_uuid` (string, required) — The UUID of the project to query logs for.
- `store_hash` (string, required) — Permanent ID of the BigCommerce store.

### Query parameters

- `start` (string, required) — The start of the time window to query. Accepts an RFC 3339 timestamp or a Unix epoch in seconds. Must be before `end`.
- `end` (string, required) — The end of the time window to query. Accepts an RFC 3339 timestamp or a Unix epoch in seconds. The window between `start` and `end` cannot exceed 7 days.
- `method` (string, optional) — Filter logs by HTTP method, for example `GET`.
- `status_code` (integer, optional) — Filter logs by HTTP response status code. Must be between 100 and 599.
- `url:like` (string, optional) — Filter logs by a partial match on the request URL.
- `level:min` (enum, optional) — Filter logs to only those at or above the given severity level.
  - Allowed values: `debug`, `info`, `warn`, `error`
- `limit` (integer, optional, default: 50) — The number of results to return per page. Defaults to 50.
- `after` (string, optional) — Cursor for forward pagination. Returns results after this cursor.
- `before` (string, optional) — Cursor for backward pagination. Returns results before this cursor.

## Response

### 200

The request completed successfully.

- `data` (list of LogEntry, optional)
- `meta` (CursorPaginationMeta, optional) — Meta information including cursor-based pagination.

## Errors

### 400 Bad Request Error

The project UUID is not a valid UUID.

- `status` (integer, optional) — The HTTP status code.
- `title` (string, optional) — A description of the error.
- `type` (string, optional) — A URL identifying the error type.
- `errors` (ErrorResponseErrors, optional) — Additional error details.
- `meta` (map from string to any, optional) — Additional structured context for the error, such as the ownership-verification TXT record to publish, the conflicting `project_uuid`, or the domain `limit` and `current` count.

### 404 Not Found Error

The specified project was not found.

- `status` (integer, optional) — The HTTP status code.
- `title` (string, optional) — A description of the error.
- `type` (string, optional) — A URL identifying the error type.
- `errors` (ErrorResponseErrors, optional) — Additional error details.
- `meta` (map from string to any, optional) — Additional structured context for the error, such as the ownership-verification TXT record to publish, the conflicting `project_uuid`, or the domain `limit` and `current` count.

### 422 Unprocessable Entity Error

The request could not be processed because a query parameter is missing or invalid, or the time window exceeds 7 days.

- `status` (integer, optional) — The HTTP status code.
- `title` (string, optional) — A description of the error.
- `type` (string, optional) — A URL identifying the error type.
- `errors` (ErrorResponseErrors, optional) — Additional error details.
- `meta` (map from string to any, optional) — Additional structured context for the error, such as the ownership-verification TXT record to publish, the conflicting `project_uuid`, or the domain `limit` and `current` count.

## Types

### LogEntry

A single historical worker log entry returned by the Query Logs endpoint.

- `id` (string, optional) — The unique identifier for this log entry.
- `timestamp` (datetime, optional, nullable) — The timestamp of the log entry, in RFC 3339 format.
- `level` (enum, optional) — The severity level of the log entry.
  - Allowed values: `debug`, `info`, `warn`, `error`, `unknown`
- `messages` (list of string, optional) — The log message content.
- `is_exception` (boolean, optional) — Whether this log entry represents an exception.
- `exception_name` (string, optional) — The name or type of the exception, if `is_exception` is `true`. Empty otherwise.
- `request` (LogEntryRequest, optional, nullable) — HTTP request information associated with this log entry, if applicable.

### CursorPaginationMeta

Meta information including cursor-based pagination.

- `cursor_pagination` (CursorPaginationMetaCursorPagination, optional)

### ErrorResponseErrors

Additional error details.

### LogEntryRequest

HTTP request information associated with this log entry, if applicable.

- `method` (string, optional) — The HTTP method.
- `url` (string, optional) — The request URL.
- `status_code` (integer, optional) — The HTTP response status code.

### CursorPaginationMetaCursorPagination

- `count` (integer, optional) — The number of items in the current page.
- `per_page` (integer, optional) — The number of items per page.
- `start_cursor` (string, optional) — The cursor marking the start of the current page.
- `end_cursor` (string, optional) — The cursor marking the end of the current page.
- `links` (CursorPaginationMetaCursorPaginationLinks, optional)

### CursorPaginationMetaCursorPaginationLinks

- `previous` (string, optional) — The relative URL for the previous page.
- `next` (string, optional) — The relative URL for the next page.

## Examples

**Response**

```json
{
  "data": [
    {
      "id": "log-1",
      "timestamp": "2024-06-15T10:30:00Z",
      "level": "info",
      "messages": [
        "Request processed successfully"
      ],
      "is_exception": false,
      "exception_name": "",
      "request": {
        "method": "GET",
        "url": "/products",
        "status_code": 200
      }
    }
  ],
  "meta": {
    "cursor_pagination": {
      "count": 1,
      "per_page": 50,
      "start_cursor": "abc123",
      "end_cursor": "def456",
      "links": {}
    }
  }
}
```

**SDK Code**

```python Response
import requests

url = "https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/logs/project_uuid"

querystring = {"end":"2024-06-15T11:00:00Z","start":"2024-06-15T10:00:00Z"}

headers = {"X-Auth-Token": "<apiKey>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Response
const url = 'https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/logs/project_uuid?end=2024-06-15T11%3A00%3A00Z&start=2024-06-15T10%3A00%3A00Z';
const options = {method: 'GET', headers: {'X-Auth-Token': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Response
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/logs/project_uuid?end=2024-06-15T11%3A00%3A00Z&start=2024-06-15T10%3A00%3A00Z"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-Auth-Token", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Response
require 'uri'
require 'net/http'

url = URI("https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/logs/project_uuid?end=2024-06-15T11%3A00%3A00Z&start=2024-06-15T10%3A00%3A00Z")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Auth-Token"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/logs/project_uuid?end=2024-06-15T11%3A00%3A00Z&start=2024-06-15T10%3A00%3A00Z")
  .header("X-Auth-Token", "<apiKey>")
  .asString();
```

```php Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/logs/project_uuid?end=2024-06-15T11%3A00%3A00Z&start=2024-06-15T10%3A00%3A00Z', [
  'headers' => [
    'X-Auth-Token' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Response
using RestSharp;

var client = new RestClient("https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/logs/project_uuid?end=2024-06-15T11%3A00%3A00Z&start=2024-06-15T10%3A00%3A00Z");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Auth-Token", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Response
import Foundation

let headers = ["X-Auth-Token": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/logs/project_uuid?end=2024-06-15T11%3A00%3A00Z&start=2024-06-15T10%3A00%3A00Z")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```