> ## 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.

# Validate metrics datasource configuration



## OpenAPI

````yaml /api-reference/openapi.json post /terraform/metricsDatasources/validate
openapi: 3.0.0
info:
  title: Costory
  version: '1.0'
  description: API Documentation
servers:
  - url: https://app-api.costory.io
security: []
paths:
  /terraform/metricsDatasources/validate:
    post:
      tags:
        - Admin Metrics Datasources
      summary: Validate metrics datasource configuration
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdminMetricsDatasourceCreate'
      responses:
        '200':
          description: Validation result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminValidationResult'
        '400':
          description: Validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequest'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unauthorized'
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  schemas:
    AdminMetricsDatasourceCreate:
      oneOf:
        - type: object
          properties:
            name:
              type: string
            type:
              type: string
              enum:
                - AwsS3V2
            bucketName:
              type: string
            prefix:
              type: string
              default: ''
            roleArn:
              type: string
              pattern: '^arn:aws:iam::'
            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
                  dateColumn:
                    type: string
                required:
                  - metricName
                  - gapFilling
                  - aggregation
                  - valueColumn
                  - dateColumn
          required:
            - name
            - type
            - bucketName
            - roleArn
            - metricsDefinition
        - type: object
          properties:
            name:
              type: string
            type:
              type: string
              enum:
                - DatadogV2
            query:
              type: string
              minLength: 1
            datadogConfig:
              type: string
              minLength: 1
            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
                required:
                  - name
                  - gapFillingMethod
                  - aggregationFormula
          required:
            - name
            - type
            - query
            - datadogConfig
      discriminator:
        propertyName: type
    AdminValidationResult:
      type: object
      properties:
        isSuccess:
          type: boolean
      required:
        - isSuccess
      additionalProperties: {}
    BadRequest:
      type: object
      properties:
        error:
          type: string
          description: Error code
        reason:
          type: string
          description: Human-readable reason
        details:
          description: Additional details
        summary:
          type: string
          description: Optional short summary
      required:
        - error
    Unauthorized:
      type: object
      properties:
        error:
          type: string
          description: Unauthorized error message
      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.

````