Upload agent training document
Either uploads a multipart file directly through the API or returns a presigned R2 upload URL for JSON requests.
Allowed file types are PDF, DOCX, and TXT. Maximum size is 10MB.
curl -X POST "https://api.sendkit.ai/v1/agents/example_string/upload-document" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"filename": "John Doe",
"contentType": "application/pdf",
"fileSize": 42
}'
import requests
import json
url = "https://api.sendkit.ai/v1/agents/example_string/upload-document"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
data = {
"filename": "John Doe",
"contentType": "application/pdf",
"fileSize": 42
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.sendkit.ai/v1/agents/example_string/upload-document", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"filename": "John Doe",
"contentType": "application/pdf",
"fileSize": 42
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"filename": "John Doe",
"contentType": "application/pdf",
"fileSize": 42
}`)
req, err := http.NewRequest("POST", "https://api.sendkit.ai/v1/agents/example_string/upload-document", bytes.NewBuffer(data))
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/upload-document')
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'
request.body = '{
"filename": "John Doe",
"contentType": "application/pdf",
"fileSize": 42
}'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"presignedUrl": "example_string",
"uploadUrl": "example_string",
"url": "example_string",
"key": "example_string",
"filename": "John Doe",
"fileType": "pdf"
}
}
POST
/v1/agents/{agentId}/upload-documentPOST
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
Content-Typestring
RequiredThe media type of the request body
Options: application/json, multipart/form-data
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
presignedUrlstring
uploadUrlstring
urlstring
keystring
filenamestring
fileTypestring
Allowed values:
pdfdocxtxtWas this page helpful?