openapi: 3.0.0 info: title: analytics API description: Analytics related endpoints version: 1.0.0 paths: /analytics/endpoints/logs.all: get: deprecated: true description: | Executes a SQL query on the project's logs. Either the `iso_timestamp_start` and `iso_timestamp_end` parameters must be provided. If both are not provided, only the last 1 minute of logs will be queried. The timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown. Note: Unless the `sql` parameter is provided, only edge_logs will be queried. See the [log query docs](https://supabase.com/docs/guides/monitoring-and-debugging/logs#logs-explorer) for all available sources. operationId: v1-get-project-logs-all parameters: - name: sql required: false in: query description: Custom SQL query to execute on the logs. See [querying logs](https://supabase.com/docs/guides/monitoring-and-debugging/logs#querying-with-the-logs-explorer) for more details. schema: example: select event_message from edge_logs limit 10 type: string - name: iso_timestamp_start required: false in: query schema: format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$ example: '2025-03-01T00:00:00Z' type: string - name: iso_timestamp_end required: false in: query schema: format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$ example: '2025-03-01T23:59:59Z' type: string responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/AnalyticsResponse' '401': description: Unauthorized '402': description: Usage exceeded. Enable additional usage to continue querying '403': description: Forbidden action '429': description: Rate limit exceeded security: - bearer: [] summary: Gets project's logs tags: - Analytics x-badges: - name: 'OAuth scope: analytics:read' position: after x-endpoint-owners: - observability x-fga-permissions: - - analytics_logs_read x-oauth-scope: analytics:read /analytics/endpoints/logs: get: deprecated: false description: | Executes an SQL or LQL query on the project's unified logs stream. Either the `iso_timestamp_start` and `iso_timestamp_end` parameters must be provided. If both are not provided, only the last 1 minute of logs will be queried. The timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown. Filter by the `source` column to specify specific log sources, such as edge_logs, postgres_logs, etc. Note: SQL must be written in **ClickHouse SQL dialect**. operationId: v1-get-project-logs parameters: - name: sql required: false in: query description: Custom SQL query to execute on the logs. See [querying logs](https://supabase.com/docs/guides/monitoring-and-debugging/logs#querying-with-the-logs-explorer) for more details. schema: example: select event_message from edge_logs limit 10 type: string - name: iso_timestamp_start required: false in: query schema: format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$ example: '2025-03-01T00:00:00Z' type: string - name: iso_timestamp_end required: false in: query schema: format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$ example: '2025-03-01T23:59:59Z' type: string responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/AnalyticsResponse' '401': description: Unauthorized '402': description: Usage exceeded. Enable additional usage to continue querying '403': description: Forbidden action '429': description: Rate limit exceeded security: - bearer: [] summary: Gets all project's logs in a single log stream tags: - Analytics x-badges: - name: 'OAuth scope: analytics:read' position: after x-endpoint-owners: - observability x-fga-permissions: - - analytics_logs_read x-oauth-scope: analytics:read /analytics/endpoints/usage.api-counts: get: operationId: v1-get-project-usage-api-count parameters: - name: interval required: false in: query schema: example: 1day type: string enum: - 15min - 30min - 1hr - 3hr - 1day - 3day - 7day responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/V1GetUsageApiCountResponse' '401': description: Unauthorized '403': description: Forbidden action '429': description: Rate limit exceeded '500': description: Failed to get project's usage api counts security: - bearer: [] summary: Gets project's usage api counts tags: - Analytics x-endpoint-owners: - observability x-fga-permissions: - - analytics_usage_read /analytics/endpoints/usage.api-requests-count: get: operationId: v1-get-project-usage-request-count parameters: [] responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/V1GetUsageApiRequestsCountResponse' '401': description: Unauthorized '403': description: Forbidden action '429': description: Rate limit exceeded '500': description: Failed to get project's usage api requests count security: - bearer: [] summary: Gets project's usage api requests count tags: - Analytics x-endpoint-owners: - observability x-fga-permissions: - - analytics_usage_read /analytics/endpoints/functions.combined-stats: get: operationId: v1-get-project-function-combined-stats parameters: - name: interval required: true in: query schema: example: 1hr type: string enum: - 15min - 1hr - 3hr - 1day - name: function_id required: true in: query schema: example: 3c078cce-ad70-4148-9f37-4da362789053 type: string responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/AnalyticsResponse' '401': description: Unauthorized '403': description: Forbidden action '429': description: Rate limit exceeded '500': description: Failed to get project's function combined statistics security: - bearer: [] summary: Gets a project's function combined statistics tags: - Analytics x-endpoint-owners: - observability x-fga-permissions: - - analytics_usage_read /analytics/endpoints/metrics: get: description: Prometheus scrape endpoint. Returns metrics of a customer project in the Prometheus open exposition format. operationId: v1-scrape-project-metrics parameters: [] responses: '200': description: Prometheus / OpenMetrics text exposition content: text/plain: schema: type: string application/openmetrics-text: schema: type: string '400': description: Project must be active and healthy, or metrics are not available for this project '401': description: Unauthorized '403': description: Forbidden action '429': description: Rate limit exceeded '500': description: Failed to fetch project's metrics security: - bearer: [] summary: Scrape a project's metrics tags: - Analytics x-badges: - name: 'OAuth scope: analytics:read' position: after x-endpoint-owners: - observability x-fga-permissions: - - analytics_logs_read x-oauth-scope: analytics:read components: schemas: AnalyticsResponse: type: object properties: result: type: array items: {} error: type: string properties: code: type: number errors: type: array items: type: object properties: domain: type: string location: type: string locationType: type: string message: type: string reason: type: string required: - domain - location - locationType - message - reason message: type: string status: type: string required: - code - errors - message - status V1GetUsageApiCountResponse: type: object properties: result: type: array items: type: object properties: timestamp: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|))$ total_auth_requests: type: number total_realtime_requests: type: number total_rest_requests: type: number total_storage_requests: type: number required: - timestamp - total_auth_requests - total_realtime_requests - total_rest_requests - total_storage_requests error: type: string properties: code: type: number errors: type: array items: type: object properties: domain: type: string location: type: string locationType: type: string message: type: string reason: type: string required: - domain - location - locationType - message - reason message: type: string status: type: string required: - code - errors - message - status V1GetUsageApiRequestsCountResponse: type: object properties: result: type: array items: type: object properties: count: type: number required: - count error: type: string properties: code: type: number errors: type: array items: type: object properties: domain: type: string location: type: string locationType: type: string message: type: string reason: type: string required: - domain - location - locationType - message - reason message: type: string status: type: string required: - code - errors - message - status servers: - url: https://api.supabase.com/v1/projects/{ref} variables: ref: description: Supabase project reference (the Project ID shown in the dashboard under Settings -> General; 20 lowercase letters). Resolved from the SUPABASE_PROJECT_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every project-scoped query as WHERE ref = ''. A WHERE value always takes precedence over the environment. x-stackQL-envVar: SUPABASE_PROJECT_ID