Training

Last updated: September 30, 2026

Training records are the corrections your team gives BrokerBot from chat: a user’s question, the agent’s answer, and (once reviewed) the answer BrokerBot should give next time. Approved training is used by the agent in future chats. All endpoints use a team API key and are served under https://api.brokerbot.ai/v1/training.

Choosing a team

GET /v1/training takes an optional teamId query parameter: your top-level team (the default) or one of its sub-teams, by ID. A team outside your key’s tree returns 404. A training record owned by a team outside your key’s tree also returns 404:

{ "error": "Training not found" }

Training object

Field Type Description
id string Training ID.
number integer Number shown in BrokerBot, for example 42 for “Training #42”. Unique within the team.
teamId string Team that owns the training.
chatId string Chat the training came from.
status string pending, approved, or rejected.
pinned boolean Pinned training always applies. Only approved training can be pinned.
isUpvoted boolean true if the feedback was a thumbs up, false for a thumbs down.
userText string The user’s message.
agentText string The agent’s response that received the feedback.
summary string | null Short summary of the correction.
correctedResponse string | null The response BrokerBot should give instead.
createdAt string ISO 8601 creation time.

List training

GET /v1/training

Lists a team’s training, newest first. Training that belongs to its sub-teams isn’t included; pass the sub-team’s teamId to list it.

Query parameter Type Description
teamId string Optional. Team to list. Defaults to the API key’s team.
status string Optional. pending, approved, or rejected.
pinned string Optional. true or false.
page integer Optional. Page number from 1. Default 1.
pageSize integer Optional. 1–100. Default 20.
curl "https://api.brokerbot.ai/v1/training?status=pending" \
  -H "Authorization: Bearer $BROKERBOT_API_KEY"
{
  "training": [
    {
      "id": "cmg4x1y2z0000abcd",
      "number": 42,
      "teamId": "team_123",
      "chatId": "chat_456",
      "status": "pending",
      "pinned": false,
      "isUpvoted": false,
      "userText": "What's our commission split for new agents?",
      "agentText": "New agents are on a 60/40 split.",
      "summary": "New agents start on a 70/30 split",
      "correctedResponse": null,
      "createdAt": "2026-09-28T17:02:11.000Z"
    }
  ],
  "pagination": {
    "totalCount": 1,
    "totalPages": 1,
    "currentPage": 1,
    "pageSize": 20
  }
}

Get training

GET /v1/training/{trainingId}

Returns { "training": <Training object> }.

Approve training

POST /v1/training/{trainingId}/approve

Approves the training so the agent uses it in future chats. The request body is optional:

Field Type Description
correctedResponse string Optional. The response BrokerBot should give, up to 20,000 characters. When omitted, BrokerBot writes one from the feedback.
curl -X POST "https://api.brokerbot.ai/v1/training/cmg4x1y2z0000abcd/approve" \
  -H "Authorization: Bearer $BROKERBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "correctedResponse": "New agents start on a 70/30 split." }'

Returns { "training": <Training object> } with status: "approved". The agent picks up the change within a few minutes, once BrokerBot has indexed it.

Reject training

POST /v1/training/{trainingId}/reject

Rejects the training so the agent doesn’t use it. Rejecting approved training removes it from the agent and unpins it. No request body. Returns { "training": <Training object> } with status: "rejected".

Errors

Status When
400 Invalid query parameter or correctedResponse.
401 Missing or invalid API key.
404 Team or training not found in your key’s tree.
502 The status was saved but BrokerBot couldn’t apply it to the agent. Retry the same request.

See Errors for the error format.