Process uploaded agent document
Queues document extraction, chunking, embedding, and knowledge-base indexing after a document has been uploaded.
curl -X POST "https://api.sendkit.ai/v1/agents/example_string/process-document" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"fileKey": "example_string",
"fileUrl": "example_string",
"fileName": "John Doe",
"fileType": "pdf",
"fileSize": 42
}'
import requests
import json
url = "https://api.sendkit.ai/v1/agents/example_string/process-document"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
data = {
"fileKey": "example_string",
"fileUrl": "example_string",
"fileName": "John Doe",
"fileType": "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/process-document", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"fileKey": "example_string",
"fileUrl": "example_string",
"fileName": "John Doe",
"fileType": "pdf",
"fileSize": 42
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"fileKey": "example_string",
"fileUrl": "example_string",
"fileName": "John Doe",
"fileType": "pdf",
"fileSize": 42
}`)
req, err := http.NewRequest("POST", "https://api.sendkit.ai/v1/agents/example_string/process-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/process-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 = '{
"fileKey": "example_string",
"fileUrl": "example_string",
"fileName": "John Doe",
"fileType": "pdf",
"fileSize": 42
}'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"message": "example_string",
"document": {
"fileName": "John Doe",
"fileKey": "example_string",
"fileUrl": "example_string",
"fileType": "pdf",
"fileSize": 42,
"uploadedAt": "2024-12-25T10:00:00Z",
"status": "processing"
},
"job": {
"id": "example_string",
"type": "example_string"
}
}
}
POST
/v1/agents/{agentId}/process-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
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
Body
application/json
fileTypestring
RequiredAllowed values:
pdfdocxtxtResponses
successboolean
dataobject
messagestring
documentobject
fileNamestring
fileKeystring
fileUrlstring
fileTypestring
Allowed values:
pdfdocxtxtfileSizeinteger
uploadedAtstring
statusstring
Allowed values:
processingcompletedfailedjobobject
idstring
typestring
Was this page helpful?