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

# Get Environment Logs

> Fetch runtime logs for a deployed project component.



## OpenAPI

````yaml GET /orgs/{org_id}/projects/{project_id}/envs/{env_id}/logs
openapi: 3.1.0
info:
  title: Timbal Platform API
  description: Public API documentation for the Timbal platform
  license:
    name: ''
  version: 2.0.0
servers:
  - url: https://api.timbal.ai
    description: Production
  - url: https://api.dev.timbal.ai
    description: Development
security: []
tags:
  - name: ace
    description: Action Control Engine (ACE) operations
  - name: analytics
    description: Org and project analytics
  - name: billing
    description: Subscriptions, usage, and payment-related operations
  - name: content
    description: Re-sign stored content URLs
  - name: files
    description: File operations
  - name: iam
    description: IAM — actions, roles, users, and authorization introspection
  - name: k2
    description: Knowledge Bases v2 operations
  - name: orgs
    description: Organization operations
  - name: projects
    description: Project operations
  - name: runs
    description: Execution operations
  - name: templates
    description: Public project template catalog
  - name: users
    description: Authenticated user profile
paths:
  /orgs/{org_id}/projects/{project_id}/envs/{env_id}/logs:
    get:
      tags:
        - projects
      description: Fetch runtime logs for a deployed project component.
      operationId: handler
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            type: string
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: env_id
          in: path
          required: true
          schema:
            type: string
        - name: component
          in: query
          description: |-
            Which component's logs to fetch. Shared vocabulary with
            `GET /preview/logs` (which 501s on `workforce`). `workforce`
            here covers agent and workflow components interchangeably.
            Resolves to the component's most recent deployment. Mutually
            exclusive with `deployment_id`; exactly one of the two must be
            provided.
          required: false
          schema:
            oneOf:
              - type: 'null'
              - type: string
                description: >-
                  Routing selector for the deployable units a Timbal project
                  owns:

                  the project-level frontend (`Ui`), the project-level backend
                  (`Api`),

                  and the N workforce components (`Workforce`, keyed on

                  `manifest_id`).


                  Used as a `?component=` query parameter on every surface that
                  acts

                  on one component at a time (`GET /preview/logs`,

                  `GET /envs/{env}/logs`, etc.). Wire values are lowercase

                  (`ui`/`api`/`workforce`). Surfaces that don't apply to a given

                  variant (e.g. previews don't run workforce components today)
                  reject

                  with `501 NotImplemented` instead of forking the schema —
                  clients

                  rely on a single shared vocabulary.


                  Distinct from [`AppType`], which is a **type discriminator**
                  on

                  workforce rows (`Agent` vs `Workflow`) carried in response
                  payloads.

                  `ProjectComponent` collapses both into `Workforce` because
                  every

                  surface that *selects* a workforce component keys on
                  `manifest_id`,

                  not on the Agent-vs-Workflow distinction (the underlying log

                  pipeline, deployment shape, etc. are identical for both). Use

                  [`From<AppType>`] to bridge: any workforce type — including
                  the

                  forward-compat `AppType::Unknown` catch-all — maps to

                  `ProjectComponent::Workforce`.
                enum:
                  - ui
                  - api
                  - workforce
        - name: deployment_id
          in: query
          description: |-
            Fetch logs for one specific deployment (the `id` field in the
            deployments-list response) instead of the component's latest.
            Lets you read the runtime output of a failed or superseded
            deployment post-mortem. Mutually exclusive with `component`.
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: component_id
          in: query
          description: |-
            Numeric workforce app id (the value the SDK reads from
            `TIMBAL_APP_ID`, also returned as `id` on each deployment in
            the deployments-list response). XOR with `component_uid`
            when `component=workforce`; forbidden for `ui` / `api`.
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: component_uid
          in: query
          description: |-
            Workforce manifest uid (the `_id` field in `timbal.yaml`,
            also returned as `uid` on each deployment in the
            deployments-list response). XOR with `component_id`.
            Display name is deliberately not accepted as a selector —
            it's user-editable and not guaranteed unique within a
            project.
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: start_time
          in: query
          description: ms since epoch. Defaults to `end_time - 1h`.
          required: false
          schema:
            type:
              - integer
              - 'null'
            format: int64
        - name: end_time
          in: query
          description: ms since epoch. Defaults to now.
          required: false
          schema:
            type:
              - integer
              - 'null'
            format: int64
        - name: limit
          in: query
          description: Defaults to 50.
          required: false
          schema:
            type:
              - integer
              - 'null'
            minimum: 0
        - name: page_token
          in: query
          description: |-
            Pagination cursor from a prior response. Returned only when
            cursor-based pagination is available for the component's
            runtime; ignored otherwise.
          required: false
          schema:
            type:
              - string
              - 'null'
      responses:
        '200':
          description: Logs fetched
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response'
        '400':
          description: Bad request
        '403':
          description: Forbidden
      security:
        - bearer_auth: []
components:
  schemas:
    Response:
      type: object
      description: |-
        Resolved window echoed back so the client can paginate / refresh
        without re-deriving the defaults the server applied.
      required:
        - events
        - start_time
        - end_time
        - limit
      properties:
        end_time:
          type: integer
          format: int64
        events:
          type: array
          items:
            $ref: '#/components/schemas/CloudWatchLogEvent'
        limit:
          type: integer
          minimum: 0
        next_page_token:
          type:
            - string
            - 'null'
        start_time:
          type: integer
          format: int64
    CloudWatchLogEvent:
      type: object
      description: A single log event from CloudWatch Logs.
      required:
        - timestamp
        - message
        - log_stream
      properties:
        log_stream:
          type: string
          description: The log stream name this event came from.
        message:
          type: string
          description: The log message content.
        timestamp:
          type: integer
          format: int64
          description: Timestamp in milliseconds since epoch.
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      description: >-
        Timbal API key. Obtain your API key from the Timbal platform settings.
        See [Authentication](/api-reference/authentication) for more
        information.

````