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

# Get a metrics datasource



## OpenAPI

````yaml /api-reference/openapi.json get /terraform/metricsDatasources/{id}
openapi: 3.0.0
info:
  title: Costory
  version: '1.0'
  description: API Documentation
servers:
  - url: https://app-api.costory.io
security: []
paths:
  /terraform/metricsDatasources/{id}:
    get:
      tags:
        - Admin Metrics Datasources
      summary: Get a metrics datasource
      parameters:
        - schema:
            type: string
          required: true
          name: id
          in: path
      responses:
        '200':
          description: Metrics datasource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminMetricsDatasourceRead'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unauthorized'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  schemas:
    AdminMetricsDatasourceRead:
      oneOf:
        - type: object
          properties:
            bucketName:
              type: string
            prefix:
              type: string
            roleArn:
              type: string
            name:
              type: string
            type:
              type: string
              enum:
                - AwsS3V2
            status:
              type: string
            metricsDefinition:
              type: array
              items:
                type: object
                properties:
                  metricName:
                    type: string
                    minLength: 1
                  gapFilling:
                    type: string
                    enum:
                      - ZERO
                      - FORWARD_FILL
                      - LINEAR_INTERPOLATION
                      - SPREAD
                  aggregation:
                    type: string
                    enum:
                      - SUM
                      - Average
                  dimensions:
                    type: array
                    items:
                      type: string
                  valueColumn:
                    type: string
                  unit:
                    type: string
                    nullable: true
                    default: null
                  dateColumn:
                    type: string
                required:
                  - metricName
                  - gapFilling
                  - aggregation
                  - valueColumn
                  - dateColumn
          required:
            - bucketName
            - prefix
            - roleArn
            - name
            - type
            - metricsDefinition
        - type: object
          properties:
            query:
              type: string
            datadogConfig:
              type: string
              default: ''
            name:
              type: string
            type:
              type: string
              enum:
                - DatadogV2
            status:
              type: string
            metricsDefinition:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                  gapFillingMethod:
                    type: string
                    enum:
                      - ZERO
                      - FORWARD_FILL
                      - LINEAR_INTERPOLATION
                      - SPREAD
                  aggregationFormula:
                    type: string
                    enum:
                      - SUM
                      - Average
                  dimensions:
                    type: array
                    items:
                      type: string
                    default: []
                  unit:
                    type: string
                    nullable: true
                    default: null
                required:
                  - name
                  - gapFillingMethod
                  - aggregationFormula
          required:
            - query
            - name
            - type
            - metricsDefinition
      discriminator:
        propertyName: type
    Unauthorized:
      type: object
      properties:
        error:
          type: string
          description: Unauthorized error message
      required:
        - error
    NotFound:
      type: object
      properties:
        error:
          type: string
          description: Resource not found error code
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT or Clerk ak_* API key
      description: >-
        Send `Authorization: Bearer <credential>` using either a Clerk session
        JWT or a Clerk API key (`ak_*`). API keys may identify a user (`user_*`)
        or organization (`org_*`) principal and are generated in the Clerk
        Dashboard under API keys.
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-token
      description: >-
        API token for authentication (or Admin API key). The token is scoped per
        organization and can be retrieved in the Organization Switcher.

````