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

# Query logs for a project

> Returns OpenTelemetry logs from the project's backend. Use branchId query param for branch-specific logs, or omit for production logs.



## OpenAPI

````yaml https://api.specular.dev/openapi.json get /telemetry/projects/{projectId}/logs
openapi: 3.0.0
info:
  title: Specular API
  description: Backend-as-a-Service API for managing projects and branches
  version: 1.0.0
servers:
  - url: https://api.specular.dev
    description: Production server
  - url: http://localhost:3000
    description: Development server
security:
  - bearerAuth: []
paths:
  /telemetry/projects/{projectId}/logs:
    get:
      tags:
        - Telemetry
      summary: Query logs for a project
      description: >-
        Returns OpenTelemetry logs from the project's backend. Use branchId
        query param for branch-specific logs, or omit for production logs.
      parameters:
        - schema:
            type: string
          in: query
          name: branchId
          required: false
          description: Branch ID. If omitted, returns production logs.
        - schema:
            type: string
            format: date-time
          in: query
          name: startTime
          required: false
          description: Start of time range (ISO 8601). Defaults to 1 hour ago.
        - schema:
            type: string
            format: date-time
          in: query
          name: endTime
          required: false
          description: End of time range (ISO 8601). Defaults to now.
        - schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 100
          in: query
          name: limit
          required: false
          description: Maximum number of logs to return (1-1000)
        - schema:
            type: integer
            minimum: 0
            default: 0
          in: query
          name: offset
          required: false
          description: Number of logs to skip
        - schema:
            type: string
            enum:
              - TRACE
              - DEBUG
              - INFO
              - WARN
              - ERROR
              - FATAL
          in: query
          name: severity
          required: false
          description: Filter by severity level
        - schema:
            type: string
          in: path
          name: projectId
          required: true
          description: Project ID
      responses:
        '200':
          description: Logs retrieved successfully
          content:
            application/json:
              schema:
                description: Logs retrieved successfully
                type: object
                properties:
                  logs:
                    type: array
                    items:
                      type: object
                      properties:
                        timestamp:
                          type: string
                          format: date-time
                        traceId:
                          type: string
                        spanId:
                          type: string
                        severityText:
                          type: string
                        severityNumber:
                          type: integer
                        body:
                          type: string
                        attributes:
                          type: object
                          additionalProperties: true
                          properties:
                            req:
                              type: object
                              additionalProperties: true
                            res:
                              type: object
                              additionalProperties: true
                  total:
                    type: integer
                    description: Total number of matching logs
                  limit:
                    type: integer
                  offset:
                    type: integer
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                description: Authentication required
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Project or branch not found
          content:
            application/json:
              schema:
                description: Project or branch not found
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
        '503':
          description: Telemetry service unavailable
          content:
            application/json:
              schema:
                description: Telemetry service unavailable
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Bearer authentication with API key (format: Bearer sk_xxx)'

````