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

# Submit a batch of events for testing

> Use this endpoint to send an array of events for processing. Make sure to comply with the request schema for each event. NOTE: this is a dry run and will not result in actual storage of the events.



## OpenAPI

````yaml post /events/dry-run
openapi: 3.0.0
info:
  title: Vayu API
  version: 1.0.0
  description: >-
    The Vayu API is a RESTful API that allows you to submit events for
    processing and storage & manage billing related entities.
              The API is secured using the Bearer Authentication scheme with JWT tokens.
              To obtain a JWT token, please contact Vayu at team@withvayu.com
  contact:
    email: dev@withvayu.com
    name: Vayu, Inc
    url: https://withvayu.com
servers:
  - url: https://connect.withvayu.com
    description: Production server
  - url: https://staging-connect.withvayu.com
    description: Sandbox server
security: []
tags:
  - name: auth
    description: >-
      The auth tag is used for endpoints related to authentication and
      authorization.
  - name: events
    description: The events tag is used for endpoints related to event ingestion.
  - name: customers
    description: The customers tag is used for endpoints related to customer management.
  - name: meters
    description: The meters tag is used for endpoints related to meter management.
  - name: contracts
    description: The contracts tag is used for endpoints related to contract management.
  - name: invoices
    description: The invoices tag is used for endpoints related to invoice management.
  - name: credits
    description: The credits tag is used for endpoints related to credit management.
  - name: webhooks
    description: The webhooks tag is used for endpoints related to webhook management.
paths:
  /events/dry-run:
    post:
      tags:
        - events
      summary: Submit a batch of events for testing
      description: >-
        Use this endpoint to send an array of events for processing. Make sure
        to comply with the request schema for each event. NOTE: this is a dry
        run and will not result in actual storage of the events.
      operationId: sendEventsDryRun
      requestBody:
        $ref: '#/components/requestBodies/EventsDryRunRequest'
      responses:
        '200':
          $ref: '#/components/responses/EventsDryRunResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorResponse'
        '413':
          description: Request Entity Too Large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestTooLongErrorResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - BearerAuthorizer: []
components:
  requestBodies:
    EventsDryRunRequest:
      required: true
      description: >-
        An array of events following the EventInput schema. This request body
        should be included in the PUT request to '/events'
              Up to 1000 events or a total payload max size of 256KB
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EventsDryRunRequest'
  responses:
    EventsDryRunResponse:
      description: Events with their corresponding meter and customer data.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EventsDryRunResponse'
  schemas:
    ValidationErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
        code:
          type: string
          description: Specific machine-readable error code
        message:
          type: string
          description: Human-readable error explanation
        param:
          type: string
          description: Single parameter that failed validation
        params:
          type: array
          items:
            type: object
            properties:
              param:
                type: string
                description: The parameter that failed validation
              message:
                type: string
                description: Why validation failed for this parameter
            required:
              - param
              - message
          description: Multiple parameters that failed validation
      required:
        - type
        - code
        - message
    UnauthorizedErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - authentication_error
        code:
          type: string
          enum:
            - authentication_failed
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    RequestTooLongErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
        code:
          type: string
          enum:
            - request_too_large
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    RateLimitErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - rate_limit_error
        code:
          type: string
          enum:
            - rate_limit_exceeded
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    InternalServerErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - api_error
        code:
          type: string
          enum:
            - internal_error
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    EventsDryRunRequest:
      type: object
      properties:
        events:
          type: array
          items:
            $ref: '#/components/schemas/Event'
          minItems: 1
          maxItems: 1000
      required:
        - events
    EventsDryRunResponse:
      type: object
      properties:
        events:
          type: array
          items:
            $ref: '#/components/schemas/EventsDryRunResponseObject'
      required:
        - events
    Event:
      type: object
      properties:
        name:
          type: string
          description: >-
            The distinctive label assigned to an event, serving as a critical
            identifier for categorizing and pricing events within the system's
            backend infrastructure.
          example: api_call
        timestamp:
          type: string
          description: >-
            The temporal marker denoting the exact moment of event occurrence.
            The timestamp is formatted as an ISO 8601 string and is expressed in
            Coordinated Universal Time (UTC). i.e. YYYY-MM-DDTHH:MM:SS.SSSZ
          format: date-time
          example: '2023-09-13T18:25:43.511Z'
        customerAlias:
          type: string
          minLength: 1
          description: >-
            A pseudonymous or otherwise obfuscated identifier uniquely assigned
            to each customer.
          example: customer_12345
        ref:
          type: string
          description: >-
            A universally unique identifier (UUID) or other form of high-entropy
            string serving as an immutable reference for each event entry.
          example: 4f6cf35x-2c4y-483z-a0a9-158621f77a21
        data:
          type: object
          nullable: true
          additionalProperties:
            nullable: true
          description: >-
            A schema-less JSON object encapsulating miscellaneous attributes and
            metrics associated with the event.
          example:
            key1: processing_duration
            key2: api_url
      required:
        - name
        - timestamp
        - customerAlias
        - ref
    EventsDryRunResponseObject:
      type: object
      properties:
        event:
          type: object
          properties:
            timestamp:
              type: string
              format: date-time
            customerAlias:
              type: string
              minLength: 1
            accountId:
              type: string
              pattern: ^[0-9a-fA-F]{24}$
            data:
              type: object
              nullable: true
              additionalProperties:
                nullable: true
            ref:
              type: string
            name:
              type: string
          required:
            - timestamp
            - customerAlias
            - accountId
            - ref
            - name
        matchedCustomer:
          type: string
          nullable: true
        meterWithValues:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/Meter'
              - type: object
                properties:
                  value:
                    type: number
                    nullable: true
                  instanceValue:
                    nullable: true
                required:
                  - value
      required:
        - event
        - meterWithValues
    Meter:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: The name of the meter
        eventName:
          type: string
          minLength: 1
          description: The name of the event that the meter is tracking.
        aggregationMethod:
          $ref: '#/components/schemas/AggregationMethod'
        filter:
          $ref: '#/components/schemas/Filter'
      required:
        - name
        - eventName
        - aggregationMethod
    AggregationMethod:
      type: object
      properties:
        operator:
          $ref: '#/components/schemas/AggregationOperator'
        field:
          type: string
          description: >-
            The field inside the "data" property to apply the aggregation method
            to.
        instanceKey:
          type: string
          description: >-
            The fields that is used to group different events together when
            measuring the usage.
      required:
        - operator
      description: >-
        The aggregation method defines how the events should be summed to
        represent a usage value.
    Filter:
      type: object
      properties:
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/Condition'
          minItems: 1
      required:
        - conditions
      description: |-
        The filter to apply to the events to be included in the meter.
            The filter object contains an array of Conditions, each condition represents a logical OR statement.
            Each condition contains an array of Criteria (criterions), each criterion represents a logical AND statement.
    AggregationOperator:
      type: string
      enum:
        - Count
        - Sum
        - Distinct
        - Max
        - Min
        - Average
        - First
        - Last
      description: >-
        The aggregation method defines how the events should be summed to
        represent a usage value.
    Condition:
      type: object
      properties:
        criterions:
          type: array
          items:
            $ref: '#/components/schemas/Criterion'
          minItems: 1
      required:
        - criterions
    Criterion:
      type: object
      properties:
        field:
          type: string
          minLength: 1
        operator:
          $ref: '#/components/schemas/CriterionOperator'
        value:
          type: string
          minLength: 1
      required:
        - field
        - operator
        - value
    CriterionOperator:
      type: string
      enum:
        - Equals
        - DoesntEqual
        - Has
        - In
        - Contains
        - DoesntContain
        - LargerThan
        - LowerThan
        - LowerEqualTo
        - LargerEqualTo
        - Exists
        - DoesntExists
  securitySchemes:
    BearerAuthorizer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````