api_logs

List all API logs

Changed on

This endpoint retrieves all existing API logs, which represent the requests made to Lago's API. Logs older than the retention period of your organization are left out. The retention period is 30 days unless another one was set for your organization.

get/api_logs

Request

Query parameters

pageinteger
Example:1

Page number. Defaults to 1. A value that is not a positive integer, such as 0, returns the first page.

per_pageinteger
Example:20

Number of records per page. Defaults to 100. The maximum is 200, unless another maximum is configured for your organization. A value above the maximum returns a 422 error with value_is_out_of_range on per_page. A value that is not a positive integer, such as 0, returns the default number of records.

from_datestring date
Example:2022-08-09

Filter API logs logged at or after this date.

to_datestring date
Example:2022-08-09

Filter API logs logged at or before this date.

http_methods[]string[]

Filter results by HTTP methods.

[
  "post",
  "put"
]

Filter results by HTTP status or by generic request status. When succeeded or failed is passed, the numeric values of the filter are ignored.

[
  "failed",
  "succeeded",
  404
]
api_versionstring
Example:v1

Filter results by API version.

request_paths[]string[]

Filter results by the path of the request. A value containing * is matched as a wildcard, otherwise the path must match exactly.

[
  "/api/v1/billable_metrics",
  "*billable_metrics*"
]
clients[]string[]

Filter results by the client that issued the request, as reported by its user agent.

[
  "Lago Ruby v1.26.0"
]

Response

List of API logs

Example response

{
  "api_logs": [
    {
      "api_version": "v1",
      "client": "Lago Ruby v1.26.0",
      "http_method": "post",
      "http_status": 200,
      "logged_at": "2025-03-31T12:31:44Z",
      "request_body": {
        "billable_metric": "{\"name\":\"Storage\",\"code\":\"storage\"}"
      },
      "request_origin": "https://api.getlago.com",
      "request_path": "/api/v1/billable_metrics",
      "created_at": "2022-04-29T08:59:51Z",
      "request_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
      "request_response": {
        "billable_metric": "{\"lago_id\":\"b9155544-e261-4e92-b54e-f65d7609294c\"}"
      }
    }
  ],
  "meta": {
    "current_page": 2,
    "next_page": 3,
    "prev_page": 1,
    "total_pages": 4,
    "total_count": 70
  }
}

Changes

    • breaking

      the response property // became nullable for the status

    • breaking

      the // response's property type changed from string to object, and format from object to no format for status

    • breaking

      the // response's property format changed from uuid to no format for status

    • breaking

      the // response's property type changed from string to object null, and format from object to no format for status

    • warning

      deleted the query request parameter request_paths

    • warning

      added the new patch enum value to the // response property for the response status

    • info

      added the new optional query request parameter clients[]

    • info

      added the new optional query request parameter request_paths[]

    • info

      added the enum value patch to the property items/ of the query request parameter http_methods[]

    • info

      added the non-success response with the status

    • info

      the response property // became required for the status