openapi: 3.0.3 info: title: Pydantic API Discovery Alerts Usage API version: 1.0.0 summary: Discovery document for Pydantic's region-partitioned APIs. description: 'Pydantic Logfire is region-partitioned. This document does not describe the Logfire API directly — it advertises a single discovery endpoint that lists the per-region OpenAPI specifications. - **US region**: https://logfire-us.pydantic.dev/api/openapi.json - **EU region**: https://logfire-eu.pydantic.dev/api/openapi.json ## Versioning This discovery API uses URL path versioning. The current major version is `v1` and is served from `https://pydantic.dev/api/v1/`. Unversioned requests to `https://pydantic.dev/api` and `https://pydantic.dev/api/` are permanently redirected (HTTP 308) to the current major version. Breaking changes will be released under a new major version (e.g. `/api/v2/`) and the previous version will be supported for at least 12 months after the new version ships, with the deprecation date advertised in the `Deprecation` and `Sunset` response headers (RFC 8594, RFC 9745). Responses include an `X-API-Version` header identifying the version that served the request. Related discovery resources: - [`/.well-known/api-catalog`](https://pydantic.dev/.well-known/api-catalog) — RFC 9727 Linkset of available API descriptions. - [`/.well-known/openapi-specs`](https://pydantic.dev/.well-known/openapi-specs) — JSON list of per-region OpenAPI specs. - [`/.well-known/oauth-protected-resource`](https://pydantic.dev/.well-known/oauth-protected-resource) — RFC 9728 OAuth protected resource metadata.' contact: name: Pydantic url: https://pydantic.dev email: hello@pydantic.dev license: name: Pydantic Terms of Service url: https://pydantic.dev/legal/terms-of-service servers: - url: https://pydantic.dev/api/v1 description: Host Discovery — version 1 tags: - name: Usage paths: /v1/usage/daily/: get: tags: - Usage summary: Get Organization Daily Usage description: 'Get organization-level daily usage (up to 3 months). Returns daily usage aggregated across all projects, read from `token_usage_rollup`.' operationId: get_organization_daily_usage_v1_usage_daily__get security: - OAuth2AuthorizationCodeBearer: - organization:payment parameters: - name: start_date in: query required: true schema: type: string format: date title: Start Date - name: end_date in: query required: true schema: type: string format: date title: End Date responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/UsageResponseV1' '429': description: Rate limit exceeded headers: Retry-After: description: Seconds to wait before retrying. schema: type: string content: application/json: schema: $ref: '#/components/schemas/HTTPExceptionError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /v1/usage/monthly/: get: tags: - Usage summary: Get Organization Monthly Usage description: 'Get organization-level monthly usage since account opening. Returns monthly usage aggregated across all projects, read from `token_usage_monthly`.' operationId: get_organization_monthly_usage_v1_usage_monthly__get security: - OAuth2AuthorizationCodeBearer: - organization:payment parameters: - name: start_date in: query required: true schema: type: string format: date title: Start Date - name: end_date in: query required: true schema: type: string format: date title: End Date responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/UsageResponseV1' '429': description: Rate limit exceeded headers: Retry-After: description: Seconds to wait before retrying. schema: type: string content: application/json: schema: $ref: '#/components/schemas/HTTPExceptionError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /v1/usage/projects/daily/: get: tags: - Usage summary: Get All Projects Daily Usage description: 'Get daily usage for all projects in the organization (up to 90 days). Returns daily usage broken down by project. Each row is one `(date, project)` pair. Read from `token_usage_rollup`. Supports pagination via `limit` and `offset`.' operationId: get_all_projects_daily_usage_v1_usage_projects_daily__get security: - OAuth2AuthorizationCodeBearer: - organization:payment parameters: - name: start_date in: query required: true schema: type: string format: date title: Start Date - name: end_date in: query required: true schema: type: string format: date title: End Date - name: limit in: query required: false schema: type: integer maximum: 200 minimum: 1 default: 100 title: Limit - name: offset in: query required: false schema: type: integer minimum: 0 default: 0 title: Offset responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PaginatedProjectsUsageResponseV1' '429': description: Rate limit exceeded headers: Retry-After: description: Seconds to wait before retrying. schema: type: string content: application/json: schema: $ref: '#/components/schemas/HTTPExceptionError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /v1/usage/projects/monthly/: get: tags: - Usage summary: Get All Projects Monthly Usage description: 'Get monthly usage for all projects in the organization. Returns monthly usage broken down by project. Each row is one `(month, project)` pair. Read from `token_usage_monthly`.' operationId: get_all_projects_monthly_usage_v1_usage_projects_monthly__get security: - OAuth2AuthorizationCodeBearer: - organization:payment parameters: - name: start_date in: query required: true schema: type: string format: date title: Start Date - name: end_date in: query required: true schema: type: string format: date title: End Date responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ProjectsUsageResponseV1' '429': description: Rate limit exceeded headers: Retry-After: description: Seconds to wait before retrying. schema: type: string content: application/json: schema: $ref: '#/components/schemas/HTTPExceptionError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /v1/usage/projects/{project_id}/daily/: get: tags: - Usage summary: Get Project Daily Usage description: 'Get daily usage for a single project (up to 3 months). Returns daily usage for the specified project, read from `token_usage_rollup`.' operationId: get_project_daily_usage_v1_usage_projects__project_id__daily__get security: - OAuth2AuthorizationCodeBearer: - organization:payment parameters: - name: project_id in: path required: true schema: type: string format: uuid title: Project Id - name: start_date in: query required: true schema: type: string format: date title: Start Date - name: end_date in: query required: true schema: type: string format: date title: End Date responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/UsageResponseV1' '429': description: Rate limit exceeded headers: Retry-After: description: Seconds to wait before retrying. schema: type: string content: application/json: schema: $ref: '#/components/schemas/HTTPExceptionError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /v1/usage/projects/{project_id}/monthly/: get: tags: - Usage summary: Get Project Monthly Usage description: 'Get monthly usage for a single project since account opening. Returns monthly usage for the specified project, read from `token_usage_monthly`.' operationId: get_project_monthly_usage_v1_usage_projects__project_id__monthly__get security: - OAuth2AuthorizationCodeBearer: - organization:payment parameters: - name: project_id in: path required: true schema: type: string format: uuid title: Project Id - name: start_date in: query required: true schema: type: string format: date title: Start Date - name: end_date in: query required: true schema: type: string format: date title: End Date responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/UsageResponseV1' '429': description: Rate limit exceeded headers: Retry-After: description: Seconds to wait before retrying. schema: type: string content: application/json: schema: $ref: '#/components/schemas/HTTPExceptionError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: HTTPExceptionError: properties: detail: type: string title: Detail type: object required: - detail title: HTTPExceptionError ProjectsUsageResponseV1: properties: start_date: type: string format: date title: Start Date end_date: type: string format: date title: End Date total_records_count: type: integer title: Total Records Count total_metrics_count: type: integer title: Total Metrics Count total_observations: type: integer title: Total Observations usage: items: $ref: '#/components/schemas/ProjectUsageRowV1' type: array title: Usage type: object required: - start_date - end_date - total_records_count - total_metrics_count - total_observations - usage title: ProjectsUsageResponseV1 ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type input: title: Input ctx: type: object title: Context type: object required: - loc - msg - type title: ValidationError PaginatedProjectsUsageResponseV1: properties: start_date: type: string format: date title: Start Date end_date: type: string format: date title: End Date total: type: integer title: Total usage: items: $ref: '#/components/schemas/ProjectUsageRowV1' type: array title: Usage type: object required: - start_date - end_date - total - usage title: PaginatedProjectsUsageResponseV1 UsageResponseV1: properties: start_date: type: string format: date title: Start Date end_date: type: string format: date title: End Date total_records_count: type: integer title: Total Records Count total_metrics_count: type: integer title: Total Metrics Count total_observations: type: integer title: Total Observations usage: items: $ref: '#/components/schemas/UsageRowV1' type: array title: Usage type: object required: - start_date - end_date - total_records_count - total_metrics_count - total_observations - usage title: UsageResponseV1 HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError UsageRowV1: properties: date: type: string format: date title: Date records_count: type: integer title: Records Count metrics_count: type: integer title: Metrics Count total_observations: type: integer title: Total Observations type: object required: - date - records_count - metrics_count - total_observations title: UsageRowV1 ProjectUsageRowV1: properties: date: type: string format: date title: Date project_id: type: string format: uuid title: Project Id project_name: type: string title: Project Name records_count: type: integer title: Records Count metrics_count: type: integer title: Metrics Count total_observations: type: integer title: Total Observations type: object required: - date - project_id - project_name - records_count - metrics_count - total_observations title: ProjectUsageRowV1