> ## Documentation Index
> Fetch the complete documentation index at: https://agentmail.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://agentmail.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://agentmail.manicule.dev/api/mcp.
> Every agent surface: https://agentmail.manicule.dev/.well-known/llms-manifest.json

# Query Events (/api-reference/query-events)

<!-- agent-signals: reading_time_min: 3 · est_tokens: 1486 · updated: 2026-09-29 -->
Related: [Sign Up](/api-reference/sign-up.md), [Attach Human](/api-reference/attach-human.md), [Verify](/api-reference/verify.md), [List Inboxes](/api-reference/list-inboxes.md), [Create Inbox](/api-reference/create-inbox.md), [Search Inboxes](/api-reference/search-inboxes.md)

# Query Events

`GET /v0/inboxes/{inbox_id}/metrics/events`

> Counts of email events (sent, delivered, bounced, etc.) over time for
> the inbox. Defaults to the last 24 hours; `start` must be within the
> last 90 days, and a future `end` is clamped to now. Omit `period` for
> individual event counts, or set it to sum counts into buckets of that
> many seconds.
>
> **CLI:**
> ```bash
> agentmail inboxes metrics query-events --inbox-id <inbox_id>
> ```

Base URL: `https://api.agentmail.to`

Base URL: `https://x402.api.agentmail.to`

Base URL: `https://mpp.api.agentmail.to`

Base URL: `https://api.agentmail.eu`

## OpenAPI

```json
{
  "servers": [
    {
      "url": "https://api.agentmail.to",
      "description": "prod"
    },
    {
      "url": "https://x402.api.agentmail.to",
      "description": "prod-x402"
    },
    {
      "url": "https://mpp.api.agentmail.to",
      "description": "prod-mpp"
    },
    {
      "url": "https://api.agentmail.eu",
      "description": "eu-prod"
    }
  ],
  "security": [
    {
      "Bearer": []
    }
  ],
  "securitySchemes": {
    "Bearer": {
      "type": "http",
      "scheme": "bearer"
    }
  },
  "parameters": [
    {
      "name": "inbox_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "description": "The ID of the inbox.",
        "title": "InboxId"
      }
    },
    {
      "name": "event_types",
      "in": "query",
      "required": false,
      "schema": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "message.received",
            "message.received.spam",
            "message.received.blocked",
            "message.received.unauthenticated",
            "message.sent",
            "message.delivered",
            "message.bounced",
            "message.complained",
            "message.rejected",
            "domain.verified"
          ],
          "description": "Type of metric event.",
          "title": "MetricEventType"
        },
        "description": "List of metric event types to query.",
        "title": "MetricEventTypes"
      }
    },
    {
      "name": "start",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date-time",
        "description": "Start timestamp for the query.",
        "title": "Start"
      }
    },
    {
      "name": "end",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date-time",
        "description": "End timestamp for the query.",
        "title": "End"
      }
    },
    {
      "name": "period",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "description": "Size of each time bucket as a whole number of seconds, between 1 and 86400.",
        "title": "Period"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "description": "Limit on number of buckets to return.",
        "title": "MetricLimit"
      }
    },
    {
      "name": "descending",
      "in": "query",
      "required": false,
      "schema": {
        "type": "boolean",
        "description": "Sort in descending order.",
        "title": "Descending"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Response with status 200",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "timestamp": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Timestamp of the bucket."
                  },
                  "count": {
                    "type": "integer",
                    "description": "Count of events in the bucket."
                  }
                },
                "required": [
                  "timestamp",
                  "count"
                ],
                "title": "MetricBucket"
              }
            },
            "description": "Metrics grouped by event type.",
            "title": "QueryMetricsResponse"
          }
        }
      }
    },
    "400": {
      "description": "Error response with status 400",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "Name of error.",
                "title": "ErrorName"
              },
              "code": {
                "type": "string",
                "description": "Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.",
                "title": "ErrorCode"
              },
              "message": {
                "type": "string",
                "description": "Error message.",
                "title": "ErrorMessage"
              },
              "errors": {
                "description": "Validation errors. Each entry has a path and a message identifying the invalid field."
              },
              "fix": {
                "type": "string",
                "description": "The concrete next action that resolves the error.",
                "title": "ErrorFix"
              },
              "docs": {
                "type": "string",
                "description": "Link to the error reference entry for this code.",
                "title": "ErrorDocs"
              }
            },
            "required": [
              "name",
              "errors"
            ],
            "title": "ValidationErrorResponse"
          }
        }
      }
    }
  }
}
```
