Skip to content
LogZuno

Send events with cURL

Send events to LogZuno from cURL, with code that is tested against the API.

This example sends one event to LogZuno's ingestion API from cURL. It is the exact file our snippet tests send to the API before the docs are published.

Requirements

curl 7 or later, installed on macOS and most Linux distributions.

Send an event

curl -sS -X POST "${LOGZUNO_ENDPOINT:-https://api.logzuno.app/v1}/log" \
  -H "Authorization: Bearer $LOGZUNO_API_KEY" \
  -H "Content-Type: application/json" \
  -w "\nHTTP %{http_code}\n" \
  -d '{
    "channel": "signups",
    "event": "User signed up",
    "user_id": "user-123",
    "description": "A new user created an account",
    "icon": "🎉",
    "notify": true,
    "tags": { "plan": "growth", "source": "website" }
  }'

Export LOGZUNO_API_KEY and paste the command into a terminal. LogZuno answers 202 and the event appears in your project's live feed within seconds. Keep the key in an environment variable or your secrets manager, not in source control.

Notes for cURL

In scripts and CI. Add --fail-with-body so a 4xx or 5xx makes curl exit with an error and print LogZuno's message, which tells you which field was wrong.

Cron jobs and deploys. A curl line at the end of a backup, a deploy or a scheduled job is the quickest way to get a live feed of your infrastructure, with notify: true on failures.

Batches. Wrap several events in {"events": [...]} and post them to /v1/batch; see sending events.

What the request contains

The body is the same in every language: a channel and an event, and optionally user_id, group_id, description, icon, notify and tags. All fields, limits and response codes are in sending events and the ingestion API reference.