Skip to main content
The Wren API has two parts. Turns let you send Wren a prompt and stream its work back, exactly as the chat panel in Agent Studio does. Recommendations let you read what Wren has found on a project, so you can show it in your own tools.

Endpoints

Authentication

All Wren API endpoints authenticate with the x-api-key header. Which kind of key you can use depends on the endpoint: A personal access token acts as you, with your permissions. A workspace API key acts with the permissions granted to that key. Either way, the key needs access to the project you name.
Create a personal access token from your profile menu in Agent Studio, under Account › Personal access tokens. If you don’t see the tab, contact your PolyAI representative. Create a workspace API key from the API Keys tab. See API keys.
Use your region’s base URL. See Getting started for the full list. Personal access tokens are region-specific: a token created in one region is rejected with a 401 in any other.

Recommendations

A recommendation is something Wren found on a project that could be improved, with what happens, why, and where it stands.
Each recommendation carries a nextStep saying what it is waiting for: nextStep is null once a recommendation is closed. A few things worth knowing:
  • The list shows open recommendations by default. Pass all=true or a status filter to include closed ones.
  • Recommendations saved for later are left out by default. Pass saved=true to list only those, or all=true to include everything.
  • Snippets are illustrative. conversationSnippet and changeSnippet are short examples written to show the pattern. They are not transcripts of real calls.
  • Answers appear on a single recommendation only. While nextStep is answered, Get a recommendation returns each question with its answer. The list does not.
  • The API is read-only. Dismissing, commenting on, answering and approving a recommendation are done in Agent Studio.

Turns

Sending a turn starts a Wren run and streams it back as server-sent events. Runs can take many minutes, so keep the connection open and set your client’s read timeout accordingly. The Wren API guide covers modes, answering questions, continuing a conversation, and using Wren from your own agents.

Error responses

Errors come back as JSON with an error message:

Pagination

The list returns limit recommendations at a time, 20 by default and at most 100. When there are more, pagination.hasMore is true and pagination.nextOffset is the offset to pass for the next page.
Last modified on December 1, 2026