HTTP REST API

You can use Logs even if there's no official library for your programming language by sending your logs to our HTTP API.

This endpoint allows you to log a single event or a list of events. The events can be encoded in JSON or preferably in a more efficient MessagePack.

POST https://in.logs.betterstack.com

Headers

Content-Type
required string
Authorization
required string

Body parameters

Multiple events
required array
Single event
required object
202
403

Response body

Unauthorized
406

Response body

Couldn't parse JSON content.


Example: Single event

Send a single log line using cURL:

JSON MessagePack
curl -X POST https://in.logs.betterstack.com \
     -H "Authorization: Bearer $SOURCE_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"message":"logs is ready","nested":{"values":123}}'
curl -X POST https://in.logs.betterstack.com \
     -H "Authorization: Bearer $SOURCE_TOKEN" \
     -H "Content-Type: application/msgpack" \
     -d "\x82\xA7message\xB0logs is ready\xA6nested\x81\xA6values{"

Example: Multiple events

Send multiple log lines using cURL:

JSON MessagePack
curl -X POST https://in.logs.betterstack.com \
     -H "Authorization: Bearer $SOURCE_TOKEN" \
     -H "Content-Type: application/json" \
     -d '[{"message":"A"},{"message":"B"}]'
curl -X POST https://in.logs.betterstack.com \
     -H "Authorization: Bearer $SOURCE_TOKEN" \
     -H "Content-Type: application/msgpack" \
     -d "\x92\x81\xA7message\xA1A\x81\xA7message\xA1B"