# List a session's executions

Read a session's executions, newest first, one page at a time. Useful for a tool call hook that needs more of the session than its request carries.

`GET https://api.smallworld.sh/api/v1/sessions/:sessionId/executions`

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| sessionId | path | UUID | Yes | The session ID returned in session.id. |
| cursor | query | string | No | The opaque nextCursor from a previous page of this same list and session. Omit for the first page. |
| limit | query | integer | No | Number of items to return, from 1 to 50. Defaults to 20. |

## Request examples

### curl

```curl
curl --fail-with-body -X GET 'https://api.smallworld.sh/api/v1/sessions/01995e57-0501-76b8-b797-5b24df5b307f/executions?limit=20' \
  -H "Authorization: Bearer $SMALLWORLD_API_KEY"
```

### typescript

```typescript
const response = await fetch("https://api.smallworld.sh/api/v1/sessions/01995e57-0501-76b8-b797-5b24df5b307f/executions?limit=20", {
  method: "GET",
  headers: { Authorization: `Bearer ${apiKey}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();
```

### python

```python
response = requests.get(
    "https://api.smallworld.sh/api/v1/sessions/01995e57-0501-76b8-b797-5b24df5b307f/executions?limit=20",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Responses

Returns items and nextCursor. Each execution has id, sessionId, command, status (requires_approval, running, completed, timed_out, or interrupted), exitCode, stdout, stdoutTruncated, stderr, stderrTruncated, errorCode, createdAt, and completedAt. stdout and stderr are null while the execution runs and are cut at 16 KB each, with their flag set when cut. Items leave out file changes, mount changes, and tool calls.

### 200

Returns items and nextCursor. Each execution has id, sessionId, command, status (requires_approval, running, completed, timed_out, or interrupted), exitCode, stdout, stdoutTruncated, stderr, stderrTruncated, errorCode, createdAt, and completedAt. stdout and stderr are null while the execution runs and are cut at 16 KB each, with their flag set when cut. Items leave out file changes, mount changes, and tool calls.

```json
{
  "items": [
    {
      "id": "01995e57-3027-7557-a233-009ea3dcd8fc",
      "sessionId": "01995e57-0501-76b8-b797-5b24df5b307f",
      "command": "echo 'Hello from Smallworld'",
      "status": "completed",
      "exitCode": 0,
      "stdout": "Hello from Smallworld\n",
      "stdoutTruncated": false,
      "stderr": "",
      "stderrTruncated": false,
      "errorCode": null,
      "createdAt": "2026-10-10T12:00:00.000Z",
      "completedAt": "2026-10-10T12:00:01.000Z"
    }
  ],
  "nextCursor": null
}
```

### 400

invalid_request: A query parameter is invalid, such as a limit above 50 or a cursor from another list or session; the message names the problem. Unknown query parameters are rejected.

#### invalid_request

A query parameter is invalid, such as a limit above 50 or a cursor from another list or session; the message names the problem. Unknown query parameters are rejected.

```json
{
  "statusCode": 400,
  "code": "invalid_request",
  "message": "limit must be an integer between 1 and 50"
}
```

### 401

authentication_required: The Authorization header is missing or empty. invalid_api_key: The API key is invalid or revoked, or the header doesn't use the Bearer scheme.

#### authentication_required

The Authorization header is missing or empty.

```json
{
  "statusCode": 401,
  "code": "authentication_required",
  "message": "Authentication is required"
}
```

#### invalid_api_key

The API key is invalid or revoked, or the header doesn't use the Bearer scheme.

```json
{
  "statusCode": 401,
  "code": "invalid_api_key",
  "message": "The API key is invalid or revoked"
}
```

### 403

ip_not_allowed: The request came from an address outside the workspace's IP allowlist.

#### ip_not_allowed

The request came from an address outside the workspace's IP allowlist.

```json
{
  "statusCode": 403,
  "code": "ip_not_allowed",
  "message": "The source IP address is not allowed by this account's security settings"
}
```

### 404

session_not_found: The session does not exist in your workspace.

#### session_not_found

The session does not exist in your workspace.

```json
{
  "statusCode": 404,
  "code": "session_not_found",
  "message": "Session not found"
}
```

### 500

internal_error: An unexpected server error.

#### internal_error

An unexpected server error.

```json
{
  "statusCode": 500,
  "code": "internal_error",
  "message": "Internal server error"
}
```

## Notes

- Items are newest first. Pass nextCursor to read older items; it is null on the final page.

- A cursor works only for the list and session that returned it.

- GET /executions/:executionId returns an execution's full output, file changes, mount changes, and tool calls.
