> ## 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.

# Refresh the workspace

> Capture a fresh snapshot of the workspace, so a read sees current files.



## OpenAPI

````yaml /openapi.json post /v1/sessions/{session_id}/files/refresh
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/{session_id}/files/refresh:
    post:
      summary: Refresh the workspace
      description: Capture a fresh snapshot of the workspace, so a read sees current files.
      operationId: post_sessions_session_id_files_refresh
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            maxLength: 255
          description: >-
            Retrying with the same key replays the first answer instead of
            acting again.
      responses:
        '200':
          description: >-
            Capture a fresh snapshot of the workspace, so a read sees current
            files.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceFileTree'
        '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 no such object under this token's organization.
            Another organization's id is indistinguishable from one that never
            existed, deliberately.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The session's state does not allow this call, or an identical
            request is already in flight under the same Idempotency-Key.
          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`. Or `queue_full` — too many messages
            are already waiting behind the current turn. Branch on `code`.
          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:
    WorkspaceFileTree:
      type: object
      required:
        - object
        - data
        - state
      description: >-
        The files in a session's workspace, as of the last snapshot. Not the
        live sandbox — `captured_at` says which moment this is, because reading
        a stale file and believing it current is the failure this field exists
        to prevent.
      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/WorkspaceFile'
        captured_at:
          type:
            - integer
            - 'null'
          description: >-
            Unix milliseconds of the snapshot. Null means none has been taken,
            which is not the same as an empty workspace.
        state:
          type: string
          enum:
            - ready
            - missing
          description: '`missing` means there is no snapshot yet — call POST /files/refresh.'
        truncated:
          type: boolean
          description: The archive is read with a byte ceiling; past it the listing stops.
    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.
    WorkspaceFile:
      type: object
      required:
        - object
        - path
        - type
      properties:
        object:
          type: string
          const: workspace_file
          description: >-
            Always `workspace_file`. Names the shape, so a value can be
            identified without knowing which call returned it.
        path:
          type: string
          description: Relative to the workspace directory.
        type:
          type: string
          enum:
            - file
            - directory
        size_bytes:
          type:
            - integer
            - 'null'
          description: Null for a directory.
        readable:
          type: boolean
          description: >-
            False for a directory, and for paths this API withholds —
            environment files and key material.
  securitySchemes:
    accessToken:
      type: http
      scheme: bearer
      description: >-
        A `gbr_pat_` access token. Scopes are recorded on the token when it is
        minted.

````