Scout AI REST API

Last updated: 08/22/2024
About this sample

REST API reference for an Azure Function-based AI research assistant powered by Anthropic Claude. Demonstrates endpoint documentation with request/response schemas, parameter tables, error handling patterns, and environment configuration — covering 11 endpoints across chat, synthesis, persona generation, and research analysis.

Scout AI is an Azure Function–based REST API that provides AI-powered UX research assistance using Anthropic Claude. It exposes endpoints for chat, research synthesis, report generation, and artifact creation — including personas, journey maps, and interview guides.

Use this API to integrate AI-assisted research analysis into UX tooling, internal research platforms, or automation pipelines.


Base URL

/api/scout-ai

AI model: Configured via ANTHROPIC_MODEL environment variable. Defaults to claude-sonnet-4-20250514.

Content limit: 100,000 characters (~25,000 tokens) per request.


Requirements

RequirementDetails
RuntimeNode.js (Azure Functions)
SDK@anthropic-ai/sdk
Environment variableANTHROPIC_API_KEY — required for all non-health endpoints
Optional variableANTHROPIC_MODEL — overrides the default model

CORS

All responses include the following CORS headers:

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type

Send an OPTIONS preflight request to any endpoint to receive a 200 response with these headers.


Endpoints

Health check

GET /api/scout-ai/health

Returns the service status and confirms whether the Anthropic API key is configured. No authentication is required.

Response

{
  "status": "ok",
  "service": "Scout AI",
  "anthropicConfigured": true
}

Generic Claude proxy

POST /api/scout-ai

Sends a single-turn prompt to Claude with a custom system prompt and user prompt. Use this endpoint for one-off queries that don't fit a specialized endpoint.

Request body

FieldTypeRequiredDefaultDescription
systemPromptstringYesSystem-level instruction for Claude
userPromptstringYesUser message to send
maxTokensnumberNo4096Maximum tokens in the response
temperaturenumberNo0.7Sampling temperature (0–1)

Example request

{
  "systemPrompt": "You are a UX research assistant. Be concise.",
  "userPrompt": "What are the most common methods for unmoderated usability testing?",
  "maxTokens": 1024,
  "temperature": 0.5
}

Response

{
  "success": true,
  "response": "The most common methods include..."
}

Chat stream

POST /api/scout-ai/stream

Sends a multi-turn conversation to Claude and returns the response as plain text. Despite the endpoint name, the response is not streamed — it returns the full Claude response body after generation completes. [VERIFY: confirm whether true HTTP streaming is planned or if the "stream" name is legacy]

Request body

FieldTypeRequiredDefaultDescription
userPromptstringYesThe current user message
systemPromptstringNoScout AI defaultSystem-level instruction
messagesarrayNo[]Prior conversation turns (see format below)
maxTokensnumberNo4096Maximum tokens in the response
temperaturenumberNo0.7Sampling temperature (0–1)
includeCitationsbooleanNotrueAppends citation formatting instructions to the system prompt

messages array item format

{
  "role": "user",
  "content": "What themes emerged from our pilot sessions?"
}

Accepted role values: "user", "assistant".

Example request

{
  "systemPrompt": "You are Scout AI, a UX research assistant.",
  "userPrompt": "Summarize the key pain points from these notes.",
  "messages": [
    { "role": "user", "content": "I have 3 session notes to analyze." },
    { "role": "assistant", "content": "Go ahead and share them." }
  ],
  "includeCitations": true
}

Response

Content-Type: text/plain; charset=utf-8

Based on the session notes, the key pain points are...

Content size limit

The combined character length of systemPrompt, userPrompt, and all messages[].content values must not exceed 100,000 characters. Requests that exceed this limit return 413.


Rewrite text

POST /api/scout-ai/rewrite

Rewrites and improves a block of text. Returns only the improved text with no preamble.

Request body

FieldTypeRequiredDefaultDescription
textstringYesThe text to rewrite
focusstringNoGeneral clarity, conciseness, grammarCustom rewrite instruction to override the default behavior

Example request

{
  "text": "Users was confused by the navigation and couldn't find things easily.",
  "focus": "Rewrite as a formal research finding suitable for a stakeholder report."
}

Response

{
  "success": true,
  "result": "Participants experienced difficulty navigating the interface and struggled to locate key features."
}

Generate findings report

POST /api/scout-ai/report

Generates a structured research findings report from synthesis notes and hypotheses.

Request body

FieldTypeRequiredDefaultDescription
projectNamestringYesProject name used as report title
synthesisNotesarrayNo[]Synthesis note objects or strings. Capped at 20 items; content truncated at 500 characters each
hypothesesarrayNo[]Hypothesis objects with statement and status fields
reportTypestringNo"detailed"Report format: "detailed", "executive", or "presentation"

reportType values

ValueDescription
"detailed"Comprehensive analysis with full findings and recommendations
"executive"Concise summary (1–2 pages) focused on key insights
"presentation"Slide-style format with headers and bullet points

Example request

{
  "projectName": "Mobile Checkout Study",
  "reportType": "executive",
  "synthesisNotes": [
    { "content": "P1 struggled to locate the promo code field..." },
    { "content": "P2 abandoned cart at payment step due to unclear error message..." }
  ],
  "hypotheses": [
    { "statement": "Users expect a guest checkout option", "status": "untested" }
  ]
}

Response

{
  "success": true,
  "response": "# Executive Summary\n\n..."
}

Summarize session notes

POST /api/scout-ai/session-summary

Summarizes one or more research session notes using a specified analysis type.

Request body

FieldTypeRequiredDefaultDescription
projectNamestringYesProject name included in the output
sessionNotesarrayYesSession note objects with title and content fields. Must not be empty
summaryTypestringNo"overview"Analysis type (see values below)
templateStructureanyNo[VERIFY: this field is accepted but unused in the current implementation]

summaryType values

ValueSession limitContent limit per sessionDescription
"overview"102,000 charsExecutive summary, key findings, pain points, and recommendations
"detailed"102,000 charsParticipant-by-participant breakdown, task analysis, and severity ratings
"themes"102,000 charsThematic analysis with prevalence, contradictions, and relationships
"quotes"102,000 charsExtracts impactful quotes grouped by theme with sentiment analysis
"findings-report"82,500 charsFull structured findings report with severity ratings and recommendation tables

sessionNotes array item format

{
  "title": "Session P1 – Sarah",
  "content": "Participant had difficulty locating the filter controls..."
}

Example request

{
  "projectName": "Onboarding Flow Study",
  "summaryType": "findings-report",
  "sessionNotes": [
    {
      "title": "Session P1 – Sarah",
      "content": "Sarah completed task 1 successfully but struggled with task 2..."
    },
    {
      "title": "Session P2 – Marcus",
      "content": "Marcus skipped the tutorial entirely and went directly to settings..."
    }
  ]
}

Response

{
  "success": true,
  "response": "# Findings Report: Onboarding Flow Study\n\n**Date:** ..."
}

Generate user personas

POST /api/scout-ai/personas

Generates user personas from research data.

Request body

FieldTypeRequiredDefaultDescription
projectNamestringYesProject name for context
researchDataarrayNo[]Research items as strings or objects with title and content. Capped at 10 items; content truncated at 1,000 characters each
countnumberNo3Number of personas to generate

Example request

{
  "projectName": "B2B Dashboard Study",
  "count": 2,
  "researchData": [
    {
      "title": "Session P1",
      "content": "Participant is a data analyst who exports reports daily..."
    }
  ]
}

Response

{
  "success": true,
  "response": "## Persona 1: The Analyst\n\n**Name:** Jordan Lee..."
}

Each persona includes name, age, occupation, background, goals, pain points, behaviors, a representative quote, and relevant scenarios.


Create journey map

POST /api/scout-ai/journey-map

Creates a customer journey map from research data.

Request body

FieldTypeRequiredDefaultDescription
projectNamestringYesProject name for context
researchDataarrayNo[]Research items as strings or objects with title and content. Capped at 8 items; content truncated at 1,500 characters each

Example request

{
  "projectName": "Insurance Claims Portal",
  "researchData": [
    {
      "title": "Session P3",
      "content": "User first heard about the portal from an email notification..."
    }
  ]
}

Response

{
  "success": true,
  "response": "## Customer Journey Map: Insurance Claims Portal\n\n### Phase 1: Awareness..."
}

The journey map includes phases, user actions, touchpoints, emotional state, pain points, improvement opportunities, and moments of truth.


Extract themes

POST /api/scout-ai/themes

Extracts and analyzes qualitative themes from research data.

Request body

FieldTypeRequiredDefaultDescription
projectNamestringYesProject name for context
researchDataarrayNo[]Research items as strings or objects with title and content. Capped at 10 items; content truncated at 1,500 characters each

Example request

{
  "projectName": "Remote Work Tools Study",
  "researchData": [
    { "title": "Session P1", "content": "Participant mentioned feeling overwhelmed by notifications..." },
    { "title": "Session P2", "content": "Found async communication essential but hard to track..." }
  ]
}

Response

{
  "success": true,
  "response": "## Themes: Remote Work Tools Study\n\n### Theme 1: Notification Fatigue..."
}

Output includes 3–7 major themes with supporting evidence, theme relationships, outliers, and recommendations.


Generate interview guide

POST /api/scout-ai/interview-guide

Generates a structured interview guide based on research objectives and session duration.

Request body

FieldTypeRequiredDefaultDescription
projectNamestringYesProject name for context
objectivesarrayNo[]Research objective strings. Capped at 10 items
durationnumberNo60Total session duration in minutes

Example request

{
  "projectName": "Expense Reporting Tool",
  "duration": 45,
  "objectives": [
    "Understand how users currently submit expense reports",
    "Identify pain points in the approval workflow"
  ]
}

Response

{
  "success": true,
  "response": "# Interview Guide: Expense Reporting Tool (45 min)\n\n## Introduction (5 min)..."
}

The guide includes an introduction script, warm-up questions, objective-based main questions with follow-up probes, wrap-up questions, a closing script, and interviewer tips.


Analyze hypotheses

POST /api/scout-ai/hypotheses

Evaluates research hypotheses against session data and returns evidence-based status recommendations.

Request body

FieldTypeRequiredDefaultDescription
projectNamestringNo"Research Project"Project name for context
hypothesesarrayYesHypothesis objects. Must not be empty
researchDataarrayYesResearch items to analyze against. Must not be empty. Capped at 5 items; content truncated at 2,000 characters each

hypotheses array item format

{
  "statement": "Users prefer to complete checkout as a guest rather than creating an account.",
  "status": "untested"
}

Accepted status values: "validated", "invalidated", "partial", "untested".

Example request

{
  "projectName": "E-commerce Checkout Study",
  "hypotheses": [
    {
      "statement": "Users prefer guest checkout over account creation.",
      "status": "untested"
    }
  ],
  "researchData": [
    {
      "title": "Session P1",
      "content": "Participant immediately looked for a 'Continue as Guest' option..."
    }
  ]
}

Response

{
  "success": true,
  "response": "### Hypothesis 1: \"Users prefer guest checkout over account creation.\"\n\n**Recommended Status:** validated..."
}

Output includes per-hypothesis evidence, recommended status, confidence level, and a summary across all hypotheses.


Citations

When includeCitations is true on the /stream endpoint, or when any synthesis endpoint is called, Claude is instructed to cite evidence using bracketed participant identifiers.

Format examples:

[Session P1]
[P2]
[Session Notes - P3]
[Participant 4]

This format is enforced by system prompt instruction, not validated in the response. Actual citation accuracy depends on the content and structure of the input data. [VERIFY]


Error handling

All error responses follow this structure:

{
  "success": false,
  "error": "Description of the error"
}

HTTP status codes

StatusCondition
200Success
400Missing required fields or invalid request
404Unknown endpoint action
405Non-POST request to a POST-only endpoint
413Request content exceeds the 100,000-character limit
429Anthropic API rate limit exceeded
500Internal server error or unconfigured API key

Common errors

Missing API key

{
  "success": false,
  "error": "Anthropic API key is not configured or invalid"
}

Ensure ANTHROPIC_API_KEY is set in the Azure Function application settings before invoking any endpoint other than /health.

Request too large

{
  "success": false,
  "error": "Request too large (120k chars). Try with fewer or shorter session notes. Maximum is ~100k chars."
}

Reduce the number of session notes or truncate content before sending.

Rate limit

{
  "success": false,
  "error": "Rate limit exceeded. Please try again in a moment."
}

Retry the request after a brief delay. [VERIFY: confirm whether the application implements any retry logic]


Environment variables

VariableRequiredDefaultDescription
ANTHROPIC_API_KEYYesAnthropic API key used to authenticate all Claude requests
ANTHROPIC_MODELNoclaude-sonnet-4-20250514Claude model identifier