Create Agent File
Upload and associate a file with a specific agent.curl -X POST "https://api.example.com/api/v1/agents/123/agent_files" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"s3_key": "files/product-catalog.pdf",
"s3_url": "https://s3.amazonaws.com/bucket/files/product-catalog.pdf",
"file_name": "product-catalog.pdf",
"file_size": 1024000,
"content_type": "application/pdf"
}'
const agentId = '123';
const response = await fetch(`https://api.example.com/api/v1/agents/${agentId}/agent_files`, {
method: 'POST',
headers: {
'X-API-Key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
s3_key: 'files/product-catalog.pdf',
s3_url: 'https://s3.amazonaws.com/bucket/files/product-catalog.pdf',
file_name: 'product-catalog.pdf',
file_size: 1024000,
content_type: 'application/pdf'
})
});
const data = await response.json();
import requests
agent_id = '123'
headers = {
'X-API-Key': 'your-api-key-here',
'Content-Type': 'application/json'
}
payload = {
's3_key': 'files/product-catalog.pdf',
's3_url': 'https://s3.amazonaws.com/bucket/files/product-catalog.pdf',
'file_name': 'product-catalog.pdf',
'file_size': 1024000,
'content_type': 'application/pdf'
}
response = requests.post(
f'https://api.example.com/api/v1/agents/{agent_id}/agent_files',
headers=headers,
json=payload
)
data = response.json()
{
"status": {
"code": 201,
"message": "File created and associated with agent successfully"
},
"data": {
"id": 1,
"file_name": "product-catalog.pdf",
"s3_key": "files/product-catalog.pdf",
"s3_url": "https://s3.amazonaws.com/bucket/files/product-catalog.pdf",
"file_size": 1024000,
"content_type": "application/pdf",
"elevenlabs_document_id": null,
"agent_id": 123,
"agent_name": "Customer Support Agent"
}
}
