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

# List events

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

List the account's activity events. Only the last 7 days of events are returned.



## OpenAPI

````yaml /openapi.json get /preview/v2/events
openapi: 3.1.0
info:
  title: sfc-api
  description: >-
    SF Compute API. Routes under /v2 are stable; routes under /preview/v2 are
    public preview - subject to change.
  version: 0.1.0
servers:
  - url: https://api.sfcompute.com
security:
  - bearer_auth: []
tags:
  - name: Limits
    description: Account limits and current usage.
  - 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: Subnets
    description: Private networks for instance-to-instance communication within a zone.
  - name: Procurements
    description: Market automations that maintain capacity by placing buy/sell orders.
  - name: Deployments
    description: >-
      Deployment automations that maintain a fleet of instances, including spot
      deployments that buy capacity up to a maximum price.
  - 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: InfiniBand Partitions
    description: Isolated InfiniBand networks for groups of instances.
  - name: Orderbook
    description: >-
      Read-only orderbook visibility: bid/ask spread, depth, open and filled
      orders, 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/events:
    get:
      tags:
        - Events
      summary: List events
      description: >-
        > ⚠️ This endpoint is in [public
        preview](/preview/roadmap#feature-states).


        List the account's activity events. Only the last 7 days of events are
        returned.
      operationId: list_events_preview
      parameters:
        - name: starting_after
          in: query
          description: >-
            Return events after this cursor, exclusive. A cursor only works with
            the same filter parameters it was created with.
          required: false
          schema:
            $ref: '#/components/schemas/EventsCursor'
        - name: limit
          in: query
          description: Maximum number of events to return per page.
          required: false
          schema:
            type: integer
            format: u-int32
            default: 50
            maximum: 200
            minimum: 1
        - name: action
          in: query
          description: Only return events with exactly this action.
          required: false
          schema:
            type: string
          example: instance.terminated
        - name: target
          in: query
          description: Only return events about this target id.
          required: false
          schema:
            type: string
          example: inst_abc123
        - name: target_type
          in: query
          description: >-
            Only return events whose targets are this kind of resource.
            Redundant if `action` is specified.
          required: false
          schema:
            type: string
          example: instance
        - name: since
          in: query
          description: >-
            Unix timestamp. Only return events that occurred at or after this
            time.
          required: false
          schema:
            type: integer
            format: int64
        - name: until
          in: query
          description: >-
            Unix timestamp. Only return events that occurred at or before this
            time.
          required: false
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: Paginated list of events.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2.ListEventsResponsePreview'
        '400':
          description: >-
            Invalid filter parameters, or a cursor reused with different
            filters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '410':
          description: >-
            The cursor references an event outside the retention window; restart
            without a cursor.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoneError'
        '429':
          description: >-
            Rate limit exceeded. Retry after the interval indicated by the
            rate-limit response headers.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
components:
  schemas:
    EventsCursor:
      type: string
      examples:
        - evtc_gqXR7s0Kj5mHvE2wNpLc4Q
      pattern: ^evtc_[A-Za-z0-9_-]+$
    v2.ListEventsResponsePreview:
      type: object
      required:
        - object
        - data
        - has_more
      properties:
        object:
          type: string
          const: list
          default: list
          readOnly: true
        data:
          type: array
          items:
            $ref: '#/components/schemas/v2.EventResponsePreview'
          description: The page of events, oldest first.
        has_more:
          type: boolean
          description: Whether more events are available after this page.
        cursor:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/EventsCursor'
              description: >-
                The last event's cursor. Pass it as `starting_after` to fetch
                the next page. Omitted when `data` is empty.
    BadRequestError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              const: invalid_request_error
              default: invalid_request_error
            message:
              type: string
              x-speakeasy-error-message: true
            details:
              type: array
              items:
                $ref: '#/components/schemas/ErrorDetail'
    UnauthorizedError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              const: authentication_error
              default: authentication_error
            message:
              type: string
              x-speakeasy-error-message: true
    GoneError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              const: gone
              default: gone
            message:
              type: string
              x-speakeasy-error-message: true
    InternalServerError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              const: api_error
              default: api_error
            message:
              type: string
              x-speakeasy-error-message: true
    v2.EventResponsePreview:
      type: object
      required:
        - object
        - id
        - cursor
        - action
        - occurred_at
        - actor
        - targets
      properties:
        object:
          type: string
          const: event
          default: event
          readOnly: true
        id:
          type: string
          description: Unique identifier of the event.
          example: evt_x7Kp2mQhTv9rWq3s
        cursor:
          $ref: '#/components/schemas/EventsCursor'
          description: >-
            Resume the stream from just after this event by passing this value
            as `starting_after`.
        action:
          type: string
          description: >-
            The event type. Current values are `instance.created`,
            `instance.running`, `instance.failed`, `instance.connection_lost`,
            `instance.termination_imminent`, `instance.terminated`,
            `order.created`, `order.filled`, `order.cancelled`,
            `image.published`, `image.revoked`, `image.reinstated`,
            `image.deprecated`, `trust_level.updated`,
            `instance_sku_override.updated`, and
            `instance_sku_override.deleted`. New values may be added later.
          example: instance.terminated
        occurred_at:
          type: integer
          format: int64
          description: Unix timestamp (seconds) of when the event occurred.
        actor:
          $ref: '#/components/schemas/ApiActor'
          description: Who performed the action.
        targets:
          type: array
          items:
            $ref: '#/components/schemas/Target'
          description: The resources the event is about, as `{type, id}` pairs.
    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
    ApiActor:
      oneOf:
        - type: object
          description: One of your account's API tokens, identified by its id.
          required:
            - id
            - type
          properties:
            id:
              type: string
              description: The id of the token that performed the action.
              example: tokn_x7Kp2mQhTv9rWq3s
            type:
              type: string
              const: token
              default: token
              description: The kind of actor.
        - type: object
          description: >-
            SF Compute itself, such as automated lifecycle management or our
            operators.
          required:
            - type
          properties:
            type:
              type: string
              const: system
              default: system
              description: The kind of actor.
      description: Who performed an action.
    Target:
      type: object
      description: A resource an event is about.
      required:
        - type
        - id
      properties:
        type:
          type: string
          description: The kind of resource.
          example: instance
        id:
          type: string
          description: The resource's id.
          example: inst_abc123
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Create an API token using `sf tokens create` or at
        https://sfcompute.com/dashboard/tokens.

````