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

# List logs

> Returns the server's logs, newest first. This is the same data the log viewer shows.

How far back you can read depends on the server's plan: the last hour on the free plan and Pro Lite, 30 days on Quark Pro. A request that reaches further back is cut to that window and `walled` is true.



## OpenAPI

````yaml /api-reference/openapi.json get /servers/{guild_id}/logs
openapi: 3.1.0
info:
  title: Quark API
  version: 2.0.0
  description: Configure Quark and read your server's logs from your own code.
servers:
  - url: https://quark.bot/api
security:
  - bearerAuth: []
tags:
  - name: Configuration
    description: Read the configuration and change server settings.
  - name: Log channels
    description: Where each category of log is sent.
  - name: Logging settings
    description: Server-wide options and settings for individual log types.
  - name: Ignore options
    description: Channels, members, roles and message content left out of the logs.
  - name: Tags
    description: Saved messages posted with /tags send.
  - name: Logs
    description: Read and export the server's logs.
  - name: Notifications
    description: Recent changes to Quark's configuration.
  - name: Troubleshooting
    description: Find out why logs are missing, and fix it.
  - name: Search
    description: Look up members and channels.
  - name: Tokens
    description: List and revoke API tokens.
  - name: Server
    description: Reset the server.
paths:
  /servers/{guild_id}/logs:
    get:
      tags:
        - Logs
      summary: List logs
      description: >-
        Returns the server's logs, newest first. This is the same data the log
        viewer shows.


        How far back you can read depends on the server's plan: the last hour on
        the free plan and Pro Lite, 30 days on Quark Pro. A request that reaches
        further back is cut to that window and `walled` is true.
      operationId: listLogs
      parameters:
        - $ref: '#/components/parameters/GuildId'
        - name: search
          in: query
          required: false
          schema:
            type: string
            maxLength: 200
          description: >-
            Text to search for. Matches whole words in message content, and
            parts of names, channels, roles and reasons.
        - name: after
          in: query
          required: false
          schema:
            type: integer
          description: >-
            Only entries after this time, in milliseconds since the Unix epoch.
            Limited to what the server's plan allows.
        - name: before
          in: query
          required: false
          schema:
            type: integer
          description: Only entries before this time, in milliseconds since the Unix epoch.
        - name: category
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - categoryMembers
                - categoryText
                - categoryVoice
                - categoryServer
                - categoryRoles
                - categoryChannels
                - categoryQuark
                - categoryActions
                - categoryModlog
          description: One or more categories. Repeat the parameter for each.
        - name: type
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: One or more log type IDs. Repeat the parameter for each.
        - name: channel
          in: query
          required: false
          schema:
            type: string
          description: A channel ID.
        - name: member
          in: query
          required: false
          schema:
            type: string
          description: A user ID.
        - name: memberRole
          in: query
          required: false
          schema:
            type: string
            enum:
              - executor
              - target
              - either
            default: either
          description: Whether `member` did the action, had it done to them, or either.
        - name: role
          in: query
          required: false
          schema:
            type: string
            maxLength: 100
          description: A role name, or part of one.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 100
          description: Entries per page.
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          description: The `cursor` from the previous page.
        - $ref: '#/components/parameters/Bot'
      responses:
        '200':
          description: A page of logs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogPage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The logs could not be read. Try again later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: The log store is unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    GuildId:
      name: guild_id
      in: path
      required: true
      schema:
        type: string
        pattern: ^\d{17,20}$
        example: '301655085954367490'
      description: The server's ID. Must be the server the token was created for.
    Bot:
      name: bot
      in: query
      required: false
      schema:
        type: string
        enum:
          - pro
      description: >-
        Set to `pro` to act on the Quark Pro bot's configuration. Leave out for
        the main Quark bot.
  schemas:
    LogPage:
      type: object
      properties:
        entries:
          type: array
          items:
            $ref: '#/components/schemas/LogEntry'
        total:
          type: integer
          description: >-
            How many entries match the filters from this page onwards. On the
            first page it is the total number of matches.
        retentionMs:
          type: integer
          description: How far back this server's plan lets you read, in milliseconds.
        walled:
          type: boolean
          description: True if the request asked for more history than the plan allows.
        cursor:
          type:
            - string
            - 'null'
          description: >-
            Pass this as `cursor` to get the next page. Null when there are no
            more.
        categoryCounts:
          type: object
          additionalProperties:
            type: integer
          description: >-
            Number of entries in each category that match the other filters. The
            `category` filter itself is not applied.
    Error:
      type: object
      properties:
        error:
          type: string
    LogEntry:
      type: object
      properties:
        id:
          type: string
          description: The entry's ID.
        type:
          type: integer
          description: The log type ID.
        timestamp:
          type: integer
          description: When it happened, in milliseconds since the Unix epoch.
        executor:
          $ref: '#/components/schemas/NamedId'
          description: >-
            Who did it. The ID is `"0"` for changes made through the dashboard
            or API.
        target:
          $ref: '#/components/schemas/NamedId'
          description: Who it was done to.
        channel:
          $ref: '#/components/schemas/NamedId'
          description: The channel involved. `name` can be an empty string.
        role:
          type:
            - string
            - 'null'
          description: The role name involved.
        name:
          type:
            - string
            - 'null'
        reason:
          type:
            - string
            - 'null'
        count:
          type:
            - integer
            - 'null'
        content:
          type:
            - string
            - 'null'
          description: Message content. For an edit, the content before.
        contentAfter:
          type:
            - string
            - 'null'
          description: For an edit, the content after.
        messages:
          type: array
          items:
            type: object
          description: >-
            The messages the log carries: one for a delete, two for an edit,
            many for a bulk delete. Attachments are listed by name and size
            only.
        messagesTruncated:
          type:
            - integer
            - 'null'
        emoji:
          type:
            - object
            - 'null'
        action:
          type:
            - string
            - 'null'
        value:
          type:
            - string
            - 'null'
        delivery:
          type: object
          description: Whether the log reached Discord.
          properties:
            status:
              type: string
              enum:
                - delivered
                - not_delivered
                - unknown
            reason:
              type:
                - string
                - 'null'
            channelId:
              type:
                - string
                - 'null'
            messageId:
              type:
                - string
                - 'null'
    NamedId:
      type:
        - object
        - 'null'
      properties:
        id:
          type: string
        name:
          type: string
  responses:
    Unauthorized:
      description: No token was sent.
      content:
        application/json:
          schema:
            type: object
            description: An empty object.
            example: {}
    Forbidden:
      description: The token belongs to a different server, or is not an Admin token.
      content:
        application/json:
          schema:
            type: object
            description: An empty object.
            example: {}
    RateLimited:
      description: Too many requests. Wait for the number of seconds in `Retry-After`.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds to wait.
        X-RateLimit-Limit:
          schema:
            type: integer
        X-RateLimit-Remaining:
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            description: An empty object.
            example: {}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.