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

# Logs Query

> Query inference logs.
* Without timestamps (from/to) returns last `limit` messages (in last month).
* With `from` only, returns first `limit` messages after `from` (inclusive).
* With `to` only, returns last `limit` messages before `to` (inclusive).
* With both `from` and `to`, return the first `limit` messages after `from`, but not later than `to`.
* `from` and `to` should be no more than a month apart.



## OpenAPI

````yaml https://api.deepinfra.com/openapi.json get /v1/logs/query
openapi: 3.1.0
info:
  title: DeepInfra API
  description: >-
    The DeepInfra API provides serverless AI inference, custom model
    deployments, and GPU rentals.
  version: 1.0.0
servers:
  - url: https://api.deepinfra.com
security: []
tags:
  - name: Chat Completions
    description: OpenAI and Anthropic-compatible chat completion endpoints for LLMs.
  - name: Text Completions
    description: OpenAI-compatible text completion endpoints.
  - name: Embeddings
    description: Generate text embeddings for search and RAG.
  - name: Image Generation
    description: Generate, edit, and create variations of images.
  - name: Audio
    description: OpenAI-compatible speech synthesis, transcription, and translation.
  - name: Text to Speech
    description: ElevenLabs-compatible TTS endpoints and voice management.
  - name: Inference
    description: Native DeepInfra inference API for models and deployments.
  - name: Dedicated Models
    description: Deploy and manage private model instances with autoscaling.
  - name: GPU Rentals
    description: Rent dedicated GPU containers.
  - name: Models
    description: Browse, search, and manage AI models.
  - name: Files & Batches
    description: File uploads and batch processing.
  - name: LoRA Adapters
    description: Create, manage, and query LoRA adapter models.
  - name: Agents
    description: Manage agent-framework instances (OpenClaw and friends).
  - name: Sandboxes
    description: Create and manage isolated sandbox environments.
  - name: Account
    description: User profile, team management, and rate limits.
  - name: Authentication
    description: API tokens, SSH keys, scoped JWTs, and login flows.
  - name: Billing
    description: Payment methods, usage tracking, and billing.
  - name: Logs & Metrics
    description: Query inference logs, deployment logs, and usage metrics.
  - name: Utilities
    description: Feedback submission and CLI version.
paths:
  /v1/logs/query:
    get:
      tags:
        - Logs & Metrics
      summary: Logs Query
      description: >-
        Query inference logs.

        * Without timestamps (from/to) returns last `limit` messages (in last
        month).

        * With `from` only, returns first `limit` messages after `from`
        (inclusive).

        * With `to` only, returns last `limit` messages before `to` (inclusive).

        * With both `from` and `to`, return the first `limit` messages after
        `from`, but not later than `to`.

        * `from` and `to` should be no more than a month apart.
      operationId: logs_query_v1_logs_query_get
      parameters:
        - name: deploy_id
          in: query
          required: true
          schema:
            type: string
            description: the deploy id to get the logs from
            title: Deploy Id
          description: the deploy id to get the logs from
        - name: from
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              start of period, in fractional seconds since unix epoch
              (inclusive)
            title: From
          description: start of period, in fractional seconds since unix epoch (inclusive)
        - name: to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: end of period, in fractional seconds since unix epoch (exclusive)
            title: To
          description: end of period, in fractional seconds since unix epoch (exclusive)
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            description: how many items to return at most (default 100, in [1, 1000])
            default: 100
            title: Limit
          description: how many items to return at most (default 100, in [1, 1000])
        - name: xi-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Xi-Api-Key
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogQueryOut'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeepError'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeepError'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    LogQueryOut:
      properties:
        entries:
          items:
            $ref: '#/components/schemas/LogEntry'
          type: array
          title: Entries
          description: list of log lines ordered by increasing timestamp
      type: object
      title: LogQueryOut
    DeepError:
      properties:
        error:
          type: string
          title: Error
          description: Error
          examples:
            - Model not found
      type: object
      required:
        - error
      title: DeepError
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LogEntry:
      prefixItems:
        - type: string
          title: Ts
          description: timestamp in fractional seconds since unix epoch (ns precision)
        - type: string
          title: Line
          description: a single log line
      type: array
      maxItems: 2
      minItems: 2
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````