OpenAPI Specification
openapi: 3.0.3
info:
title: Uptrace Alerts Metrics API
description: Uptrace is an open source APM (Application Performance Monitoring) and distributed tracing platform powered by OpenTelemetry. The Uptrace REST API provides programmatic access to annotations, Prometheus metrics ingestion, alerting rules, and telemetry data including traces, metrics, and logs. Uptrace accepts telemetry data via OTLP/gRPC and OTLP/HTTP protocols in addition to Prometheus Remote Write.
version: v1
contact:
name: Uptrace Support
url: https://uptrace.dev
license:
name: BSL 1.1
url: https://github.com/uptrace/uptrace/blob/master/LICENSE
servers:
- url: https://api.uptrace.dev
description: Uptrace Cloud API
- url: http://localhost:14318
description: Uptrace Self-Hosted (HTTP port)
security:
- BearerAuth: []
tags:
- name: Metrics
description: Prometheus metrics ingestion and querying
paths:
/api/v1/prometheus/write:
post:
operationId: prometheusRemoteWrite
summary: Prometheus Remote Write
description: Ingest Prometheus metrics into Uptrace using the Prometheus Remote Write protocol (protobuf-encoded snappy-compressed timeseries data).
tags:
- Metrics
requestBody:
required: true
content:
application/x-protobuf:
schema:
type: string
format: binary
description: Prometheus WriteRequest protobuf (snappy compressed)
responses:
'204':
description: Metrics ingested successfully
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/api/prometheus/{projectId}:
get:
operationId: prometheusQueryRange
summary: Prometheus Query Range
description: Query Uptrace metrics using PromQL over a time range. Compatible with Grafana's Prometheus data source and standard Prometheus HTTP API.
tags:
- Metrics
parameters:
- name: projectId
in: path
required: true
schema:
type: string
description: Uptrace project ID or 'default'
- name: query
in: query
schema:
type: string
description: PromQL query expression
- name: start
in: query
schema:
type: string
description: Start timestamp (Unix or RFC3339)
- name: end
in: query
schema:
type: string
description: End timestamp (Unix or RFC3339)
- name: step
in: query
schema:
type: string
description: Query resolution step (e.g., 15s, 1m)
responses:
'200':
description: PromQL query result
content:
application/json:
schema:
$ref: '#/components/schemas/PrometheusQueryResult'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
components:
responses:
Unauthorized:
description: API token missing or invalid
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
Error:
type: object
properties:
message:
type: string
description: Error message
PrometheusQueryResult:
type: object
properties:
status:
type: string
enum:
- success
- error
data:
type: object
properties:
resultType:
type: string
enum:
- matrix
- vector
- scalar
- string
result:
type: array
items:
type: object
properties:
metric:
type: object
additionalProperties:
type: string
values:
type: array
items:
type: array
items:
oneOf:
- type: number
- type: string
securitySchemes:
DSNAuth:
type: apiKey
in: header
name: Authorization
description: 'DSN-based token: ''Bearer <project_secret_token>'''
BearerAuth:
type: http
scheme: bearer
description: Uptrace API token