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

# Get instance logs

> > ⚠️ This endpoint is in [public preview](/preview/roadmap).

Retrieve logs for an instance.



## OpenAPI

````yaml /preview/openapi.json get /preview/v2/instances/{id}/logs
openapi: 3.1.0
info:
  title: sfc-api
  description: >-
    Public preview API - subject to change. See
    https://docs.sfcompute.com/preview/roadmap for details.
  version: 0.1.0
servers:
  - url: https://api.sfcompute.com
security:
  - bearer_auth: []
tags:
  - name: Account
    description: The authenticated account and logged-in user.
  - name: Pools
    description: A bucket of owned compute balance over time.
  - name: Orders
    description: >-
      Place orders targeting a capacity to increase your reserved compute
      balance during some time period.
  - name: Instance Templates
    description: Reusable instance configuration.
  - name: Images
    description: Custom machine images for instances.
  - name: Roles
    description: TOML-based permission role definitions.
  - name: Grants
    description: Bind principals (users or tokens) to roles on a workspace.
  - name: Tokens
    description: Workspace-scoped API tokens.
  - name: Instances
    description: Spin up instances in a capacity to use your available compute.
  - name: Instance SKU Catalog
    description: Browse available instance SKU property definitions.
  - name: Procurements
    description: Market automations that maintain capacity by placing buy/sell orders.
  - name: Deployments
    description: Deployment automations that maintain a fleet of instances on a capacity.
  - name: Spot Deployments
    description: >-
      Spot deployment automations that buy capacity up to a maximum price and
      run instances on secured capacity.
  - name: Users
    description: Read-only access to users within the caller's organization.
  - name: Workspaces
    description: Resource containers scoped to an account.
  - name: Permissions
    description: Inspect what the caller is allowed to do.
  - name: Billing
    description: Billing profile, contacts, and auto top-up settings.
  - name: Orderbook
    description: >-
      Read-only orderbook visibility: bid/ask spread, depth of book, and
      historical fills, keyed on hardware requirements + delivery window.
  - name: Orders
    description: >-
      Estimate an order before placing it: filled price, fee, and operational
      notices.
paths:
  /preview/v2/instances/{id}/logs:
    get:
      tags:
        - Instances
      summary: Get instance logs
      description: |-
        > ⚠️ This endpoint is in [public preview](/preview/roadmap).

        Retrieve logs for an instance.
      operationId: get_instance_logs
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            description: >-
              A resource path like 'sfc:instance:acme:prod:my-instance' _or_ an
              ID. Resource paths are human-readable but not stable - they change
              when resources are renamed or moved. IDs are stable and permanent.
            examples:
              - inst_k3R-nX9vLm7Qp2Yw5Jd8F
            pattern: >-
              (inst_[0-9a-zA-Z_-]{1,21}|vm_[0-9a-zA-Z_-]{1,21})|(sfc:instance:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
        - name: seqnum_before
          in: query
          description: Return logs with `seqnum` less than or equal to this value.
          required: false
          schema:
            type: integer
            format: u-int64
            minimum: 0
        - name: seqnum_after
          in: query
          description: Return logs with `seqnum` greater than or equal to this value.
          required: false
          schema:
            type: integer
            format: u-int64
            minimum: 0
        - name: realtime_timestamp_before
          in: query
          description: >-
            Due to clock synchronization, some earlier log messages may have a
            realtime timestamp after this value.
          required: false
          schema:
            $ref: '#/components/schemas/UnixEpoch'
        - name: realtime_timestamp_after
          in: query
          description: >-
            Due to clock synchronization, some later log messages may have a
            realtime timestamp before this value.
          required: false
          schema:
            $ref: '#/components/schemas/UnixEpoch'
        - name: sort_by
          in: query
          required: false
          schema:
            type: string
            enum:
              - seqnum
              - '-seqnum'
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            format: u-int64
            default: 100
            maximum: 2500
            minimum: 1
      responses:
        '200':
          description: Log chunks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstanceLogsResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: Instance not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
        '422':
          description: Validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityError'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
components:
  schemas:
    UnixEpoch:
      type: integer
      format: int64
      description: Unix timestamp.
      example: 1738972800
    InstanceLogsResponse:
      type: object
      required:
        - object
        - data
      properties:
        object:
          type: string
          const: list
          default: list
          readOnly: true
        data:
          type: array
          items:
            $ref: '#/components/schemas/InstanceLogChunk'
    UnauthorizedError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              const: authentication_error
              default: authentication_error
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
    ForbiddenError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              const: forbidden
              default: forbidden
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
    NotFoundError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              const: not_found
              default: not_found
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
    UnprocessableEntityError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              const: unprocessable_entity
              default: unprocessable_entity
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
            details:
              type: array
              items:
                $ref: '#/components/schemas/ErrorDetail'
    InternalServerError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              const: api_error
              default: api_error
              readOnly: true
            message:
              type: string
              x-speakeasy-error-message: true
    InstanceLogChunk:
      type: object
      required:
        - timestamp_realtime
        - timestamp_monotonic_secs
        - timestamp_monotonic_nanos
        - seqnum
        - data
      properties:
        timestamp_realtime:
          $ref: '#/components/schemas/UnixEpoch'
          description: Wall-clock time. Unix timestamp.
        timestamp_monotonic_secs:
          type: integer
          format: int64
          description: Monotonic clock seconds.
        timestamp_monotonic_nanos:
          type: integer
          format: u-int32
          description: Nanosecond component of the monotonic clock.
          minimum: 0
        seqnum:
          type: integer
          format: u-int64
          minimum: 0
        data:
          type: string
          format: byte
          description: Base-64 encoded raw console output.
          example: SGVsbG8gV29ybGQK
          contentEncoding: base64
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        field:
          type:
            - string
            - 'null'
          description: The field that caused the error (for validation errors)
        code:
          type: string
          description: Specific error code for this detail
        message:
          type: string
          description: Human-readable error message
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Create an API token using `sf tokens create` or at
        https://sfcompute.com/account/api-keys.

````