> For the complete documentation index, see [llms.txt](https://crypto-chief.gitbook.io/chief-event-stream/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://crypto-chief.gitbook.io/chief-event-stream/sinks/overview.md). Agents can also search and read this documentation through its [MCP server](https://crypto-chief.gitbook.io/chief-event-stream/~gitbook/mcp).

# Sink Types

## Sink Types

A sink is a delivery target. A [subscription](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/subscriptions.md) lists its sinks in `sink_ids`, and one sink can serve several subscriptions. There are ten sink kinds:

| Kind                                                                                   | What arrives                                                                                                                                                                                                                                            | Batching                                     | Channel fee                 | Deduplication key                                                      |
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | --------------------------- | ---------------------------------------------------------------------- |
| [`https`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md)   | Signed JSON [`Envelope`](https://crypto-chief.gitbook.io/chief-event-stream/webhooks/event-envelope.md) object (or array when batched); see [Verifying Signatures](https://crypto-chief.gitbook.io/chief-event-stream/webhooks/verifying-signatures.md) | Optional (`1`–`100` events, default `false`) | `0` credits (`$0`)          | `event_id` in JSON body                                                |
| [`telegram`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/telegram.md)     | Escaped plain-text message (up to `3,500` characters, counted as Unicode code points) via Bot API `sendMessage`                                                                                                                                         | No (`1` event)                               | `1,000` credits (`$0.0001`) | `event_id` line in message text                                        |
| [`slack`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/slack.md)           | Incoming Webhook JSON with `text` and `mrkdwn` section block (up to `3,000` characters)                                                                                                                                                                 | No (`1` event)                               | `1,000` credits (`$0.0001`) | `event_id` line in message text                                        |
| [`discord`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/discord.md)       | Webhook JSON with `content` (up to `1,900` characters) and `allowed_mentions.parse: []`                                                                                                                                                                 | No (`1` event)                               | `1,000` credits (`$0.0001`) | `event_id` line in message text                                        |
| [`pagerduty`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/pagerduty.md)   | Events API v2 `trigger` event with `summary` (up to `1,000` characters) and `custom_details`                                                                                                                                                            | No (`1` event)                               | `1,000` credits (`$0.0001`) | `dedup_key` (`event_id`, server-side)                                  |
| [`email`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/email.md)           | HTML email with one event, or a digest of a time window listing up to `10` events                                                                                                                                                                       | No (`1` event); optional digest              | `10,000` credits (`$0.001`) | Event ID column; one email per `delivery_id`                           |
| [`s3`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/s3.md)                 | SigV4-signed `PUT` object containing the raw event JSON                                                                                                                                                                                                 | No (`1` event)                               | `0` credits (`$0`)          | Object key `[<prefix>/]<project_id>/<subscription_id>/<event_id>.json` |
| [`postgres`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/postgres.md)     | Parameterized `INSERT` row (`event_id`, `subscription_id`, `sequence`, `received_at`, `event` (`jsonb`))                                                                                                                                                | No (`1` event)                               | `0` credits (`$0`)          | `event_id` (`ON CONFLICT (event_id) DO NOTHING`)                       |
| [`kafka`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/kafka.md)           | Kafka record with metadata headers and raw event JSON value, written with `acks=all` (brokers `1.0` or newer; `0.11` or newer when `sasl` is `"none"`)                                                                                                  | No (`1` event)                               | `0` credits (`$0`)          | `event_id` record header and JSON field                                |
| [`clickhouse`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/clickhouse.md) | Synchronous HTTP `INSERT ... FORMAT JSONEachRow` row (`async_insert=0`)                                                                                                                                                                                 | No (`1` event)                               | `0` credits (`$0`)          | `event_id` (`ReplacingMergeTree(received_at) ORDER BY (event_id)`)     |

An acknowledged message to a `telegram`, `slack`, `discord` or `pagerduty` sink costs `1,000` credits (`$0.0001`), and an email `10,000` credits (`$0.001`). This channel fee is charged on top of the base event fee. It also applies to `reorged` corrections and to [`deliveries/resend`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/deliveries.md#resend-a-delivery). The monthly free allowance does not cover it.

### Creating and managing sinks

Manage all sink kinds through the endpoints documented in [Sinks](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md) (`sinks/create`, `sinks/update`, `sinks/get`, `sinks/list`, `sinks/pause`, `sinks/resume`, `sinks/delete`, and `sinks/test`).

* **Request body (`sinks/create`):** pass `"kind"`, `"config"`, and `"credentials"`. `kind` cannot be changed with `sinks/update`. Unknown properties at any level return `400` `UNKNOWN_FIELD`.
* **Common `config` fields:** all nine non-`https` kinds accept optional `label` (`string`, up to `100` characters), `rate_per_second` (`integer`, `1`–`20`; default `20` events per second; see [Delivery rate and concurrency limits](https://crypto-chief.gitbook.io/chief-event-stream/webhooks/retries-and-ordering.md#delivery-rate-and-concurrency-limits)), and `enabled` (`boolean`, default `true`; `false` holds unsent deliveries in `"queued"` while `status` stays `"active"`, see [`config.enabled`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md#create-a-sink)). For these kinds, `sinks/create` stores `config` without adding default fields and returns `"status": "active"`, `"secret": null`, and `"secret_version": 0`.
* **Write-only `credentials`:** `credentials` is required on `sinks/create` for every non-`https` kind except `email` (which has none) and `kafka` when `config.sasl` is `"none"`. No endpoint returns credential values.
* **Redacted metadata on `sinks/get` and `sinks/list`:** responses return `"secret_version": 0` and a `credentials_meta` object containing `{"configured": <bool>, "secret_id": "<uuidv7>|null", "key_id": "<string>|null", "last4": "<string>|null"}` for each credential field defined by that `kind` (`{}` for `email`). Configured fields report `"configured": true`; `secret_id` and `key_id` are opaque identifiers. `last4` holds the last `4` Unicode characters (the whole value if it has `4` characters or fewer) only for `access_key_id` (`s3`) and `username` (`postgres`, `kafka`, `clickhouse`); for every other credential field (`bot_token`, `webhook_url`, `routing_key`, `secret_access_key`, `session_token`, `password`, `client_certificate`, `client_key`, `ca_certificate`), `last4` is `null`. Unconfigured optional fields return `{"configured": false, "secret_id": null, "key_id": null, "last4": null}`.
* **Updating and rotating credentials:** omit `credentials` in `sinks/update` to keep the stored secrets for `config_version + 1`. Pass a full `credentials` object for the kind to store a new encrypted version. `sinks/rotate-secret` is supported only for `https` sinks and returns `422` `VALIDATION_ERROR` (`"sink has no signing secret"`) on all other kinds.
* **Admission vs. delivery validation:** `sinks/create` and `sinks/update` validate the request schema (`422` `VALIDATION_ERROR`, including a URL that does not start with `https://`). `sinks/create`, `sinks/update` and `sinks/resume` check the destination rules for host name, port, provider host and path, and IP literals (`422` `DESTINATION_FORBIDDEN`; `details.field` names the rejected field). DNS resolution, TLS handshakes, authentication, and target table or topic checks run at delivery time and during `sinks/test`.

### Sink limits

A project can hold up to `10` non-deleted sinks across all kinds; creating an 11th sink returns `429` `PROJECT_LIMIT_EXCEEDED`. A subscription's `sink_ids` holds `0`–`10` unique sink IDs; an unknown or deleted `sink_id` returns `404` `RESOURCE_NOT_FOUND`. See [Limits](https://crypto-chief.gitbook.io/chief-event-stream/getting-started/limits.md).

### Testing a sink

Call [`sinks/test`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md) with an `Idempotency-Key` header and `{"sink_id": "<uuidv7>", "sample_type": "system.test"}` to queue a synthetic [`system.test`](https://crypto-chief.gitbook.io/pages/X84VQ5lQlasjJZqaqw9H#system.test) event (`202`, `"is_test": true`, `"billable": false`, `0` credits).

Test deliveries run on paused sinks, never pause a sink, and are kept `7` days; [`deliveries/info`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/deliveries.md#get-delivery-info) returns their `status` and `attempts[]` with the [attempt fields](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/deliveries.md#attempt-fields). See [Test delivery behavior](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md#test-delivery-behavior).

### Notification policy (`delivery_policy.notifications`)

Subscriptions define `delivery_policy.notifications` (`{"mode": "immediate", "interval_minutes": null}` by default; see [Subscriptions](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/subscriptions.md)).

* **Notification sinks (`telegram`, `slack`, `discord`, `pagerduty`, `email`):**
  * `"immediate"` (`interval_minutes` must be `null`): every matched event creates an individual notification delivery.
  * `"throttle"`: `interval_minutes` is an integer `1`–`1440`. The first ordinary event for the subscription and sink is sent immediately and opens a window of `interval_minutes` from that moment; further ordinary events inside the window are suppressed (`0` credits, no delivery created). The first event after the window ends is sent and opens the next window. A new subscription revision (`subscriptions/update`) starts a new window. Events with `stage: "reorged"` always bypass `"throttle"` and are delivered immediately.
  * `"digest"`: available only on `email`; see [Email](https://crypto-chief.gitbook.io/chief-event-stream/sinks/email.md#notification-policy). Calling `subscriptions/create`, `subscriptions/update`, or `subscriptions/resume` with `delivery_policy.mode: "deliver"` and `notifications.mode: "digest"` when `sink_ids` includes a `telegram`, `slack`, `discord`, or `pagerduty` sink returns `422` `UNSUPPORTED_CAPABILITY`.
  * Telegram, Slack, Discord, and PagerDuty limit how many messages one chat, channel, webhook, or integration key accepts per minute. Their `429` responses are retried with `Retry-After`, count as failed attempts, and a sustained excess can pause the sink with `"failures"`. Use `"throttle"` for subscriptions that match many events.
* **Data and webhook sinks (`https`, `s3`, `postgres`, `kafka`, `clickhouse`):** ignore `delivery_policy.notifications` and receive every matched event immediately, including when attached to the same subscription as a throttled notification sink.

### Message layout

Telegram, Slack and Discord messages have these lines in this order. A line without a value is left out.

1. Header `[CryptoChief EventStream] <type> (<stage>)`
2. `event_id`
3. `network`
4. `subscription_id`
5. `replay_run_id`: only on a resend of an already delivered event, the `job_id` of [`deliveries/resend`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/deliveries.md#resend-a-delivery) or [`deliveries/resend-bulk`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/deliveries.md#resend-deliveries-in-bulk)
6. `sequence`
7. `occurred_at`
8. `tx_hash`
9. `transfer`: `<from> -> <to>`
10. `amount`: the decimal amount when `decimals` or `scale` is known, otherwise `<raw> base units (decimals unknown)`, then the asset symbol or identifier
11. `message`
12. `data`: `key=value` pairs sorted by key, from `transformed_payload` when the subscription has a transform, otherwise from `payload`
13. `journal`

With a transform, `transfer`, `amount` and the asset come from the transform output when it has those keys.

### Ordering, retries, and auto-pause

All sink kinds follow the rules in [Retries and Ordering](https://crypto-chief.gitbook.io/chief-event-stream/webhooks/retries-and-ordering.md) and [Sink statuses and auto-pause](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md#sink-statuses-and-auto-pause): a FIFO queue per lane, up to `12` attempts within `24` hours (`5` s to `6` h base delays with `[0.8, 1.2)` jitter), expiry of deliveries still undelivered `30` days after the event, `30` days of delivery history, and auto-pause on aggregate failures.

* A `(subscription_id, sink_id)` lane has at most `1` unacknowledged delivery in flight and sends in ascending `sequence` order.
* Lanes of one sink run independently, with at most `2` requests in flight per sink (`1` after a timeout).
* All `telegram`, `slack`, `discord`, `pagerduty`, and `email` sinks of a project share one in-flight request. A slow notification provider delays messages to the project's other notification sinks.

Non-`https` sinks differ from `https` webhooks:

* **Single-event deliveries, no HMAC headers:** every attempt carries `1` event (`secret: null`, `secret_version: 0`).
* **Attempt deadlines:** each attempt times out after `10` seconds; TCP sinks (`postgres` and `kafka`) additionally apply an `8`-second socket deadline.
* **No HTTP redirects:** HTTP `300`–`399` responses are never followed and fail permanently (`pause_reason: "destination_rejected"`).
* **Application errors inside `2xx` responses:** `telegram`, `slack`, `discord`, `pagerduty`, and `clickhouse` also check the body and headers of a `2xx` response (`pagerduty` requires `202`, `clickhouse` requires `200`). A provider error inside it, or a truncated response, fails the attempt as permanent or transient; each sink page lists which.
* **`Retry-After` in JSON bodies:** on HTTP `429` and `503` responses, the delay comes from the HTTP `Retry-After` header. When the header is missing, `telegram` reads `parameters.retry_after` and `discord` reads `retry_after` (rounded up to whole seconds) from the JSON response body. The delay is clamped to `[1s, 21600s]`.
* **Lane pause vs. whole-sink pause:** non-`https` kinds follow [Sink statuses and auto-pause](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md#sink-statuses-and-auto-pause); each sink page lists its permanent errors and the pause reason each one sets. Permanent `postgres` and `kafka` errors always pause the entire sink.
* **Resuming after a pause:** read the pause event in [`notifications/list`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/notifications.md). Fix the cause, or change `config` / `credentials` with [`sinks/update`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md#update-a-sink): the next attempt of every subscription of the sink, including the delivery that caused the pause, uses the new version ([Versioning and wire profile rules](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md#versioning-and-wire-profile-rules)). Then call [`sinks/resume`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md#resume-a-sink) with `mode: "drain"` (or `mode: "skip"` and `acknowledged_gap: true`), also after a lane-only pause.

### Network access

`telegram`, `slack`, `discord` and `pagerduty` sinks connect to fixed provider endpoints over HTTPS on port `443` (`api.telegram.org`, `hooks.slack.com`, `discord.com`, `events.pagerduty.com`). These sinks and `email` sinks need no inbound firewall rules on your side.

A sink on your infrastructure or behind network ACLs must accept inbound TLS connections on an allowed port:

| Kind                                                                                   | Allowed ports  | Target requirements                                                                                                                                         |
| -------------------------------------------------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`https`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/sinks.md)   | `443`, `8443`  | Publicly routable domain or IP with a valid TLS certificate (HTTPS).                                                                                        |
| [`s3`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/s3.md)                 | `443`, `8443`  | Publicly routable HTTPS endpoint (and `<bucket>.<host>` when `path_style` is `false`).                                                                      |
| [`postgres`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/postgres.md)     | `5432`, `6432` | Publicly routable host accepting PostgreSQL SSL negotiation (`verify-full`).                                                                                |
| [`kafka`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/kafka.md)           | `9093`         | Every `bootstrap_servers` entry **and** every broker returned in cluster `Metadata` (`advertised.listeners`) must be publicly routable on `:9093` over TLS. |
| [`clickhouse`](https://crypto-chief.gitbook.io/chief-event-stream/sinks/clickhouse.md) | `443`, `8443`  | Publicly routable ClickHouse HTTPS interface.                                                                                                               |

Single-label hostnames, `.localhost`, `.local`, `.internal`, `.localdomain`, `.home.arpa`, Crypto Chief's own hosts, and private, loopback, link-local, or reserved IP addresses are rejected (`422` `DESTINATION_FORBIDDEN` at admission, or `security_blocked` if a domain resolves to a non-public IP at delivery time). Every `A` and `AAAA` record returned by DNS for a target hostname must be a public IP address.

Deliveries to every sink kind except `email` come from these IPv4 addresses; [`capabilities`](https://crypto-chief.gitbook.io/chief-event-stream/api-reference/capabilities.md) returns the same list in `egress_ips`. Allow both on your firewall for the sink's port:

| Address           |
| ----------------- |
| `165.245.240.187` |
| `64.226.74.144`   |
