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

# Register an application

> Register a consumer or producer via the REST API and get a ready-to-use Kafka client config.

Registration is a single REST call. It records your app and returns a **ready-to-use Kafka client config** for your language.

## Getting a token

Every call on this page authenticates with a platform API key (`Authorization: Bearer sariva_…`). **In this release, app teams do not have keys of their own.** Registration requires the `app:register` permission, and the only key role that carries it today is `platform_admin` — a team-scoped `developer` role (register your own apps, see only your own apps' health and alerts) exists in the platform's RBAC, but keys for it cannot be minted yet.

The practical path today: **ask your platform operator to run the registration for you**, or to make these calls with you. Operator keys are platform-wide admin credentials, not team credentials — which is exactly why per-team `developer` keys are the designed next step. This page will switch to per-team keys when developer-role minting lands.

## Register

Your app's alerts go to your team's channel in the **one chat surface your install uses** — Microsoft Teams or Slack (ask your operator if you're unsure). Use the tab that matches it; the only difference is the destination field.

> [tab] Microsoft Teams
>
> ```bash theme={null}
> curl -X POST https://<platform-url>/api/v1/apps/register \
>   -H "Authorization: Bearer <your-token>" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "alias": "payments-consumer",
>     "display_name": "Payments Consumer",
>     "team": "payments-eng",
>     "teams_channel_id": "19:a1b2c3d4e5f6@thread.tacv2",
>     "app_type": "consumer",
>     "language": "java_spring_boot",
>     "cluster_alias": "prod-cc-1",
>     "consumer_group_id": "payments-consumer-grp",
>     "topics_subscribed": ["payments.events"]
>   }'
> ```
>
> `teams_channel_id` is your channel's id — see [Find your Teams channel id](#find-your-teams-channel-id) below.

> [tab] Slack
>
> ```bash theme={null}
> curl -X POST https://<platform-url>/api/v1/apps/register \
>   -H "Authorization: Bearer <your-token>" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "alias": "payments-consumer",
>     "display_name": "Payments Consumer",
>     "team": "payments-eng",
>     "slack_channel": "#payments-eng",
>     "app_type": "consumer",
>     "language": "java_spring_boot",
>     "cluster_alias": "prod-cc-1",
>     "consumer_group_id": "payments-consumer-grp",
>     "topics_subscribed": ["payments.events"]
>   }'
> ```

A producer is the same call with the direction reversed — swap the consumer fields for these, keeping your destination field:

```json theme={null}
"alias": "payments-producer",
"display_name": "Payments Producer",
"app_type": "producer",
"producer_client_id": "payments-producer-client",
"topics_produced_to": ["payments.events"]
```

### Find your Teams channel id

1. In Microsoft Teams, open the channel's **⋯** menu → **Get link to channel**, and copy the link. It looks like
   `https://teams.microsoft.com/l/channel/19%3Aa1b2c3d4e5f6%40thread.tacv2/payments-eng?groupId=…&tenantId=…`
2. Take the segment between `/channel/` and the next `/` — `19%3Aa1b2c3d4e5f6%40thread.tacv2`.
3. URL-decode it: `%3A` → `:` and `%40` → `@`. The result, `19:a1b2c3d4e5f6@thread.tacv2`, is the `teams_channel_id`.

The `groupId` GUID in the same link is the **team**, not the channel — it is rejected. So is the still-encoded form: registration checks the shape (`19:` … `@thread.` …) and answers `400` with these steps. The Sariva bot must also be installed in that team, or posts fail at alert time — ask your operator to add it ([Install the app in Teams → Per-app alerts](https://sariva.mintlify.site/prerequisites/teams/install-app.md#per-app-alerts)).

A `201` returns the stored record plus the generated config:

```json theme={null}
{
  "app": { "alias": "payments-consumer", "app_type": "consumer", "...": "..." },
  "config": {
    "filename": "application.properties",
    "format": "java_spring_boot_consumer",
    "content": "spring.kafka.consumer.group-instance-id=payments-consumer-${HOSTNAME}\n..."
  }
}
```

## The fields

| Field | Required | Notes |
| - | - | - |
| `alias` | yes | The app's unique identifier (used in URLs and in chat questions) |
| `display_name`, `team` | yes | |
| `teams_channel_id` | yes, on a Microsoft Teams install | The channel id for this app's alerts — `19:...@thread.tacv2`, see [Find your Teams channel id](#find-your-teams-channel-id). The Sariva bot must be installed in that channel's team |
| `slack_channel` | yes, on a Slack install | The Slack channel for this app's alerts (`#payments-eng`) |
| `chat_alerts` | optional (default `true`) | `false` registers the app with **no chat alerts** on any surface — then no channel is needed. Paging, if your install has it, is unaffected. Flip it with `PUT` to mute or unmute; a channel you set is kept |
| `app_type` | yes | `consumer`, `producer`, or `both` |
| `language` | yes | `java_vanilla`, `java_spring_boot`, or `python` (other languages rejected with `400` in this release) |
| `cluster_alias` | yes | The Sariva cluster alias this app runs against (ask your operator) |
| `consumer_group_id` | if `consumer`/`both` | |
| `producer_client_id` | if `producer`/`both` | |
| `topics_subscribed` | if `consumer`/`both` | non-empty list |
| `topics_produced_to` | if `producer`/`both` | non-empty list |
| `log_locator`, `alert_on_error_pattern` | optional | needed for error-pattern alerting: **where** the app's logs are, as field/value pairs for the install's log source (`{"log_group": "/aws/eks/prod/payments"}` on CloudWatch; the attributes that select your lines, e.g. `{"container_name": "payments-consumer"}`, on New Relic) plus the patterns. With no patterns, chat reads search the common error words (`ERROR`, `Exception`, `FATAL`, `Traceback`, any case), and read a JSON line with a `level` field by its level (`error`, `fatal`, `critical`). Patterns alone never start scheduled monitoring — see `monitor_errors`. On-demand chat reads need their own approval, requested the first time someone asks about the app's logs (`chat_scan_state`). The legacy `cloudwatch_log_group` is accepted for one more release — see [App logs & pod health](https://sariva.mintlify.site/app-teams/logs-and-pod-health.md) |
| `log_fields` | optional, New Relic | the log attributes Sariva searches for your patterns on New Relic, e.g. `["message", "event", "error"]`. New Relic stores a JSON log line as attributes with **no `message`**, so a JSON-logging app must list the fields its errors are in — `{"level": "error", "event": "DeserializationError: …", "error": "Expecting value: …"}` needs `event` and/or `error`; keep `message` for plain-text lines (librdkafka). A pattern matches in any listed field. Unset = `["message"]`. Plain attribute names, up to 8. After an SRE approval, and on a `PUT` that changes it, Sariva checks the fields against the app's recent lines and posts a fix if none are found — see [JSON logs](https://sariva.mintlify.site/prerequisites/log-sources/newrelic.md#json-logs--tell-sariva-which-fields-to-search). Ignored on CloudWatch |
| `expect_messages_within` | optional, producers | how often the producer should send, as a duration (`15m`, `2h`, `1d`; 1 minute to 7 days). A producer that runs with no errors but sent nothing over this long is a **warning**; unset, a quiet producer stays **healthy, idle** (no events can be normal). See [Producer health](https://sariva.mintlify.site/app-teams/health-and-alerts.md#producer-health) |
| `monitor_errors` | optional (default `false`) | `true` **asks for scheduled error monitoring** — with a log location set, it posts **one** request to your platform team; nothing is scanned on a schedule until an SRE approves it (`monitor_state`: `requested` → `approved` / `denied`). `false` (or a later `PUT` with `false`) withdraws a waiting request or turns monitoring off. You can also ask in chat (*"alert me when payments-consumer logs errors"*). See [App logs & pod health](https://sariva.mintlify.site/app-teams/logs-and-pod-health.md#approval--your-platform-team-switches-scanning-on) |
| `k8s_namespace`, `k8s_pod_label_selector`, `eks_cluster_name` | optional | needed to locate the app's pods — powers on-demand **pod-health & CPU/mem headroom** questions *and* pod-restart alerting — see [App logs & pod health](https://sariva.mintlify.site/app-teams/logs-and-pod-health.md) |
| `aws_account_id`, `aws_region`, `cross_account_reader_role_arn` | optional | set only when this app runs in a **different AWS account** than the Sariva platform — see [Cross-account reader setup](https://sariva.mintlify.site/install-setup/cross-account-reader.md) |
| `runbook_url` | optional | **your** runbook URL for this app (`http://` or `https://`, no whitespace, up to 1000 characters). It is the only runbook a **page** (PagerDuty / xMatters) ever carries; leave it unset and the page carries none. Chat alerts never show a runbook URL — see [Alerting](https://sariva.mintlify.site/concepts/alerting.md). Change or clear it later with `PUT` |

Registration asks for the destination field of your install's chat surface (or `"chat_alerts": false`); leave both out and the `400` names that field. A `PUT` that would clear the last destination is rejected too. (An install whose operator added a second surface by hand accepts either field; an app that sets the two gets every alert in each.)

> [!NOTE]
>
> **`both`** means "monitor both surfaces" — declare a `consumer_group_id` *and* a `producer_client_id`, with non-empty `topics_subscribed` *and* `topics_produced_to`. A consumer that also writes to a DLQ topic is `both`. (KStreams/Flink stream-processor apps aren't registered here — that's a separate surface in a later release.)

## The config you get back

The `config.content` is a complete client properties file — `application.properties` for Java, a Python snippet for `python`. It carries the connection settings, serializers, and the identity values that make Sariva's lag tracking work. See [Your Kafka client config](https://sariva.mintlify.site/app-teams/register.md#what-to-do-with-the-config) below.

### What to do with the config

1. Drop it into your app (e.g. `src/main/resources/application.properties`).
2. **Provide the credentials at runtime** — the config references `${KAFKA_API_KEY}` / `${KAFKA_API_SECRET}` (and `${HOSTNAME}` for the per-pod consumer identity). Inject these from your own secret store / env; Sariva doesn't put secrets in the file.
3. Re-download any time:

   ```bash theme={null}
   curl https://<platform-url>/api/v1/apps/payments-consumer/config \
     -H "Authorization: Bearer <your-token>"
   ```

> [!NOTE]
>
> **Why the identity fields matter.** Consumer configs set `group.instance.id` to `<alias>-${HOSTNAME}` so each pod is a stable group member — that's what lets Sariva attribute lag per pod. Producer configs default to `acks=all` + `enable.idempotence=true` (no duplicates on retry). Don't strip these.

## Manage your apps

```text theme={null}
GET    /api/v1/apps/                  list your team's apps
GET    /api/v1/apps/{alias}           detail + current health summary
PUT    /api/v1/apps/{alias}           update alert preferences
DELETE /api/v1/apps/{alias}           de-register
GET    /api/v1/apps/{alias}/config    re-download the client config
GET    /api/v1/apps/{alias}/health    pod status + alerts (never reads logs)
```


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