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

# Retrieve log entries

> The request must be authenticated by an API key with the logs ACL.

* Logs are held for the last seven days.
* Up to 1,000 API requests per server are logged.
* This request counts towards your [operations quota](https://support.algolia.com/hc/articles/17245378392977-How-does-Algolia-count-records-and-operations) but doesn't appear in the logs itself.

**Required ACL:** `logs`


## OpenAPI

````yaml specs/search.yml get /1/logs
openapi: 3.1.0
info:
  title: Search API
  summary: >-
    The Algolia Search API lets you search, configure, and manage your indices
    and records
  description: >
    ## Client libraries


    Use Algolia's API clients and libraries to reliably integrate Algolia's APIs
    with your apps.

    The official API clients are covered by Algolia's [Service Level
    Agreement](https://www.algolia.com/policies/sla).


    For more information, see [Algolia's
    ecosystem](https://www.algolia.com/doc/libraries).


    ## Base URLs


    Base URLs for the Search API:


    - `https://{APPLICATION_ID}.algolia.net`

    - `https://{APPLICATION_ID}-dsn.algolia.net`.
      If your subscription includes a [Distributed Search Network](https://dashboard.algolia.com/infra),
      this ensures that requests are sent to servers closest to users.

    Both URLs provide high availability by distributing requests with load
    balancing.


    **All requests must use HTTPS.**


    ## Retry strategy


    To guarantee high availability, implement a retry strategy for all API
    requests using the URLs of your servers as fallbacks:


    - `https://{APPLICATION_ID}-1.algolianet.com`

    - `https://{APPLICATION_ID}-2.algolianet.com`

    - `https://{APPLICATION_ID}-3.algolianet.com`


    These URLs use a different DNS provider than the primary URLs.

    Randomize this list to ensure an even load across the three servers.


    All Algolia API clients implement this retry strategy.


    ## Authentication


    Add these headers to authenticate requests:


    - `x-algolia-application-id`. Your Algolia application ID.

    - `x-algolia-api-key`. An API key with the necessary permissions to make the
    request.
      The required access control list (ACL) to make a request is listed in each endpoint's reference.

    You can find your application ID and API key in the [Algolia
    dashboard](https://dashboard.algolia.com/account/api-keys).


    ## Request format


    Depending on the endpoint, request bodies are either JSON objects or arrays
    of JSON objects.


    ## Parameters


    Parameters are passed as query parameters for GET and DELETE requests,

    and in the request body for POST and PUT requests.


    Query parameters must be
    [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding).

    Non-ASCII characters must be UTF-8 encoded.

    Plus characters (`+`) are interpreted as spaces.

    Arrays as query parameters must be one of:


    - A comma-separated string: `attributesToRetrieve=title,description`

    - A URL-encoded JSON array:
    `attributesToRetrieve=%5B%22title%22,%22description%22%D`


    ## Response status and errors


    The Search API returns JSON responses.

    Since JSON doesn't guarantee any specific ordering, don't rely on the order
    of attributes in the API response.


    Successful responses return `2xx` statuses. Client errors return `4xx`
    statuses. Server errors return `5xx` statuses.

    Error responses have a `message` property with more information.


    ## Version


    The current version of the Search API is version 1, indicated by the `/1/`
    in each endpoint's URL.
  version: 1.0.0
servers:
  - url: https://{appId}.algolia.net
    variables:
      appId:
        default: ALGOLIA_APPLICATION_ID
  - url: https://{appId}-1.algolianet.com
    variables:
      appId:
        default: ALGOLIA_APPLICATION_ID
  - url: https://{appId}-2.algolianet.com
    variables:
      appId:
        default: ALGOLIA_APPLICATION_ID
  - url: https://{appId}-3.algolianet.com
    variables:
      appId:
        default: ALGOLIA_APPLICATION_ID
  - url: https://{appId}-dsn.algolia.net
    variables:
      appId:
        default: ALGOLIA_APPLICATION_ID
security:
  - appId: []
    apiKey: []
tags:
  - name: Advanced
    description: Query your logs.
  - name: Api Keys
    x-displayName: API keys
    description: >
      Manage your API keys.


      API requests must be authenticated with an API key.

      API keys can have permissions (access control lists, ACL) and
      restrictions.
    externalDocs:
      url: https://www.algolia.com/doc/guides/security/api-keys
      description: API keys.
  - name: Clusters
    description: |
      Multi-cluster operations.

      Multi-cluster operations are **deprecated**.
      If you have issues with your Algolia infrastructure
      due to large volumes of data, contact the Algolia support team.
  - name: Dictionaries
    description: >
      Manage your dictionaries.


      Customize language-specific settings, such as stop words, plurals, or word
      segmentation.


      Dictionaries are application-wide.
    externalDocs:
      url: >-
        https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp
      description: Natural languages.
  - name: Indices
    description: >
      Manage your indices and index settings.


      Indices are copies of your data that are stored on Algolia's servers.

      They're optimal data structures for fast search and are made up of records
      and settings.
    externalDocs:
      url: >-
        https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices
      description: Manage your indices.
  - name: Records
    description: >
      Add, update, and delete records from your indices.


      Records are individual items in your index.

      When they match a search query, they're returned as search results, in the
      order determined by your ranking.

      Records are schemaless JSON objects.

      When adding or updating many records, check the [indexing rate
      limits](https://support.algolia.com/hc/articles/4406975251089-Is-there-a-rate-limit-for-indexing-on-Algolia).
    externalDocs:
      url: >-
        https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data
      description: Prepare your records.
  - name: Rules
    description: >
      Create, update, delete, and search for rules.


      Rules are _if-then_ statements that you can use to curate search results.

      Rules have _conditions_ that can trigger _consequences_.

      Consequences are changes to the search results, such as changing the order
      of search results or boosting a facet.

      This can be useful for tuning specific queries or for merchandising.
    externalDocs:
      url: https://www.algolia.com/doc/guides/managing-results/rules/rules-overview
      description: Index Rules.
  - name: Search
    description: Search one or more indices for matching records or facet values.
  - name: Synonyms
    description: |
      Create, update, delete, and search for synonyms.

      Synonyms are terms that the search engine should consider equal.
    externalDocs:
      url: >-
        https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms
      description: Synonyms.
  - name: Vaults
    description: >-
      Algolia Vault lets you restrict access to your clusters to specific IP
      addresses and provides disk-level encryption at rest.
    externalDocs:
      url: https://www.algolia.com/doc/guides/security/algolia-vault
      description: Algolia Vault.
  - name: _model_index_settings
    x-displayName: Index settings
    description: |
      <SchemaDefinition schemaRef="#/components/schemas/indexSettings" />.
paths:
  /1/logs:
    get:
      tags:
        - Advanced
      summary: Retrieve log entries
      description: >
        The request must be authenticated by an API key with the [`logs`
        ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl).


        - Logs are held for the last seven days.

        - Up to 1,000 API requests per server are logged.

        - This request counts towards your [operations
        quota](https://support.algolia.com/hc/articles/17245378392977-How-does-Algolia-count-records-and-operations)
        but doesn't appear in the logs itself.
      operationId: getLogs
      parameters:
        - name: indexName
          in: query
          description: |
            Index for which to retrieve log entries.
            By default, log entries are retrieved for all indices.
          example: products
          schema:
            oneOf:
              - type: string
              - type: 'null'
        - name: length
          in: query
          description: Maximum number of entries to retrieve.
          schema:
            type: integer
            default: 10
            maximum: 1000
        - name: offset
          in: query
          description: >-
            First log entry to retrieve. The most recent entries are listed
            first.
          schema:
            type: integer
            default: 0
        - name: type
          in: query
          description: |
            Type of log entries to retrieve.
            By default, all log entries are retrieved.
          schema:
            $ref: '#/components/schemas/logType'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getLogsResponse
                type: object
                additionalProperties: false
                required:
                  - logs
                properties:
                  logs:
                    type: array
                    items:
                      title: log
                      type: object
                      properties:
                        answer:
                          type: string
                          maxLength: 1000
                          description: Response body.
                          example: >
                            'n{\n "results": [\n  {\n   "hits": [\n    {\n    
                            "name": "Amazon - Fire TV Stick",\n    
                            "description": "Amazon Fire TV Stick connects to
                            your TV's HDMI port. Just grab and go to enjoy
                            Netflix, Prime Instant Video, Hulu Plus,
                            YouTube.com, music, and much more.",\n     "brand":
                            "Amazon",\n     "categories": [\n      "TV & Home
                            Theater",\n      "Streaming Media Players"\n    
                            ],\n     "hierarchicalCategories": {\n      "lvl0":
                            "TV & Home Theater",\n      "lvl1": "TV & Home
                            Theater > Streaming Media Players"\n     },\n    
                            "type": "Streaming media player",\n     "price":
                            39.99,\n     "price_range": "1 }\n   ]\n  }\n ]\n}'
                        answer_code:
                          type: string
                          description: HTTP status code of the response.
                          example: '200'
                        ip:
                          type: string
                          format: ipv4
                          description: IP address of the client that performed the request.
                          example: 93.184.216.34
                        method:
                          type: string
                          description: HTTP method of the request.
                          example: GET
                        processing_time_ms:
                          type: string
                          description: |
                            Processing time for the query in milliseconds.
                            This doesn't include latency due to the network.
                          example: '2'
                        query_body:
                          type: string
                          maxLength: 1000
                          description: Request body.
                          example: >-
                            {\n \"requests\": [\n  {\n   \"indexName\":
                            \"best_buy\",\n   \"params\":
                            \"query=&hitsPerPage=10&page=0&attributesToRetrieve=*&highlightPreTag=%3Cais-highlight-0000000000%3E&highlightPostTag=%3C%2Fais-highlight-0000000000%3E&getRankingInfo=1&facets=%5B%22brand%22%2C%22categories%22%2C%22free_shipping%22%2C%22type%22%5D&tagFilters=\"\n 
                            }\n ]\n}\n
                        query_headers:
                          type: string
                          description: Request headers (API keys are obfuscated).
                          example: >-
                            User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0)
                            libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5\nHost:
                            example.com\nAccept: */*\nContent-Type:
                            application/json; charset=utf-8\nX-Algolia-API-Key:
                            20f***************************\nX-Algolia-Application-Id:
                            MyApplicationID\n
                        sha1:
                          type: string
                          description: SHA1 signature of the log entry.
                          example: 26c53bd7e38ca71f4741b71994cd94a600b7ac68
                        timestamp:
                          type: string
                          description: >-
                            Date and time of the API request, in RFC 3339
                            format.
                          example: '2023-03-08T12:34:56Z'
                        url:
                          type: string
                          format: uri-reference
                          description: URL of the API endpoint.
                          example: /1/indexes
                        index:
                          type: string
                          description: Index targeted by the query.
                          example: products
                        inner_queries:
                          type: array
                          description: Queries performed for the given request.
                          items:
                            title: logQuery
                            type: object
                            properties:
                              index_name:
                                type: string
                                description: Index targeted by the query.
                                example: products
                              query_id:
                                type: string
                                description: Unique query identifier.
                                example: 96f59a3145dd9bd8963dc223950507c8
                              user_token:
                                type: string
                                description: A user identifier.
                                example: 93.189.166.128
                        nb_api_calls:
                          type: string
                          description: Number of API requests.
                          example: '1'
                        query_nb_hits:
                          type: string
                          description: >-
                            Number of search results (hits) returned for the
                            query.
                          example: '1'
                        query_params:
                          type: string
                          description: Query parameters sent with the request.
                          example: query=georgia&attributesToRetrieve=name,city,country
                      required:
                        - timestamp
                        - method
                        - answer_code
                        - query_body
                        - answer
                        - url
                        - ip
                        - query_headers
                        - sha1
                        - processing_time_ms
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: >-
            // Initialize the client

            var client = new SearchClient(new
            SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));


            // Call the API

            var response = await client.GetLogsAsync();


            // print the response

            Console.WriteLine(response);
        - lang: dart
          label: Dart
          source: |-
            // Initialize the client
            final client =
                SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY');

            // Call the API
            final response = await client.getLogs();

            // print the response
            print(response);
        - lang: go
          label: Go
          source: >-
            // Initialize the client

            client, err := search.NewClient("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY")

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            response, err := client.GetLogs(client.NewApiGetLogsRequest())

            if err != nil {
              // handle the eventual error
              panic(err)
            }



            // print the response

            print(response)
        - lang: java
          label: Java
          source: >-
            // Initialize the client

            SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY");


            // Call the API

            GetLogsResponse response = client.getLogs();


            // print the response

            System.out.println(response);
        - lang: javascript
          label: JavaScript
          source: >-
            // Initialize the client

            const client = algoliasearch('ALGOLIA_APPLICATION_ID',
            'ALGOLIA_API_KEY');


            // Call the API

            const response = await client.getLogs();



            // print the response

            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >-
            // Initialize the client

            val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey =
            "ALGOLIA_API_KEY")


            // Call the API

            var response = client.getLogs()



            // print the response

            println(response)
        - lang: php
          label: PHP
          source: >-
            // Initialize the client

            $client = SearchClient::create('ALGOLIA_APPLICATION_ID',
            'ALGOLIA_API_KEY');


            // Call the API

            $response = $client->getLogs();



            // print the response

            var_dump($response);
        - lang: python
          label: Python
          source: >-
            # Initialize the client

            # In an asynchronous context, you can use SearchClient instead,
            which exposes the exact same methods.

            client = SearchClientSync("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY")


            # Call the API

            response = client.get_logs()



            # print the response

            print(response)
        - lang: ruby
          label: Ruby
          source: >-
            # Initialize the client

            client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY")


            # Call the API

            response = client.get_logs



            # print the response

            puts(response)
        - lang: scala
          label: Scala
          source: >-
            // Initialize the client

            val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey =
            "ALGOLIA_API_KEY")


            // Call the API

            val response = Await.result(
              client.getLogs(
              ),
              Duration(100, "sec")
            )


            // print the response

            println(response)
        - lang: swift
          label: Swift
          source: >-
            // Initialize the client

            let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID",
            apiKey: "ALGOLIA_API_KEY")


            // Call the API

            let response = try await client.getLogs()


            // print the response

            print(response)
        - lang: cURL
          label: curl
          source: |-
            curl --request GET \
              --url 'https://algolia_application_id.algolia.net/1/logs?offset=0&length=10&indexName=products&type=all' \
              --header 'accept: application/json' \
              --header 'x-algolia-api-key: ALGOLIA_API_KEY' \
              --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID'
components:
  schemas:
    logType:
      type: string
      enum:
        - all
        - query
        - build
        - error
      default: all
    ErrorBase:
      description: Error.
      type: object
      x-keep-model: true
      additionalProperties: true
      properties:
        message:
          type: string
          example: Invalid Application-Id or API-Key
  responses:
    BadRequest:
      description: Bad request or request arguments.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    FeatureNotEnabled:
      description: This feature is not enabled on your Algolia account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    MethodNotAllowed:
      description: Method not allowed with this API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    IndexNotFound:
      description: Index not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: x-algolia-application-id
      description: Your Algolia application ID.
    apiKey:
      type: apiKey
      in: header
      name: x-algolia-api-key
      description: >
        Your Algolia API key with the necessary permissions to make the request.

        Permissions are controlled through access control lists (ACL) and access
        restrictions.

        The required ACL to make a request is listed in each endpoint's
        reference.

````