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

# Create billable metric

> Create a new aggregate with the provided details.



## OpenAPI

````yaml /openAPI/openapi-20240301.json post /aggregates
openapi: 3.1.0
info:
  title: zenskar
  version: 2.0.0
servers:
  - url: https://api.zenskar.com
security:
  - ApiTokenAuth: []
    OrganisationAuth: []
paths:
  /aggregates:
    post:
      tags:
        - Billable Metrics
      summary: Create billable metric
      description: Create a new aggregate with the provided details.
      operationId: Create-billable-metric
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAggregateRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AggregateResponseSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateAggregateRequestSchema:
      properties:
        name:
          type: string
          title: Name
          description: name of the aggregate
        dataschema:
          type: string
          title: Dataschema
          description: data schema of aggregate
        aggregation_query:
          type: string
          title: Aggregation Query
          description: aggregate query
        cust_agg_query:
          type: string
          title: Cust Agg Query
          description: customer aggregate query
        visual_query_builder:
          additionalProperties: true
          type: object
          title: Visual Query Builder
          description: visual query builder
        datasource:
          type: string
          title: Datasource
          description: data source uuid
      type: object
      required:
        - name
        - dataschema
        - aggregation_query
        - cust_agg_query
        - visual_query_builder
        - datasource
      title: CreateAggregateRequestSchema
      description: Create Aggregate Request Schema
    AggregateResponseSchema:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: aggregate Id
        name:
          type: string
          title: Name
          description: name of the aggregate
        dataschema:
          type: string
          title: Dataschema
          description: data schema of aggregate
        aggregation_query:
          type: string
          title: Aggregation Query
          description: aggregate query
        cust_agg_query:
          type: string
          title: Cust Agg Query
          description: customer aggregate query
        visual_query_builder:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Visual Query Builder
          description: visual query builder
        datasource:
          type: string
          format: uuid
          title: Datasource
          description: data source uuid
        version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Version
          description: version of aggregate
      type: object
      required:
        - id
        - name
        - dataschema
        - aggregation_query
        - cust_agg_query
        - visual_query_builder
        - datasource
      title: AggregateResponseSchema
      description: Aggregate Response Schema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiTokenAuth:
      type: apiKey
      in: header
      name: x-api-key
      x-default: <your-api-key>
    OrganisationAuth:
      type: apiKey
      in: header
      name: organisation
      x-default: <your-organisation-id>

````