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

# Get Logs

> Return recent logs for the authenticated user (scoped by app_id).

Args:
    hours: Number of hours of history to retrieve (default 4)
           - <= 4 hours: reads from local files
           - > 4 hours: queries logs.morphik.ai proxy (requires proxy endpoint)



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/morphik/openapi.documented.yml get /logs/
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /logs/:
    get:
      tags:
        - Logs
      summary: Get Logs
      description: |-
        Return recent logs for the authenticated user (scoped by app_id).

        Args:
            hours: Number of hours of history to retrieve (default 4)
                   - <= 4 hours: reads from local files
                   - > 4 hours: queries logs.morphik.ai proxy (requires proxy endpoint)
      operationId: get_logs_logs__get
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 500
            minimum: 1
            default: 100
            title: Limit
        - name: hours
          in: query
          required: false
          schema:
            type: number
            maximum: 168
            minimum: 0.1
            default: 4
            title: Hours
        - name: op_type
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Op Type
        - name: status
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Status
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/LogResponse'
                title: Response Get Logs Logs  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Morphik from 'morphik';

            const client = new Morphik({
              apiKey: process.env['MORPHIK_API_KEY'], // This is the default and can be omitted
            });

            const logs = await client.logs.list();

            console.log(logs);
        - lang: cURL
          source: |-
            curl https://api.morphik.ai/logs/ \
                -H "Authorization: Bearer $MORPHIK_API_KEY"
components:
  schemas:
    LogResponse:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        user_id:
          type: string
          title: User Id
        operation_type:
          type: string
          title: Operation Type
        status:
          type: string
          title: Status
        tokens_used:
          type: integer
          title: Tokens Used
        duration_ms:
          type: number
          title: Duration Ms
        app_id:
          anyOf:
            - type: string
            - type: 'null'
          title: App Id
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
      type: object
      required:
        - timestamp
        - user_id
        - operation_type
        - status
        - tokens_used
        - duration_ms
      title: LogResponse
      description: Public serialisable view of a telemetry event.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````