# Ingest a JSON batch

`POST /v1/ingest`

## Authentication

A project API key: `Authorization: Bearer <API key>`.

## Request body

`application/json`

```json
{
  "properties": {
    "environment": {
      "maxLength": 64,
      "minLength": 1,
      "type": "string"
    },
    "events": {
      "items": {
        "properties": {
          "attributes": {
            "additionalProperties": {},
            "type": "object"
          },
          "environment": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "level": {
            "maxLength": 32,
            "type": "string"
          },
          "message": {
            "minLength": 1,
            "type": "string"
          },
          "release": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "service": {
            "maxLength": 128,
            "minLength": 1,
            "type": "string"
          },
          "span_id": {
            "maxLength": 32,
            "type": "string"
          },
          "stack_trace": {
            "type": "string"
          },
          "timestamp": {
            "format": "date-time",
            "type": "string"
          },
          "trace_id": {
            "maxLength": 64,
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "type": "object"
      },
      "minItems": 1,
      "type": "array"
    },
    "release": {
      "maxLength": 64,
      "minLength": 1,
      "type": "string"
    },
    "service": {
      "maxLength": 128,
      "minLength": 1,
      "type": "string"
    }
  },
  "required": [
    "events"
  ],
  "type": "object"
}
```

## Responses

### 202

The batch was accepted.

`application/json`

```json
{
  "additionalProperties": false,
  "description": "The batch was accepted.",
  "properties": {
    "accepted": {
      "description": "Events accepted for processing.",
      "type": "integer"
    }
  },
  "required": [
    "accepted"
  ],
  "type": "object"
}
```

### 400

malformed-body: the body is not valid JSON or gzip.

Problem type: [malformed-body](https://docs.dlogify.com/errors/malformed-body.md).

### 401

unauthorized: missing, invalid or revoked API key.

Problem type: [unauthorized](https://docs.dlogify.com/errors/unauthorized.md).

### 413

payload-too-large: the body or the batch exceeds the plan's limit.

Problem type: [payload-too-large](https://docs.dlogify.com/errors/payload-too-large.md).

### 415

unsupported-media-type or unsupported-encoding.

A problem document: see [Errors](https://docs.dlogify.com/errors.md).

### 422

validation-failed: the request does not match the schema.

Problem type: [validation-failed](https://docs.dlogify.com/errors/validation-failed.md).

### 429

rate-limited: event quota, concurrent requests or backpressure.

Problem type: [rate-limited](https://docs.dlogify.com/errors/rate-limited.md).

## Example

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

Source: https://docs.dlogify.com/api/ingestion/ingestEvents
