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

# Run a PromQL range query

> Run a PromQL range query against an Amazon Managed Prometheus workspace. GET /aws/amp/query-range in the Ravion API reference.



## OpenAPI

````yaml https://api.ravion.com/openapi.yaml get /aws/amp/query-range
openapi: 3.0.0
info:
  title: Ravion
  version: 0.0.0
servers:
  - url: https://api.ravion.com
security:
  - BearerAuth: []
tags:
  - name: Projects
  - name: Environments
  - name: Pipelines
  - name: PipelineRuns
  - name: TerraformResources
  - name: TerraformExecutionSummaries
  - name: PipelineStepExecutions
  - name: AwsCloudWatch
  - name: PipelineVersions
  - name: Organizations
  - name: Stacks
  - name: StackWorkspaces
  - name: Auth
  - name: OAuth
  - name: User
  - name: Health
  - name: Memberships
  - name: ServiceAccounts
  - name: AwsDefaultNetworks
  - name: AwsAccounts
  - name: ApiKeys
  - name: AwsAmp
  - name: EksPrometheus
  - name: EksLoki
  - name: ExecutionEnvironments
  - name: ModuleDefinitions
  - name: ModuleCategories
  - name: ModuleVersions
  - name: ModuleInstances
  - name: DefaultValueDefinitions
  - name: DefaultValues
  - name: CodeSources
  - name: Github
  - name: Gitlab
  - name: Git
  - name: Values
  - name: Deployments
  - name: DeploymentResources
  - name: InfrastructureEvents
  - name: WebSocket
  - name: Domains
  - name: AcmCertificates
  - name: Describe
  - name: Reports
paths:
  /aws/amp/query-range:
    get:
      tags:
        - AwsAmp
      summary: Run a PromQL range query
      description: >-
        Run a PromQL range query against an Amazon Managed Prometheus workspace.
        Resolves the AWS account from `awsAccountId` and the workspace from
        `region` + `workspaceId` (matches the `MetricSource.amp` module schema).
        Applies the same short Redis cache as the CloudWatch metric endpoint,
        plus a per-workspace request budget: AMP's query quotas are shared with
        the customer's own Prometheus consumers, so bursts are rejected with 429
        rather than passed upstream.
      operationId: GetAmpMetricData
      parameters:
        - description: >-
            AWS account database ID (or the account's givenId) used to resolve
            credentials.
          in: query
          name: awsAccountId
          required: true
          schema:
            type: string
        - description: AWS region the Amazon Managed Prometheus workspace lives in.
          in: query
          name: region
          required: true
          schema:
            type: string
        - description: Amazon Managed Prometheus workspace id (e.g. `ws-1234abcd-...`).
          in: query
          name: workspaceId
          required: true
          schema:
            type: string
        - description: >-
            PromQL expression. Occurrences of `$__interval` are replaced
            server-side with the normalized step, so range-vector windows always
            match the resolution actually queried.
          in: query
          name: query
          required: true
          schema:
            type: string
        - description: >-
            Requested step in seconds. Widened server-side to Amazon Managed
            Prometheus's 15s floor and to whatever keeps the window under the
            11,000-samples-per-series cap; the effective value is echoed as
            `stepSeconds`.
          in: query
          name: step
          required: true
          schema:
            format: int32
            type: integer
        - description: >-
            Inclusive start of the query window (ISO 8601). Must be earlier than
            `endTime` and within the workspace's 150-day retention.
          in: query
          name: startTime
          required: true
          schema:
            type: string
        - description: >-
            Inclusive end of the query window (ISO 8601). Must be after
            `startTime` and not in the future.
          in: query
          name: endTime
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AmpMetricDataResponse'
          description: The request has succeeded.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: The request is invalid or malformed.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: The server cannot find the requested resource.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Client error
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Client error
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Server error
components:
  schemas:
    AmpMetricDataResponse:
      additionalProperties: false
      description: >-
        Response payload for a PromQL range query. Always a list of series, even
        while charts render only the first one — that keeps multi-series charts
        from being a breaking change later.
      properties:
        series:
          description: Result series, in the order Amazon Managed Prometheus returned them
          items:
            $ref: '#/components/schemas/AmpMetricSeries'
          type: array
        stepSeconds:
          description: >-
            The step in seconds actually used, after normalization to Amazon
            Managed Prometheus's floor and per-series sample cap. May be coarser
            than the requested `step`.
          format: int32
          type: integer
      required:
        - series
        - stepSeconds
      type: object
    Errors.UserFacingErrorData:
      additionalProperties: false
      description: |-
        User-facing error presentation data.
        This is what the API returns to the frontend after formatting ErrorData
        using CEL templates from the error registry.

        Used for both:
        - Error fields on domain models (e.g., PipelineRun.error)
        - API error response bodies (HTTP 4xx/5xx responses)
      properties:
        action:
          allOf:
            - $ref: '#/components/schemas/Errors.Action'
          description: Optional action to help resolve the error
        code:
          description: Full error code, e.g., "Ravion:Pipeline:NOT_FOUND"
          type: string
        description:
          description: Additional description with more details
          type: string
        details:
          description: Structured details rendered as user-facing sections.
          items:
            $ref: '#/components/schemas/Errors.UserFacingErrorDetailSection'
          type: array
        isInternal:
          description: >-
            Indicates whether this error is internal (only set when
            ShowInternal=true).

            This allows SUPERADMINs to identify internal errors while viewing
            full details.
          type: boolean
        message:
          description: Main error message (required)
          type: string
        metadata:
          additionalProperties: {}
          description: >-
            Error params/metadata. Stripped for internal errors unless
            superadmin.
          type: object
        requestId:
          description: Request ID for correlating errors with server logs.
          type: string
      required:
        - code
        - message
      type: object
    AmpMetricSeries:
      additionalProperties: false
      description: >-
        One result series from a PromQL range query: its label set plus its
        datapoints.
      properties:
        datapoints:
          description: Datapoints, ordered by timestamp ascending
          items:
            $ref: '#/components/schemas/AmpMetricDatapoint'
          type: array
        labels:
          additionalProperties:
            type: string
          description: >-
            Prometheus label set identifying the series (e.g. `{pod: api-abc}`).
            Empty for fully-aggregated queries.
          type: object
      required:
        - labels
        - datapoints
      type: object
    Errors.Action:
      additionalProperties: false
      description: Action to help user resolve the error
      properties:
        label:
          description: Button/link label text
          type: string
        url:
          description: URL to navigate to for resolution
          type: string
      required:
        - label
        - url
      type: object
    Errors.UserFacingErrorDetailSection:
      additionalProperties: false
      description: Structured user-facing error detail section.
      properties:
        items:
          description: List of detail values for this section.
          items:
            type: string
          type: array
        object:
          additionalProperties: {}
          description: Structured detail payload for object rendering.
          type: object
        render:
          description: Rendering hint for clients. Valid values are list or object.
          type: string
        title:
          description: Detail section title shown in the UI.
          type: string
      required:
        - title
        - render
      type: object
    AmpMetricDatapoint:
      additionalProperties: false
      description: A single datapoint in a Prometheus result series
      properties:
        timestamp:
          description: Datapoint timestamp in ISO 8601 format
          type: string
        value:
          description: Sample value at that timestamp
          format: double
          type: number
      required:
        - timestamp
        - value
      type: object
  securitySchemes:
    BearerAuth:
      scheme: Bearer
      type: http

````