Example: Python
For the latest auth headers and endpoint versions, see the Events API docs.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Send any event that explains cloud spend to Costory using the Events API and 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()
Was this page helpful?
