# `GET /v1/sessions` — List sessions

Part of the [Bkper Managed Agent API](https://bkper.com/docs/api/managed-agent.md). Read its guide for authentication, conventions, and examples.

## Operation contract

```json
{
  "operationId": "listSessions",
  "tags": [
    "Sessions"
  ],
  "summary": "List sessions",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "archived",
      "in": "query",
      "schema": {
        "type": "boolean"
      }
    },
    {
      "name": "cursor",
      "in": "query",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SessionList"
          }
        }
      }
    },
    "400": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "410": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## Schemas

### SessionList

```json
{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Milliseconds since the epoch, as a string."
          },
          "updatedAt": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Milliseconds since the epoch, as a string."
          },
          "status": {
            "type": "string",
            "description": "Run state. Open: idle | working | stopping."
          },
          "archived": {
            "type": "boolean"
          },
          "parent": {
            "type": "object",
            "properties": {
              "sessionId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "entryId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "kind": {
                "type": "string",
                "const": "fork"
              },
              "position": {
                "type": "string",
                "description": "Fork boundary: at inherits history through entryId; before inherits history before it. Open: at | before."
              }
            },
            "required": [
              "sessionId",
              "entryId",
              "kind",
              "position"
            ]
          },
          "model": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "thinkingLevel": {
                "type": "string"
              }
            },
            "required": [
              "id"
            ]
          },
          "context": {
            "type": "object",
            "properties": {
              "tokens": {
                "type": "number"
              },
              "window": {
                "type": "number"
              }
            },
            "required": [
              "tokens",
              "window"
            ],
            "description": "Current conversation."
          },
          "usage": {
            "type": "object",
            "properties": {
              "inputTokens": {
                "type": "number"
              },
              "outputTokens": {
                "type": "number"
              },
              "cacheReadTokens": {
                "type": "number"
              },
              "cacheWriteTokens": {
                "type": "number"
              },
              "estimatedCost": {
                "type": "string",
                "description": "USD estimate from catalog prices; Bkper AI accounting is authoritative."
              }
            },
            "required": [
              "inputTokens",
              "outputTokens",
              "cacheReadTokens",
              "cacheWriteTokens",
              "estimatedCost"
            ],
            "description": "This conversation only; inherited history is not counted again."
          },
          "properties": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "instructions": {
            "description": "Present when set. Without it the agent runs with Bkper's base only.",
            "type": "string",
            "maxLength": 16000
          }
        },
        "required": [
          "id",
          "createdAt",
          "updatedAt",
          "status",
          "archived",
          "model",
          "context",
          "usage",
          "properties"
        ]
      }
    },
    "cursor": {
      "type": "string"
    }
  },
  "required": [
    "items"
  ]
}
```

### Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "Stable code, e.g. not_found, idempotency_conflict, session_working, usage_limit_exceeded. Open."
        },
        "type": {
          "description": "Category, e.g. invalid_request_error, authentication_error, usage_limit_error. Open.",
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

## Authentication

```json
{
  "bearerAuth": {
    "type": "http",
    "scheme": "bearer"
  }
}
```
