v1

latestOpenAPI 3.1.02026-07-2691819.8 KB

Create Event

Create an event.

Creating an endpoint requires supplying a fingerprint. See how to create a fingerprint here.

Agents, Agent Versions, People and Sessions that are provided but do not exist will be created.

post/api/v1/events

Headers

Authorizationstring required
Example:Bearer 123

Request body

event_name'llm' required

Type of the event. Currently, only "llm" is supported.

fingerprint_idstring uuid required

The fingerprint of the client that generated the event.

agentstring nullable

The name of the agent associated with the event.

    If this agent does not exist, it will be created.
    
agent_versionstring nullable

The name of the agent version associated with the event.

    If this agent version does not exist, it will be created. If an agent version is not supplied, a default version will be used.
    
personstring nullable

The unique identifier of the person associated with the event.

    If the person does not exist, it will be created.
    
sessionstring required

The unique identifier of the session associated with the event.

Example request

{
  "agent": "customer-support-agent",
  "agent_version": "v1",
  "event_name": "llm",
  "fingerprint_id": "123",
  "person": "user_123",
  "properties": {
    "api": "openai-chat-completions",
    "inputs": {
      "messages": [
        {
          "content": "You are a helpful assistant.",
          "role": "system"
        },
        {
          "content": "Can you help me?",
          "role": "user"
        }
      ],
      "model": "gpt-4o"
    },
    "output": {
      "choices": [
        {
          "finish_reason": "stop",
          "index": 0,
          "message": {
            "content": "Hello! How can I assist you today?",
            "role": "assistant"
          }
        }
      ],
      "id": "chatcmpl-123",
      "model": "gpt-4o-2024-08-06",
      "usage": {
        "completion_tokens": 9,
        "completion_tokens_details": {
          "accepted_prediction_tokens": 0,
          "audio_tokens": 0,
          "reasoning_tokens": 0,
          "rejected_prediction_tokens": 0
        },
        "prompt_tokens": 99,
        "prompt_tokens_details": {
          "audio_tokens": 0,
          "cached_tokens": 0
        },
        "total_tokens": 108
      }
    }
  },
  "session": "session_456"
}

Response

Successful Response

{"stackTrail":"paths:/api/v1/events:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}