# Program Streams GetTopicSchema

> Fetch the protobuf schema and message type for an Program Stream topic.

Canonical: https://nolimitnodes.com/docs/api-reference/program-streams/get-topic-schema

`GetTopicSchema` returns the program-level proto used by one topic.

All topics from the same program share one schema document.

## Request

```protobuf
message GetTopicSchemaRequest {
  string topic = 1;
}
```

## Response

```protobuf
message GetTopicSchemaResponse {
  string proto_schema = 1;
  string message_type = 2;
}
```

`proto_schema` contains every instruction and event message for the program.

`message_type` identifies the payload message for your selected topic.

## grpcurl

```bash
grpcurl \
  -H "x-api-key: YOUR_API_KEY" \
  -import-path . \
  -proto program-streams.proto \
  -d '{"topic":"solana.pump_fun.trade_event"}' \
  events.nln.clr3.org:443 \
  nln.stream.v1.StreamService/GetTopicSchema
```

## Schema workflow

1. Call `ListTopics`.
2. Pick a topic.
3. Call `GetTopicSchema`.
4. Save the returned proto with a content hash.
5. Generate your payload decoder.
6. Record `message_type` beside the topic.
7. Regenerate after a schema hash change.

Do not compile a fetched schema inside your event loop.
