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

# Search Request Logs

> Search API requests and incoming Stripe webhooks for your organization and environment.

Search API requests and incoming Stripe webhooks for your organization and environment.

### Common Use Cases

```typescript Customer errors theme={null}
const logs = await autumn.logs.search({
    query: "where customer_id == 'cus_123' and status_code >= 400",
    limit: 50,
});
```

```typescript Feature requests theme={null}
const logs = await autumn.logs.search({
    query: "where request_body.feature_id == 'credits' | order by timestamp desc",
    range: {
        startDate: new Date(Date.now() - 60 * 60 * 1000).toISOString(),
    },
});
```

```typescript Stripe webhooks theme={null}
const logs = await autumn.logs.search({
    query: "where source == 'stripe_webhook' and stripe_event_type == 'customer.subscription.updated'",
    limit: 25,
});
```

### Writing a query

Use `where` to filter, `order by` to sort, and `limit` to cap results. Join these steps with `|`. Without a query, you get the most recent logs.

Filter on fields like `customer_id`, `status_code`, `request_path`, and `stripe_event_type`. Use dot paths for body fields, such as `request_body.feature_id`, or `contains` to find text: `where response_body contains 'error'`.

Field names inside the query stay in snake\_case, including when you use the TypeScript SDK.

By default, the search covers the last 30 minutes. Set `range` to search another window of up to 365 days.

### Body Parameters

Filter and sort logs using where, order by, and limit, joined with |. Omit to return recent logs.

Time window to search. Defaults to the last 30 minutes. Maximum 365 days.

**properties**

Start of the time window in ISO 8601 format. Defaults to 30 minutes before end\_date.

End of the time window in ISO 8601 format. Defaults to now.

Maximum number of logs to return, from 1 to 200. Defaults to 100.

### Response

Matching logs, newest first unless you specify an order.

**properties**

When the log was recorded, in ISO 8601 format.

Whether this was an API request or an incoming Stripe webhook.

HTTP response status code.

HTTP request details.

**properties**

HTTP method, such as GET or POST.

Full request URL.

Request path without the host or query string.

Organization, customer, and user associated with the request.

**properties**

Autumn organization that made the request.

Customer ID associated with the request, if available.

Entity ID associated with the request, if available.

How the request was authenticated, such as secret\_key or dashboard.

Authenticated user's ID, if available.

Authenticated user's email, if available.

Stripe webhook details. Fields are null for API requests.

**properties**

Stripe event ID, if this was a Stripe webhook.

Stripe event type, such as customer.subscription.updated.

ID of the Stripe object the event refers to.

Recorded request body, or null if unavailable.

Recorded response body, or null if unavailable.

```json 200 theme={null}
{
  "list": [
    {
      "timestamp": "2026-09-21T12:00:00.000Z",
      "source": "api_request",
      "status_code": 200,
      "request": {
        "method": "POST",
        "url": "https://api.useautumn.com/v1/balances.check",
        "path": "/v1/balances.check"
      },
      "context": {
        "org_id": "org_123",
        "customer_id": "cus_123",
        "entity_id": null,
        "auth_type": "secret_key",
        "user_id": "user_123",
        "user_email": "user@example.com"
      },
      "stripe": {
        "event_id": null,
        "event_type": null,
        "object_id": null
      },
      "request_body": {
        "customer_id": "cus_123"
      },
      "response_body": {
        "allowed": true
      }
    }
  ]
}
```


## OpenAPI

````yaml openapi POST /v1/logs.search
openapi: 3.1.0
info:
  title: Autumn API
  version: 2.6.0
servers:
  - url: https://api.useautumn.com
    description: Production server
security:
  - secretKey: []
paths:
  /v1/logs.search:
    post:
      tags:
        - logs
      description: >-
        Search API requests and incoming Stripe webhooks for your organization
        and environment.
      operationId: searchRequestLogs
      parameters:
        - name: x-api-version
          in: header
          required: true
          schema:
            type: string
            default: 2.6.0
          x-speakeasy-globals-hidden: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  maxLength: 4000
                  description: >-
                    Filter and sort logs using where, order by, and limit,
                    joined with |. Omit to return recent logs.
                range:
                  type: object
                  properties:
                    start_date:
                      type: string
                      description: >-
                        Start of the time window in ISO 8601 format. Defaults to
                        30 minutes before end_date.
                    end_date:
                      type: string
                      description: >-
                        End of the time window in ISO 8601 format. Defaults to
                        now.
                  additionalProperties: false
                  title: SearchLogsRange
                  description: >-
                    Time window to search. Defaults to the last 30 minutes.
                    Maximum 365 days.
                limit:
                  type: integer
                  minimum: 1
                  maximum: 200
                  description: >-
                    Maximum number of logs to return, from 1 to 200. Defaults to
                    100.
              additionalProperties: false
              title: SearchRequestLogsParams
              examples:
                - query: where status_code >= 400 | order by timestamp desc
                  limit: 50
            example:
              query: where status_code >= 400 | order by timestamp desc
              limit: 50
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  list:
                    type: array
                    items:
                      type: object
                      properties:
                        timestamp:
                          type: string
                          description: When the log was recorded, in ISO 8601 format.
                        source:
                          enum:
                            - api_request
                            - stripe_webhook
                          type: string
                          description: >-
                            Whether this was an API request or an incoming
                            Stripe webhook.
                        status_code:
                          type: number
                          description: HTTP response status code.
                        request:
                          type: object
                          properties:
                            method:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: HTTP method, such as GET or POST.
                            url:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: Full request URL.
                            path:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: Request path without the host or query string.
                          required:
                            - method
                            - url
                            - path
                          description: HTTP request details.
                        context:
                          type: object
                          properties:
                            org_id:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: Autumn organization that made the request.
                            customer_id:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: >-
                                Customer ID associated with the request, if
                                available.
                            entity_id:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: >-
                                Entity ID associated with the request, if
                                available.
                            auth_type:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: >-
                                How the request was authenticated, such as
                                secret_key or dashboard.
                            user_id:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: Authenticated user's ID, if available.
                            user_email:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: Authenticated user's email, if available.
                          required:
                            - org_id
                            - customer_id
                            - entity_id
                            - auth_type
                            - user_id
                            - user_email
                          description: >-
                            Organization, customer, and user associated with the
                            request.
                        stripe:
                          type: object
                          properties:
                            event_id:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: Stripe event ID, if this was a Stripe webhook.
                            event_type:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: >-
                                Stripe event type, such as
                                customer.subscription.updated.
                            object_id:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: ID of the Stripe object the event refers to.
                          required:
                            - event_id
                            - event_type
                            - object_id
                          description: >-
                            Stripe webhook details. Fields are null for API
                            requests.
                        request_body:
                          anyOf:
                            - {}
                            - type: 'null'
                          description: Recorded request body, or null if unavailable.
                        response_body:
                          anyOf:
                            - {}
                            - type: 'null'
                          description: Recorded response body, or null if unavailable.
                      required:
                        - timestamp
                        - source
                        - status_code
                        - request
                        - context
                        - stripe
                    description: Matching logs, newest first unless you specify an order.
                required:
                  - list
                examples:
                  - list:
                      - timestamp: '2026-09-21T12:00:00.000Z'
                        source: api_request
                        status_code: 200
                        request:
                          method: POST
                          url: https://api.useautumn.com/v1/balances.check
                          path: /v1/balances.check
                        context:
                          org_id: org_123
                          customer_id: cus_123
                          entity_id: null
                          auth_type: secret_key
                          user_id: user_123
                          user_email: user@example.com
                        stripe:
                          event_id: null
                          event_type: null
                          object_id: null
                        request_body:
                          customer_id: cus_123
                        response_body:
                          allowed: true
              example:
                list:
                  - timestamp: '2026-09-21T12:00:00.000Z'
                    source: api_request
                    status_code: 200
                    request:
                      method: POST
                      url: https://api.useautumn.com/v1/balances.check
                      path: /v1/balances.check
                    context:
                      org_id: org_123
                      customer_id: cus_123
                      entity_id: null
                      auth_type: secret_key
                      user_id: user_123
                      user_email: user@example.com
                    stripe:
                      event_id: null
                      event_type: null
                      object_id: null
                    request_body:
                      customer_id: cus_123
                    response_body:
                      allowed: true
      x-codeSamples:
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Autumn } from 'autumn-js'

            const autumn = new Autumn()

            const result = await autumn.logs.search({
              query: "where status_code >= 400 | order by timestamp desc",
              limit: 50,
            });
        - lang: python
          label: Python (SDK)
          source: |-
            from autumn_sdk import Autumn

            autumn = Autumn(secret_key="am_sk_test...")

            res = autumn.logs.search(
                query="where status_code >= 400 | order by timestamp desc",
                limit=50,
            )
components:
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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