# `Teac.Api.EventSub.Subscriptions`
[🔗](https://codeberg.org/FullStacking/teac)

# `delete`

```elixir
@spec delete(
  Teac.Client.t(),
  keyword()
) :: {:ok, nil, Teac.RateLimit.t()} | {:error, Teac.Error.t()}
```

Deletes an EventSub subscription.

## Authorization
Requires an app access token or user access token.

## Options
* `:id` - required. The ID of the subscription to delete.

# `get`

```elixir
@spec get(
  Teac.Client.t(),
  keyword()
) ::
  {:ok, [map()], String.t() | nil, Teac.RateLimit.t()}
  | {:error, Teac.Error.t()}
```

Gets a list of EventSub subscriptions.

## Authorization
Requires an app access token or user access token.

## Options
* `:type` - optional. Filter by subscription type (e.g., `"channel.follow"`).
* `:status` - optional. Filter by status (e.g., `"enabled"`, `"notification_failures_exceeded"`).
* `:subscription_id` - optional. Filter to a specific subscription by ID.
* `:conduit_id` - optional. Filter subscriptions belonging to a specific conduit.
* `:after` - optional. Cursor for forward pagination.

## Subscription cost budget

The response body includes two top-level fields that are not part of the
`"data"` list — they are present in the raw `Req.Response` but not surfaced
by the `{:ok, data, cursor}` return value:

* `"total_cost"` — points currently consumed across all active subscriptions.
* `"max_total_cost"` — your app's total budget (default: 10,000 points).

This is an internal Twitch quota system (**not a billing charge**). Most
subscription types cost 1 point; a few cost more (see the Twitch EventSub
documentation for per-type costs). A `post/2` that would exceed the budget
returns a 422 response.

If you need to monitor your usage, call `get/2` and inspect those fields
via the raw response rather than the parsed return value.

# `post`

```elixir
@spec post(
  Teac.Client.t(),
  keyword()
) :: {:ok, [map()], Teac.RateLimit.t()} | {:error, Teac.Error.t()}
```

Creates an EventSub subscription.

## Authorization
Requires an app access token or user access token depending on the subscription type.

## Options
* `:payload` - required. A map containing the subscription payload with `type`, `version`, `condition`, and `transport` keys.

# `stream`

```elixir
@spec stream(
  Teac.Client.t(),
  keyword()
) :: Enumerable.t()
```

Streams all EventSub subscriptions, automatically following pagination cursors.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
