> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gobare.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# List sessions

> List the organization's sessions.



## OpenAPI

````yaml /openapi.json get /v1/sessions
openapi: 3.1.0
info:
  title: Gobare Agent API
  version: v1
  description: >-
    Programmatic access to Gobare coding-agent sessions. Conceptually aligned
    with OpenAI's Agents API; deliberately not wire-compatible with it. See the
    divergence list in the product documentation.
servers:
  - url: https://api.{domain}
    variables:
      domain:
        default: gobare.dev
security: []
paths:
  /v1/sessions:
    get:
      summary: List sessions
      description: List the organization's sessions.
      operationId: get_sessions
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
          description: How many to return, 1–100. Default 20.
        - name: order
          in: query
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
          description: Newest first (`desc`, the default) or oldest first (`asc`).
        - name: after
          in: query
          required: false
          schema:
            type: string
          description: >-
            The `last_id` of the previous page. A cursor this collection cannot
            place — expired, deleted, or never issued — answers with an empty
            page rather than starting over, so a paging loop ends instead of
            repeating itself.
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - idle
              - working
              - requires_action
              - failed
          description: >-
            Only sessions in this state. `requires_action` is the one to ask for
            after a restart: it is everything waiting on your code.
        - name: source
          in: query
          required: false
          schema:
            type: string
            enum:
              - api
              - console
          description: >-
            `api` for sessions your code created, `console` for ones a person
            made in the Console. A list is organization-wide, so without this a
            second client sharing the organization appears in yours.
        - name: created_by_token
          in: query
          required: false
          schema:
            type: string
          description: >-
            Only the sessions one token created — `me` for the token making this
            call. The narrowest answer to "which of these are mine", and the one
            to reach for when several integrations share an organization.
        - name: metadata
          in: query
          required: false
          schema:
            type: string
          description: >-
            One of your own labels, as `key:value` — `?metadata=job:8842`. Finds
            the session for a job without keeping a map of your own.
      responses:
        '200':
          description: List the organization's sessions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionList'
        '400':
          description: >-
            `invalid_request`. A query parameter this endpoint does not take.
            Refused rather than ignored, because an ignored filter answers with
            everything and looks like a filter that matched.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: The access token is missing, unrecognised, expired or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            The token is valid but may not perform this call. The message names
            the scope it wanted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            No such endpoint, or the public API is not enabled on this
            deployment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            `rate_limit_exceeded`. The token is past its allowance for this
            bucket. Honour `Retry-After`; the `x-ratelimit-*` headers on every
            response say how close you were.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: An unexpected error. Quote the request id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - accessToken: []
components:
  schemas:
    SessionList:
      type: object
      required:
        - object
        - data
      properties:
        object:
          type: string
          const: list
          description: >-
            Always `list`. Names the shape, so a value can be identified without
            knowing which call returned it.
        data:
          type: array
          items:
            $ref: '#/components/schemas/Session'
        has_more:
          type: boolean
        last_id:
          type:
            - string
            - 'null'
    Error:
      type: object
      required:
        - error
      description: Every refusal this API makes, in one shape.
      properties:
        error:
          description: Always present on a failure, and the only thing present.
          type: object
          required:
            - code
            - message
            - request_id
          properties:
            code:
              type: string
              enum:
                - invalid_request
                - authentication_error
                - permission_denied
                - not_found
                - method_not_allowed
                - conflict
                - queue_full
                - rate_limit_exceeded
                - project_limit_exceeded
                - context_length_exceeded
                - provider_error
                - provider_unauthorized
                - sandbox_error
                - sandbox_unavailable
                - directory_unavailable
                - workspace_recovery_failed
                - bridge_incompatible
                - internal_error
            message:
              type: string
            request_id:
              type: string
              description: >-
                Also on the x-request-id header. Quote it when reporting a
                problem.
    Session:
      type: object
      required:
        - object
        - id
        - status
        - created_at
        - updated_at
        - agent
        - environment
        - preview
      properties:
        object:
          type: string
          const: session
          description: >-
            Always `session`. Names the shape, so a value can be identified
            without knowing which call returned it.
        id:
          type: string
          description: Ours, not yours. Use `metadata` to carry your own identifier.
        title:
          type:
            - string
            - 'null'
          description: A label for people. Set it yourself; nothing derives one.
        status:
          type: string
          enum:
            - idle
            - working
            - requires_action
            - failed
          description: >-
            `idle` accepts input. `working` is running a turn. `requires_action`
            is waiting on you — see `required_actions`. `failed` is the last
            turn's outcome, not a dead session.
        created_at:
          type: integer
          description: Unix milliseconds.
        updated_at:
          type: integer
          description: >-
            Unix milliseconds. Moves on any change, including the workspace
            waking.
        source:
          type:
            - string
            - 'null'
          enum:
            - api
            - console
            - cli
            - null
          description: >-
            Which door created this session. Null on sessions predating the
            field.
        created_by_token:
          type:
            - string
            - 'null'
          description: The id of the access token that created it — never its secret.
        agent:
          type: object
          description: What is running, and how freely.
          properties:
            id:
              type:
                - string
                - 'null'
              description: >-
                The agent template this session was created from, or null when
                it was configured inline. Still here after that template is
                deleted — it is history, not a live reference, which is what
                makes it usable for answering "where did this session's settings
                come from" long after the fact. The response has carried it
                since the field existed; it was simply never described here.
            model:
              type:
                - string
                - 'null'
              description: The model this session is bound to. Fixed at creation.
            model_credential_id:
              type:
                - string
                - 'null'
              description: >-
                The connection it runs on. `GET /v1/model-credentials` lists
                them.
            approval_mode:
              type:
                - string
                - 'null'
              description: How much the agent may do without asking.
            instructions:
              type:
                - string
                - 'null'
              maxLength: 32000
            permission_rules:
              type: array
              items:
                type: object
            tools:
              type: array
              items:
                type: object
              description: >-
                What this session can call, as you configured it, with any
                secrets removed. On the single-session read only — a page of
                sessions does not carry it.
        environment:
          type: object
          description: >-
            The workspace: its state, where the agent works, and the repository
            bound to it.
          properties:
            type:
              type: string
              const: sandbox
            state:
              type: string
              enum:
                - unknown
                - running
                - paused
                - destroyed
                - recovering
                - recovery_failed
              description: >-
                Where the workspace is. `unknown` until it first reports — a
                session is created before its sandbox exists, so this is what
                you see immediately after POST /v1/sessions. `running` is
                usable; `paused` is idle and woken by the next thing you send;
                `destroyed` is reclaimed and will be rebuilt on demand;
                `recovering` and `recovery_failed` are a rebuild in progress and
                one that gave up. A value outside this set is reported as null
                rather than passed through.
            workspace_directory:
              type: string
            repo:
              type:
                - object
                - 'null'
              description: >-
                The repository bound to this session, once one is. Null when
                none was asked for.
              properties:
                full_name:
                  type: string
                  description: owner/name, as given.
                branch:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Reported by the clone, not chosen. Null until the workspace
                    comes up.
                clone_error:
                  type:
                    - string
                    - 'null'
                  description: Why the clone did not happen, when it did not.
        preview:
          type: object
          description: Addresses for whatever the agent is serving. See preview.md.
          properties:
            url:
              type:
                - string
                - 'null'
            port:
              type:
                - integer
                - 'null'
            published_url:
              type:
                - string
                - 'null'
        required_actions:
          type: array
          description: >-
            Everything the session is waiting on you for. Authoritative — not a
            replay of events, so a caller that restarted gets the same complete
            answer.
          items:
            $ref: '#/components/schemas/RequiredAction'
    RequiredAction:
      type: object
      required:
        - type
        - turn_id
        - call_id
      description: >-
        Something this session is waiting for. Copy turn_id and call_id into the
        result you submit.
      properties:
        type:
          type: string
          enum:
            - function_call
            - approval
            - question
          description: >-
            What is being asked of you. `function_call` you answer through the
            API; `approval` and `question` are answered by a person in the
            Console.
        turn_id:
          type: string
          description: Copy this back when answering.
        call_id:
          type: string
          description: >-
            Copy this back when answering. It identifies which call the result
            is for.
        name:
          type:
            - string
            - 'null'
          description: The function the agent wants to call, as you declared it.
        arguments:
          description: >-
            What it wants to call the function with. Shaped by your own
            parameter schema.
        created_at:
          type: integer
          description: Unix milliseconds, when the agent asked.
        expires_at:
          type:
            - integer
            - 'null'
          description: >-
            Unix milliseconds, when this stops being waited for — set from the
            tool's own `timeout_seconds`. Null, the default, means it waits
            indefinitely. Past this the call is answered as failed and the turn
            continues; the turn itself does not fail.
  securitySchemes:
    accessToken:
      type: http
      scheme: bearer
      description: >-
        A `gbr_pat_` access token. Scopes are recorded on the token when it is
        minted.

````