Skip to main content
The Sessions API lets you start a conversation with a Blocks agent and stream its responses over plain HTTP. Every endpoint lives under /rest/v1, accepts and returns JSON, and authenticates with a workspace-scoped API key.

1. Create a Blocks account and get an API key

Create a Blocks account, then generate a workspace API key from Settings > API Keys. Set the API key in your environment as BLOCKS_API_KEY before running the snippets below. For example:

2. Create a session and poll for the first reply

  1. Create a sessionPOST /rest/v1/sessions. The response includes _links.final_message.href, a pre-built URL for polling the assistant’s reply.
  2. Poll the URLGET it until items is non-empty.

3. Send a follow-up

  1. Send a follow-upPOST /rest/v1/sessions/{session_id}/messages. The response returns its own _links.final_message.href, the same shortcut as create.
  2. Poll the new thread’s URL — same pattern as above.
Follow-ups can be sent at any time — including while the agent is still working — and will interrupt the in-flight turn.
The snippets below assume session, headers, and BASE_URL are still in scope from the previous step.

Next steps

Create Session

Full request and response schema for POST /rest/v1/sessions.

Get Session Messages

List, filter, and poll messages on a session or a single thread.

Send Messages

Post follow-ups — they interrupt an in-flight session.

Get Session

Look up a single session by ID.