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

# Create batch

> API to create events in batch

<Note>**SystemUser permission:** `MeterService:createUsageByMeter`</Note>


## OpenAPI

````yaml post /events/batch
openapi: 3.0.3
info:
  title: Enso API
  description: >-
    REST API for Enso's billing & metering platform. This reference covers
    endpoints accessible to the SystemUser role — the role used by API
    integrations.
  version: 1.0.0
  license:
    name: Proprietary
servers:
  - url: https://api.getenso.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Apps
    description: Third-party app integrations and credentials
  - name: Attributes
    description: Custom attribute definitions on catalog/customer entities
  - name: Auth
    description: Exchange API credentials for an access token
  - name: Billing
    description: Plans and plan items — what your contracts apply
  - name: Catalog
    description: SKUs and SKU groups — the product taxonomy that plans price against
  - name: Chatbot
    description: Conversational endpoints
  - name: Collections
    description: ''
  - name: Contracts
    description: Contracts that bind a customer to one or more billing plans
  - name: Customers
    description: Manage customer records — the parties Enso bills
  - name: Email templates
    description: Manage email templates
  - name: Entities
    description: Entities (legal entity, contracting organisation) used in billing
  - name: Events
    description: Raw event ingestion — the input to the metering pipeline
  - name: FSM (object lifecycle)
    description: >-
      Drive lifecycle transitions on Invoice/Contract/etc. — used for raise,
      send, mark-paid, etc.
  - name: FX Rates
    description: Currency conversion rates
  - name: Geography
    description: Country/state lookups — reference data for addresses
  - name: Invoices
    description: Invoice CRUD, items, sync, PDF generation, document upload
  - name: Jobs
    description: >-
      Background job orchestration — used by long-running operations like bulk
      sync
  - name: Masters
    description: ''
  - name: Meters
    description: Usage meters — the per-aggregation tally that feeds invoices
  - name: Objects
    description: Generic object schema and query — exposes the data model dynamically
  - name: Organisation
    description: ''
  - name: Organisation attributes
    description: Organisation-level custom attributes
  - name: Organisation settings
    description: Organisation-wide configuration values
  - name: Revenue
    description: Recognised revenue records derived from invoices
  - name: Usage
    description: Usage records — what got billed against each meter for a billing period
  - name: Users
    description: User account read access
paths:
  /events/batch:
    post:
      tags:
        - Events
      summary: Create batch
      description: API to create events in batch
      operationId: createEventsBatch
      requestBody:
        description: Batch events payload
        content:
          application/json:
            schema:
              type: object
              properties:
                events:
                  type: array
                  items:
                    type: object
                    properties:
                      CustomerEntityId:
                        type: string
                        description: >-
                          Enso ID of the customer entity associated with the
                          event. If Enso id is not known, you can pass any of
                          the unique identifiers of the customer entity instead.
                      metric:
                        type: string
                        description: Metric name
                      value:
                        type: number
                        format: float
                        description: Value of the metric
                      timestamp:
                        type: string
                        format: date-time
                        description: Timestamp of the event
                      metadata:
                        type: object
                        description: Additional metadata for the event
                      eventId:
                        type: string
                        description: >-
                          Unique identifier for the event. This is an optional
                          field that can be used to track events uniquely. If
                          not passed, an eventId will be generated based on
                          metric, value, timestamp and CustomerEntityId.
                      JobId:
                        type: string
                        description: Job identifier for the batch
                      jobId:
                        type: string
                        description: Job identifier for the batch
                    required:
                      - metric
                      - value
                      - timestamp
                      - CustomerEntityId
                  description: List of events to be created
              required:
                - events
      responses:
        '200':
          description: Batch processed
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                    example: Success
                  data:
                    type: object
                    properties:
                      summary:
                        type: object
                        properties:
                          success:
                            type: integer
                          failed:
                            type: integer
                          total:
                            type: integer
                      failedRecords:
                        type: array
                        items:
                          type: object
                          properties:
                            index:
                              type: integer
                            error:
                              type: string
                            code:
                              oneOf:
                                - type: integer
                                - type: string
                            statusCode:
                              type: integer
                example:
                  status: success
                  message: Success
                  data:
                    summary:
                      success: 0
                      failed: 3
                      total: 3
                    failedRecords:
                      - index: 2
                        error: Customer entity not found
                        code: 2002
                        statusCode: 404
                      - index: 0
                        error: >-
                          Cannot parse input: expected '"' before: 'N
                          NaN:NaN:NaN.NaN","metadata":null,"status":"active","CustomerEntityId":"ent_6CsgzAdRgTlzT_9O","JobId":"job_xI_wWRvcLpZzhiJF","OrganisationId":"org_k0JGnR6VZsLd':
                          (while reading the value of key timestamp): (at row
                          1)\n: While executing WaitForAsyncInsert. 
                        code: '27'
                        statusCode: 400
                      - index: 1
                        error: >-
                          Cannot parse input: expected '"' before: 'N
                          NaN:NaN:NaN.NaN","metadata":null,"status":"active","CustomerEntityId":"ent_6CsgzAdRgTlzT_9O","JobId":"job_xI_wWRvcLpZzhiJF","OrganisationId":"org_k0JGnR6VZsLd':
                          (while reading the value of key timestamp): (at row
                          1)\n: While executing WaitForAsyncInsert. 
                        code: '27'
                        statusCode: 400
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  code:
                    type: integer
                  errors:
                    type: array
                    items:
                      type: string
                  message:
                    type: string
        '401':
          description: Unauthorized — token missing or invalid
        '403':
          description: Forbidden — insufficient permissions
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT bearer token obtained from POST /auth/system-login using your client
        credentials.

````