Option E — SDK and direct API access
Option E — SDK and direct API access
For developers building custom apps, LLM pipelines, or anything that needs full typed control over pod data.
What it is
Two access surfaces, same underlying API:
@synap/sdk— typed tRPC client generated from the liveAppRouter. Full autocomplete, runtime validation, and tree-shaking. Use this for TypeScript/JavaScript projects.- Hub Protocol REST — the same access surface the pod's own AI uses internally. Raw HTTP, language-agnostic, no client library required.
Both give you direct read/write access to entities, documents, views, channels, search, and more. You manage the context you pass to your own LLM — the pod is your structured data backend.
Install
Pattern E1 — Read data, inject into your own LLM
Pull structured data from your pod, build a prompt, write results back.
Other useful reads
Pattern E2 — Hub Protocol REST
Hub Protocol REST is a language-agnostic HTTP API. Same capabilities as the SDK, no client library needed. Useful for Python pipelines, shell scripts, or any language without a Synap SDK.
Response:
Response:
The AI response will be delivered as a message in that channel. Poll GET /api/hub-protocol/channels/:id/messages or subscribe via webhook to receive it.
Hub Protocol scopes
| Scope | What it allows |
|---|---|
hub-protocol.read | Search, entity reads, document reads, memory reads |
hub-protocol.write | Create/update entities, send messages, trigger AI |
Pattern E3 — Compose C + D in one script
Call a skill to extract structured data, then chat with the result:
Required scopes per pattern
| Pattern | Required scopes |
|---|---|
| E1 — SDK reads | read:entities, hub-protocol.read |
| E1 — SDK writes | read:entities, write:entities |
| E2 — Hub Protocol reads | hub-protocol.read |
| E2 — Hub Protocol writes | hub-protocol.read, hub-protocol.write |
| E3 — Compose C + D | skills.invoke, chat.stream |
| Full external access | read:entities, write:entities, skills.invoke, chat.stream, hub-protocol.read, hub-protocol.write |
Type safety
The SDK exports input and output types for every procedure:
React integration
The useSynap() hook returns the full typed tRPC client. All queries use TanStack Query under the hood — caching, refetching, and optimistic updates work out of the box.
Next steps
- Option C — Skill invocation — call named operations
- Option D — Chat stream — natural language interface
- API Keys — scope reference
- First SDK queries — React, TypeScript, or cURL
- Quickstart — route to app, agents, or SDK
