Skip to main content
Send any event that explains spend via the Events API.

Example: Python

import os
import requests

payload = {
    "name": "Incident: cache saturation",
    "timestamp": "2026-03-04T18:42:00Z",
    "category": "TECHNICAL",
    "source": "custom",
    "environment": "prod",
    "service": "cache",
    "labels": ["incident", "cache"],
    "metadata": {
        "pagerduty_id": "P123456",
        "url": "https://status.acme.com/incidents/123"
    },
}

response = requests.post(
    "https://app-api.costory.io/events",
    headers={
        "Authorization": f"Bearer {os.environ['COSTORY_EVENTS_API_KEY']}",
        "Content-Type": "application/json",
    },
    json=payload,
    timeout=10,
)

response.raise_for_status()
For the latest auth headers and endpoint versions, see the Events API docs.
Last modified on March 18, 2026