> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withsplendor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream logs

> Send structured log records to a source for continuous ingestion.

When you have a stream of log records rather than a file, post them directly to a source. Splendor accepts a batch and processes it asynchronously.

## Prerequisites

* A source to ingest into (see [Connect a source](/guides/connect-a-source) for creating one).
* An [ingest token](/guides/connect-a-source) for that source.

## Send a batch

`POST /v1/ingest/sources/{source_key}/logs` accepts a batch of records and returns `202 Accepted`. The records are queued and become searchable once indexed.

Authenticate with the source's **ingest token** as a bearer credential — the token already names the source and tenant, so no `X-Splendor-Tenant-Id` header is needed. Send the batch as a top-level **JSON array** (`Content-Type: application/json`), or as **newline-delimited JSON**, one object per line (`Content-Type: application/x-ndjson`). Gzip is allowed.

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.withsplendor.com/v1/ingest/sources/app-logs/logs \
    -H "Authorization: Bearer $SPLENDOR_INGEST_TOKEN" \
    -H "Content-Type: application/json" \
    -d '[
      {"level": "error", "message": "connection timeout after 30s", "service": "checkout"},
      {"level": "info", "message": "request completed", "service": "checkout"}
    ]'
  ```

  ```python Python theme={null}
  client.post(
      "/v1/ingest/sources/app-logs/logs",
      headers={"Authorization": f"Bearer {ingest_token}", "Content-Type": "application/json"},
      json=[
          {"level": "error", "message": "connection timeout after 30s", "service": "checkout"},
          {"level": "info", "message": "request completed", "service": "checkout"},
      ],
  )
  ```
</CodeGroup>

The response includes how many records were `received` and a `fragment_id` for the batch.

<Note>
  A `202` means the batch was accepted, not that it is searchable yet. Track progress with [ingest runs](/concepts/datasets#tracking-ingestion) or dataset [readiness](/concepts/datasets#readiness).
</Note>

## Related

<Columns cols={2}>
  <Card title="Ingest a dataset" icon="upload" href="/guides/ingest-a-dataset">
    Upload a file through a hosted source.
  </Card>

  <Card title="Run a search" icon="magnifying-glass" href="/quickstart">
    Query the logs once they are indexed.
  </Card>
</Columns>
