# Subscribe to Metadata Changes

`GET /metadata/subscribe` · Core · Data, Queries & Vectors

List subscribe. (Data, Queries & Vectors) GET `/@:projectSlug/metadata/subscribe`.

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Responses

- **200**: A `text/event-stream` of the collection's row events (the project realtime feed for topic `collections.<name>.*`, filtered by the caller's row-level security at delivery). The stream opens with `retry: <ms>` and a `:ok` comment, then sends: - one event per row change: `id: <eventId>`, `event: row_inserted | row_updated | row_deleted`, and `data:` a JSON object `{ topic, eventType, payload: { collection, id }, occurredAt, eventId }`. The payload names the record; read it with GET /data/{collection} to see its metadata; - `event: resync` with `data: { reason: "cursor-unknown" | "cursor-evicted", head?, action: "reread-source" }` when the resume cursor can't be placed: re-read current state, then keep listening; - `:dropped <n>` when a slow reader missed events, and `:hb` heartbeats on a quiet feed. Resume with the `Last-Event-ID` header (or `fromSequence`) set to the last `id` seen. The server closes the stream after its maximum lifetime or when the token expires; reconnect to continue.

## Errors

| HTTP | Code | When |
|---|---|---|
| 401 | `K9O_INVALID_CREDENTIALS` | The caller is not authenticated. |
| 403 | `K9O_ACCESS_DENIED` | The caller has no read access to the collection (the record read's own gate). |
| 403 | `K9O_EXTENSION_PERMISSION_DENIED` | An extension token: the Metadata API is not extension-callable yet. |
| 400 | `K9O_INVALID_FIELD_VALUE` | surface is not a collection surface. |
| 400 | `K9O_UNKNOWN_SURFACE` | A surface is not collection:<name>, storage:<bucket> or telemetry:<eventType>. |

## Code samples

### cURL

```bash
curl -X GET 'https://<org>.api-<region>.k9o.io/@storefront/metadata/subscribe' \
  -H 'Authorization: Bearer $K9O_TOKEN'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/metadata/subscribe', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`
  },
});
const { data, meta } = await res.json();
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.metadata.subscribe()
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.metadata.subscribe()
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Metadata.Subscribe(ctx)
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.metadata.subscribe().await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.metadata().subscribe()
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Metadata.SubscribeAsync()
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.metadata.subscribe()
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->metadata->subscribe()
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/core/subscribe-to-metadata-changes
