Retrain agent
Queues website retraining and re-processes uploaded documents for an agent. Costs 10 credits. The API does not accept selected pages; website discovery is automatic.
curl -X POST "https://api.sendkit.ai/v1/agents/example_string/retrain" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY"
import requests
import json
url = "https://api.sendkit.ai/v1/agents/example_string/retrain"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
response = requests.post(url, headers=headers)
print(response.json())
const response = await fetch("https://api.sendkit.ai/v1/agents/example_string/retrain", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
)
func main() {
req, err := http.NewRequest("POST", "https://api.sendkit.ai/v1/agents/example_string/retrain", nil)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.sendkit.ai/v1/agents/example_string/retrain')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-Api-Key'] = 'YOUR_API_KEY'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"_id": "example_string",
"name": "John Doe",
"companyInfo": {
"name": "John Doe",
"domain": "example_string",
"industry": "example_string",
"description": "example_string"
},
"persona": {
"tone": "professional",
"role": "example_string",
"communicationStyle": "example_string",
"customInstructions": "example_string"
},
"autonomousMode": {
"enabled": true,
"confidenceThreshold": 3.14,
"maxAutoRepliesPerLead": 42,
"onlyPositiveReplies": true,
"skipOOO": true,
"workingHours": {
"enabled": true,
"startHour": 42,
"endHour": 42,
"timezone": "example_string"
},
"escalationEmail": "user@example.com",
"cooldownMinutes": 42,
"mode": "ai",
"template": "example_string"
},
"followupSettings": {
"enabled": true,
"maxFollowups": 42,
"intervalDays": 42,
"mode": "ai",
"templates": [
"example_string"
]
},
"uploadedDocuments": [
{
"fileName": "John Doe",
"fileKey": "example_string",
"fileUrl": "example_string",
"fileType": "pdf",
"fileSize": 42,
"uploadedAt": "2024-12-25T10:00:00Z",
"status": "processing"
}
],
"trainingStatus": "pending",
"trainingProgress": 3.14,
"trainingError": "example_string",
"knowledgeBase": {
"totalPages": 25,
"totalChunks": 42,
"lastScrapedAt": "2024-12-25T10:00:00Z",
"domain": "example_string"
},
"isDefault": true,
"isActive": true,
"usage": {},
"createdAt": "2024-12-25T10:00:00Z"
},
"meta": {
"creditsCharged": 3.14,
"jobs": [
{
"id": "example_string",
"type": "example_string"
}
]
}
}
{
"error": "Error",
"message": "Insufficient credits",
"code": 402
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"error": "Conflict",
"message": "The request conflicts with the current state of the resource",
"code": 409,
"details": "Resource already exists"
}
POST
/v1/agents/{agentId}/retrainPOST
Base URLstring
Target server for requests. Edit to use your own host.
API Key (header: X-Api-Key)
X-Api-Keystring
RequiredPlatform API key (sk_user_...) or Workspace API key (sk_...)
Platform API key (sk_user_...) or Workspace API key (sk_...)
path
agentIdstring
RequiredAI agent ID
Request Preview
Response
Response will appear here after sending the request
Authentication
header
X-Api-Keystring
RequiredAPI Key for authentication. Platform API key (sk_user_...) or Workspace API key (sk_...)
Path Parameters
agentIdstring
RequiredAI agent ID
Responses
successboolean
dataobject
_idstring
namestring
companyInfoobject
namestring
domainstring
industrystring
descriptionstring
personaobject
tonestring
Allowed values:
professionalfriendlycasualformalenthusiasticrolestring
communicationStylestring
customInstructionsstring
autonomousModeobject
enabledboolean
confidenceThresholdnumber
maxAutoRepliesPerLeadinteger
onlyPositiveRepliesboolean
skipOOOboolean
workingHoursobject
enabledboolean
startHourinteger
endHourinteger
timezonestring
escalationEmailstring
cooldownMinutesinteger
modestring
Allowed values:
aitemplatetemplatestring
HTML reply template. Required when enabled with mode template.
followupSettingsobject
enabledboolean
maxFollowupsinteger
intervalDaysinteger
modestring
Allowed values:
aitemplatetemplatesstring[]
HTML templates. Required for each follow-up step when enabled with mode template.
uploadedDocumentsarray
fileNamestring
fileKeystring
fileUrlstring
fileTypestring
Allowed values:
pdfdocxtxtfileSizeinteger
uploadedAtstring
statusstring
Allowed values:
processingcompletedfailedtrainingStatusstring
Allowed values:
pendingtrainingcompletedfailedtrainingProgressnumber
trainingErrorstring
knowledgeBaseobject
totalPagesinteger
totalChunksinteger
lastScrapedAtstring
domainstring
isDefaultboolean
isActiveboolean
usageobject
createdAtstring
metaobject
creditsChargednumber
jobsarray
idstring
typestring
Insufficient credits
Agent not found
Agent is already training
Was this page helpful?