Metering Events

Ingest metering events

Changed on

Ingests an event or batch of events following the CloudEvents specification.

post/v3/openmeter/events

Request

  • Base URL
    https://global.api.konghq.com
  • Auth
    • HTTP bearer
    • or HTTP bearer
    • or HTTP bearer
    • or HTTP bearer

Request body

MeteringEvent required

Metering event following the CloudEvents specification.

id, string required

Identifies the event.

source, string uri-reference required

Identifies the context in which an event happened.

specversion, string required

The version of the CloudEvents specification which the event uses.

type, string required

Contains a value describing the type of event related to the originating occurrence.

datacontenttype, 'application/json' nullable

Content type of the CloudEvents data value. Only the value "application/json" is allowed over HTTP.

dataschema, string uri nullable

Identifies the schema that data adheres to.

subject, string required

Describes the subject of the event in the context of the event producer (identified by source).

time, string date-time nullable

Timestamp of when the occurrence happened. Must adhere to RFC 3339.

data, object nullable

The event payload. Optional, if present it must be a JSON object.

Example request

{
  "specversion": "1.0",
  "id": "5c10fade-1c9e-4d6c-8275-c52c36731d3c",
  "source": "service-name",
  "type": "prompt",
  "subject": "customer-id",
  "time": "2023-01-01T01:01:01.001Z",
  "data": {
    "prompt": "Hello, world!",
    "tokens": 100,
    "model": "gpt-4o",
    "type": "input"
  }
}

Response

The events have been ingested and are being processed asynchronously.

Changes

    • breaking

      added to the invalid_parameters/items response property oneOf list for the response status

    • warning

      added the new key_invalid enum value to the invalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/rule response property for the response status

    • warning

      added the new unique enum value to the invalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/rule response property for the response status