Retrieve a batch
One batch of the drain, with every HTTP attempt.
bearerAuthAuthorizationBearer <token>A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.
id*stringThe log drain's id.
batch_id*stringThe batch's id.
Coss-Version?"2026-10-10"The API version (a date) to use for this request. Defaults to your organization's version, pinned to the latest one when it first used the API and upgraded from the dashboard. The SDK always sends the version it was built for.
"2026-10-10"The batch.
application/json- response
object*"log_drain_batch""log_drain_batch"id*stringThe batch's id: the webhook-id header, the same on every attempt.
drain_id*stringstatus*LogDrainBatchStatuspending: waiting for its next attempt. succeeded: the drain answered with a 2xx status. failed: every attempt failed, or the drain was disabled.
"pending""succeeded""failed"line_count*integerLines in the batch (one per NDJSON line).
byte_size*integerSize of the request body in bytes.
attempt_count*integernext_attempt_at*|When the next attempt is due; null once the batch is finished.
date-timelast_status_code*integer|nulllast_error*string|nullattempts*array<>Every HTTP attempt of this batch, oldest first.
created_at*stringdate-timeupdated_at*stringdate-timeimport { Coss } from "coss";const coss = new Coss({ apiKey: process.env.COSS_API_KEY, baseUrl: "https://api.coss.com",});const { data, error } = await coss.logDrains.batches.get("drain_01k7c8m4q2f3e9v6t5r1n0p8yz", "drainbat_01k7c8n2b5d7f9h1k3m5p7r9tv");{ "object": "log_drain_batch", "id": "drainbat_01k7c8n2b5d7f9h1k3m5p7r9tv", "drain_id": "drain_01k7c8m4q2f3e9v6t5r1n0p8yz", "status": "succeeded", "line_count": 42, "byte_size": 31870, "attempt_count": 1, "next_attempt_at": null, "last_status_code": 200, "last_error": null, "attempts": [ { "object": "log_drain_attempt", "id": "drainatt_01k7c8n2c9e1g3j5l7n9q1s3uw", "attempted_at": "2026-01-15T09:30:01.000Z", "status_code": 200, "duration_ms": 182, "error": null, "response_excerpt": "ok" } ], "created_at": "2026-01-15T09:30:00.000Z", "updated_at": "2026-01-15T09:30:01.000Z"}