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

# Get environment metrics

> Get metrics for a specific environment.

Each metric is read separately; one that could not be read is `{"error": true}` while the rest are
returned. For `http_response_count`, `average` holds each series' sum over the period and `total` the
sum of all of them. `min` and `max` are bounds for charting the series.



## OpenAPI

````yaml https://cloud.laravel.com/api-docs/api.json get /environments/{environment}/metrics
openapi: 3.1.0
info:
  title: Laravel Cloud
  version: 0.0.1
servers:
  - url: https://cloud.laravel.com/api
security:
  - http: []
tags:
  - name: Applications
  - name: Environments
  - name: Domains
  - name: Commands
  - name: Deployments
  - name: Instances
  - name: Email
  - name: Background Processes
  - name: Database Clusters
  - name: Databases
  - name: Database Snapshots
  - name: Database Restores
  - name: Object Storage Buckets
  - name: Bucket Keys
  - name: Caches
  - name: WebSocket Clusters
  - name: WebSocket Applications
  - name: Dedicated Clusters
  - name: Edge Networks
  - name: Secrets
  - name: Usage
  - name: Meta
  - name: Databases (Legacy)
paths:
  /environments/{environment}/metrics:
    get:
      tags:
        - Environments
      summary: Get environment metrics
      description: >-
        Get metrics for a specific environment.


        Each metric is read separately; one that could not be read is `{"error":
        true}` while the rest are

        returned. For `http_response_count`, `average` holds each series' sum
        over the period and `total` the

        sum of all of them. `min` and `max` are bounds for charting the series.
      operationId: public.environments.metrics
      parameters:
        - name: environment
          in: path
          required: true
          description: The environment identifier
          schema:
            type: string
        - name: period
          in: query
          schema:
            anyOf:
              - $ref: '#/components/schemas/MetricPeriod'
              - type: 'null'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      cpu_usage:
                        anyOf:
                          - type: object
                            properties:
                              labels:
                                type: array
                                items:
                                  type: string
                              data:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    x:
                                      type: string
                                    'y':
                                      type: array
                                      items:
                                        type: number
                                  required:
                                    - x
                                    - 'y'
                              average:
                                type: array
                                items:
                                  type: number
                              min:
                                type: number
                              max:
                                type: number
                            required:
                              - labels
                              - data
                              - average
                              - min
                              - max
                          - type: object
                            properties:
                              error:
                                type: boolean
                            required:
                              - error
                      memory_usage:
                        anyOf:
                          - type: object
                            properties:
                              labels:
                                type: array
                                items:
                                  type: string
                              data:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    x:
                                      type: string
                                    'y':
                                      type: array
                                      items:
                                        type: number
                                  required:
                                    - x
                                    - 'y'
                              average:
                                type: array
                                items:
                                  type: number
                              min:
                                type: number
                              max:
                                type: number
                            required:
                              - labels
                              - data
                              - average
                              - min
                              - max
                          - type: object
                            properties:
                              error:
                                type: boolean
                            required:
                              - error
                      http_response_count:
                        anyOf:
                          - type: object
                            properties:
                              labels:
                                type: array
                                items:
                                  type: string
                              data:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    x:
                                      type: string
                                    'y':
                                      type: array
                                      items:
                                        type: number
                                  required:
                                    - x
                                    - 'y'
                              total:
                                type: integer
                              average:
                                type: array
                                items:
                                  type: integer
                              min:
                                type: integer
                              max:
                                type: integer
                            required:
                              - labels
                              - data
                              - total
                              - average
                              - min
                              - max
                          - type: object
                            properties:
                              error:
                                type: boolean
                            required:
                              - error
                      replica_count:
                        anyOf:
                          - type: object
                            properties:
                              labels:
                                type: array
                                items:
                                  type: string
                              data:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    x:
                                      type: string
                                    'y':
                                      type: array
                                      items:
                                        type: integer
                                  required:
                                    - x
                                    - 'y'
                              average:
                                type: array
                                items:
                                  type: integer
                              min:
                                type: integer
                              max:
                                type: integer
                            required:
                              - labels
                              - data
                              - average
                              - min
                              - max
                          - type: object
                            properties:
                              error:
                                type: boolean
                            required:
                              - error
                      web_workers_count:
                        anyOf:
                          - type: object
                            properties:
                              labels:
                                type: array
                                items:
                                  type: string
                              data:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    x:
                                      type: string
                                    'y':
                                      type: array
                                      items:
                                        type: number
                                  required:
                                    - x
                                    - 'y'
                              average:
                                type: array
                                items:
                                  type: number
                              min:
                                type: number
                              max:
                                type: number
                            required:
                              - labels
                              - data
                              - average
                              - min
                              - max
                          - type: object
                            properties:
                              error:
                                type: boolean
                            required:
                              - error
                    required:
                      - cpu_usage
                      - memory_usage
                      - http_response_count
                      - replica_count
                      - web_workers_count
                  meta:
                    type: object
                    properties:
                      period:
                        type: string
                      available_periods:
                        type: array
                        items:
                          type: string
                    required:
                      - period
                      - available_periods
                required:
                  - data
                  - meta
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    MetricPeriod:
      type: string
      enum:
        - 6h
        - 24h
        - 3d
        - 7d
        - 30d
      title: MetricPeriod
  responses:
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ModelNotFoundException:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    http:
      type: http
      description: The Bearer Token generated on the Cloud UI.
      scheme: bearer
      bearerFormat: bearer

````