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

# Data streams

> Learn what a data stream is in End Close, how its key and type work, and how streams feed records into reconciliations.

A data stream is one source of financial records in End Close, such as a bank account feed, a payment processor, or an internal ledger. Every [record](https://endclose.com/docs/concepts/records.md) belongs to exactly one data stream, and [reconciliations](https://endclose.com/docs/concepts/reconciliations.md) match records from the streams on one side against the streams on the other.

## How data streams fit together

* A stream holds [records](https://endclose.com/docs/concepts/records.md). You push records into an `api` stream, or End Close fills a connected stream for you.
* A [reconciliation](https://endclose.com/docs/concepts/reconciliations.md) puts one or more streams on Side A and one or more on Side B. The same stream can sit in several reconciliations.
* [Exceptions](https://endclose.com/docs/concepts/exceptions.md) are scoped to one stream in one reconciliation: the stream's unmatched lines that are past due.
* [Property definitions](#property-definitions) describe the custom fields a stream's records carry in `metadata`.

## Data stream fields

| Field | Description |
| - | - |
| `id` | End Close's identifier for the stream. Reconciliations reference streams by `id`. |
| `key` | A unique identifier you choose. The records and property definition endpoints reference streams by `key`. It can't be changed after creation. |
| `name` | A human-readable label. |
| `description` | Optional free text. |
| `type` | Where the stream's records come from. See [Stream types](#stream-types). |
| `records_count` | How many records the stream holds. |

```json Data stream theme={"dark"}
{
  "id": "0193a7c2-5e1f-7b2a-9c41-6d8e2f1a3b40",
  "key": "stripe_payments",
  "name": "Stripe Payments",
  "description": null,
  "type": "api",
  "program_id": null,
  "records_count": 18240
}
```

> [!NOTE]
>
> Choose a `key` that names the system the stream represents, such as `chase_operating` or `stripe_payouts`. You can rename the stream later, but not its key.

## Stream types

`POST /data_streams` creates two types:

| Type | What it is |
| - | - |
| `api` | The default. You send records with `POST /records` or `POST /records/bulk`. |
| `bank_feed` | A stream tied to a [bank account](https://endclose.com/docs/api-reference/overview.md). Pass `bank_account_id` when you create it. |

Other types are created when you connect a source in the app, for example `stripe`, `snowflake`, `big_query`, `databricks`, `postgres`, `csv`, `google_sheets`, `airwallex` and `hyperwallet`. See [How connections work](https://endclose.com/docs/integrations/how-connections-work.md) and the [integrations](https://endclose.com/docs/integrations.md) for each source.

End Close also writes one stream type itself. An `adjustments` stream holds the balancing records ("plugs") for a single reconciliation and belongs to that reconciliation alone. See [Adjustments](https://endclose.com/docs/concepts/reconciliations.md#adjustments).

## Create a data stream

```bash cURL theme={"dark"}
curl -X POST https://api.endclose.com/v1/data_streams \
  -H "X-API-Key: $ENDCLOSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "stripe_payments",
    "name": "Stripe Payments"
  }'
```

A duplicate `key` returns `422`.

## Reset and delete a stream

* `POST /data_streams/{key}/reset` removes every record on the stream and keeps its configuration, property definitions and reconciliation links. It runs in the background: poll the returned operation and wait for `completed` before you load data again.
* `DELETE /data_streams/{key}` deletes the stream. It returns `409` while any reconciliation still uses the stream. A stream with more than 10,000 records must be deleted asynchronously with `?async=true`.

`GET /data_streams/{key}/health` reports the stream's ingestion health.

## Property definitions

A property definition names and types a custom field that a stream's records carry, such as `customer_email` on a Stripe stream or `check_number` on a bank feed. Each definition belongs to one stream. The values themselves live in each record's `metadata`.

| Field | Description |
| - | - |
| `key` | The field's key inside `metadata`, unique within the stream. |
| `name` | A human-readable label. |
| `type` | `string`, `number`, `date`, `datetime` or `boolean`. |
| `optional` | Whether records may leave the field out. Through the API it defaults to `false`. |
| `data_stream_key` | The stream the definition belongs to. |

```json Property definition theme={"dark"}
{
  "key": "customer_email",
  "name": "Customer Email",
  "type": "string",
  "optional": true,
  "data_stream_key": "stripe_payments"
}
```

Once a field is defined, you can refer to it as `metadata.customer_email` in [matching rules](https://endclose.com/docs/concepts/rules-and-matches.md).

## Related

> [card] [Records](https://endclose.com/docs/concepts/records.md)
>
> The transactions inside a stream, and the fields each one carries.

> [card] [Reconciliations](https://endclose.com/docs/concepts/reconciliations.md)
>
> Put streams on two sides and match them.

> [card] [How connections work](https://endclose.com/docs/integrations/how-connections-work.md)
>
> How connected sources keep their streams up to date.

> [card] [API reference](https://endclose.com/docs/api-reference/overview.md)
>
> Data stream and property definition endpoints.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.