# REST

> Send batches of events as JSON to POST /v1/ingest.

By the end of this page you can send events to dlogify from any language or script with a single HTTP request.

## Request

```http
POST https://api.dlogify.com/v1/ingest
Authorization: Bearer lgf_live_…
Content-Type: application/json
```

```json title="body.json"
{
  "service": "checkout",
  "environment": "production",
  "release": "1.4.2",
  "events": [
    {
      "timestamp": "2026-10-03T14:03:11.482Z",
      "level": "error",
      "message": "Payment provider timeout after 3 retries",
      "stack_trace": "Error: timeout\n    at charge (src/pay.ts:88:11)\n    at placeOrder (src/orders.ts:41:5)",
      "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
      "attributes": { "order_id": "ord_123", "provider": "acme-pay" }
    },
    {
      "timestamp": "2026-10-03T14:03:12.010Z",
      "level": "warn",
      "message": "Falling back to the secondary payment provider"
    }
  ]
}
```

## Fields

`service`, `environment` and `release` can be set for the whole batch or per event; a value on the event wins.

| Field | Type | Notes |
|---|---|---|
| `events` | array | Required, at least one event, at most 1,000 |
| `service` | string | Up to 128 characters. Required on the batch or on each event. |
| `environment` | string | Up to 64 characters, for example `production` |
| `release` | string | Up to 64 characters, for example a version or commit |
| `events[].message` | string | Required |
| `events[].level` | string | `debug`, `info`, `warn`, `error`, `fatal` and their usual synonyms (see [Level mapping](https://docs.dlogify.com/send-logs/limits.md#level-mapping)) |
| `events[].timestamp` | string | ISO 8601 date-time; defaults to the time dlogify received it |
| `events[].stack_trace` | string | The error's stack trace |
| `events[].trace_id`, `events[].span_id` | string | To correlate with your traces |
| `events[].attributes` | object | Any extra key-value data |

The full schema is in the [API reference](https://docs.dlogify.com/api/ingestion/ingestEvents.md).

## Response

```http
HTTP/1.1 202 Accepted
```

```json
{ "accepted": 2 }
```

`202` means the batch is safely queued, not yet processed. Error groups and tickets follow within seconds.

## Example with curl

```bash
curl https://api.dlogify.com/v1/ingest \
  -H "Authorization: Bearer $LOGIFY_API_KEY" \
  -H "Content-Type: application/json" \
  --data @body.json
```

Compressed with gzip, which helps on large batches:

```bash
gzip -c body.json | curl https://api.dlogify.com/v1/ingest \
  -H "Authorization: Bearer $LOGIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Content-Encoding: gzip" \
  --data-binary @-
```

## Errors

| Status | Type | What to do |
|---|---|---|
| `401` | [`unauthorized`](https://docs.dlogify.com/errors/unauthorized.md) | Check the API key |
| `400` | [`malformed-body`](https://docs.dlogify.com/errors/malformed-body.md) | The body is not valid JSON or gzip |
| `413` | [`payload-too-large`](https://docs.dlogify.com/errors/payload-too-large.md) | Send fewer events per request |
| `415` | [`unsupported-encoding`](https://docs.dlogify.com/errors/unsupported-encoding.md), [`unsupported-media-type`](https://docs.dlogify.com/errors/unsupported-media-type.md) | Use `application/json`, and gzip or no encoding |
| `422` | [`validation-failed`](https://docs.dlogify.com/errors/validation-failed.md) | Fix the field named in `detail` |
| `429` | [`rate-limited`](https://docs.dlogify.com/errors/rate-limited.md) | Wait for `Retry-After` and send again |
| `5xx` | [`internal`](https://docs.dlogify.com/errors/internal.md) | Retry with backoff |

Source: https://docs.dlogify.com/send-logs/rest
