Coach API guide
This page documents Coach endpoints with practical usage guidance, parameter tables, and request/response examples.
For full contract detail and interactive testing, use the API Explorer in the sidebar.
Endpoint reference
GET /api/coach/bootstrap
Use this endpoint to load initial Coach state when the authenticated user opens the Coach surface.
Query parameters
| Name | Type | Required | Description |
|---|
| None | - | - | No query parameters are required. |
curl "<NSDK_API_BASE_URL>/api/coach/bootstrap" \
-H "Authorization: Bearer <access-jwt>"
Common errors
401: missing or expired access token
429: rate-limit protection
POST /api/chat/session/create
Use this endpoint to create a new session before sending chat messages.
Request body
| Name | Type | Required | Description |
|---|
chatType | string | Yes | Chat mode. Supported values include free, metric, opp. |
userId | string | Yes | Authenticated user identifier. |
curl -X POST "<NSDK_API_BASE_URL>/api/chat/session/create" \
-H "Authorization: Bearer <access-jwt>" \
-H "Content-Type: application/json" \
-d '{
"chatType": "free",
"userId": "1005"
}'
Common errors
400: invalid payload fields
401: access token invalid or missing
429: rate-limit protection
GET /api/chat/sessions/list
Use this endpoint to fetch existing chat sessions for the current user.
Query parameters
| Name | Type | Required | Description |
|---|
| None | - | - | No query parameters are required. |
curl "<NSDK_API_BASE_URL>/api/chat/sessions/list" \
-H "Authorization: Bearer <access-jwt>"
Common errors
401: access token invalid or missing
429: rate-limit protection
GET /api/chat/history/{session_id}
Use this endpoint to load the message history of one session.
Path parameters
| Name | Type | Required | Description |
|---|
session_id | string | Yes | Session identifier returned by create/list endpoints. |
curl "<NSDK_API_BASE_URL>/api/chat/history/123" \
-H "Authorization: Bearer <access-jwt>"
Common errors
401: access token invalid or missing
404: session not found
429: rate-limit protection
POST /api/chat/send
Use this endpoint to send one message and receive streamed assistant output via SSE.
Request body
| Name | Type | Required | Description |
|---|
sessionId | string | Yes | Existing chat session id. |
userId | string | Yes | Authenticated user identifier. |
payloadType | string | Yes | Message payload type, currently text. |
payload | object | Yes | Payload object, including text. |
curl -N -X POST "<NSDK_API_BASE_URL>/api/chat/send" \
-H "Authorization: Bearer <access-jwt>" \
-H "Content-Type: application/json" \
-d '{
"sessionId": "123",
"userId": "1005",
"payloadType": "text",
"payload": { "text": "How can I reduce costs?" }
}'
Common errors
400: invalid message payload
401: access token invalid or missing
500: transient runtime error during orchestration/streaming
POST /api/chat/followup_questions
Use this endpoint to generate guided follow-up questions for an answer.
Request body
| Name | Type | Required | Description |
|---|
question | string | Yes | Original user question. |
answer | string | Yes | Assistant answer context. |
count | integer | Yes | Number of follow-up suggestions to return. |
curl -X POST "<NSDK_API_BASE_URL>/api/chat/followup_questions" \
-H "Authorization: Bearer <access-jwt>" \
-H "Content-Type: application/json" \
-d '{
"question": "How can I reduce costs?",
"answer": "Review recurring spend first.",
"count": 3
}'
Common errors
400: invalid payload fields
401: access token invalid or missing
429: rate-limit protection
PUT /api/chat/session/{session_id}/binding
Use this endpoint to bind a chat session to a specific context entity (for example, an insight).
Path parameters
| Name | Type | Required | Description |
|---|
session_id | string | Yes | Session identifier to bind. |
Request body
| Name | Type | Required | Description |
|---|
bindingType | string | Yes | Context type, for example insight. |
bindingId | string | Yes | Context entity identifier. |
curl -X PUT "<NSDK_API_BASE_URL>/api/chat/session/123/binding" \
-H "Authorization: Bearer <access-jwt>" \
-H "Content-Type: application/json" \
-d '{
"bindingType": "insight",
"bindingId": "12001"
}'
Common errors
400: invalid binding payload
401: access token invalid or missing
429: rate-limit protection
POST /api/chat/session/{session_id}/message-feedback
Use this endpoint to capture explicit user feedback for an assistant message.
Path parameters
| Name | Type | Required | Description |
|---|
session_id | string | Yes | Session identifier. |
Request body
| Name | Type | Required | Description |
|---|
messageId | string | Yes | Assistant message identifier. |
feedback | string | Yes | Feedback value, typically positive or negative. |
curl -X POST "<NSDK_API_BASE_URL>/api/chat/session/123/message-feedback" \
-H "Authorization: Bearer <access-jwt>" \
-H "Content-Type: application/json" \
-d '{
"messageId": "m_101",
"feedback": "positive"
}'
Common errors
400: invalid feedback payload
401: access token invalid or missing
404: session or message not found