Skip to main content
GET
/
agent-documents
List agent documents
curl --request GET \
  --url https://app.phonely.ai/api/agent-documents \
  --header 'X-Authorization: <api-key>'
import requests

url = "https://app.phonely.ai/api/agent-documents"

headers = {"X-Authorization": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'X-Authorization': '<api-key>'}};

fetch('https://app.phonely.ai/api/agent-documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://app.phonely.ai/api/agent-documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Authorization: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://app.phonely.ai/api/agent-documents"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-Authorization", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://app.phonely.ai/api/agent-documents")
.header("X-Authorization", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.phonely.ai/api/agent-documents")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Authorization"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "documents": [
    {
      "id": "<string>",
      "agentId": "<string>",
      "name": "<string>",
      "active": true,
      "fileUrl": "<string>",
      "lastUpdatedBy": "<string>",
      "lastUpdatedAt": "2023-11-07T05:31:56Z"
    }
  ]
}
{
"error": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}

Agent Documents

Manages documents in an agent’s knowledge base. This endpoint supports GET, POST, and DELETE operations.

List Documents

Method: GET
Endpoint: /api/agent-documents
Headers:
  • X-Authorization: Your API key (required)
Query Parameters:
  • uid (string, required): Your user ID
  • agentId (string, required): The ID of the agent
Response:
{
  "documents": [
    {
      "id": "string",
      "name": "string",
      "active": boolean,
      "fileUrl": "string",
      "lastUpdatedBy": "string",
      "lastUpdatedAt": "string"
    }
  ]
}

Add Documents

Method: POST
Endpoint: /api/agent-documents
Headers:
  • X-Authorization: Your API key (required)
  • Content-Type: multipart/form-data
Form Data:
  • uid (string, required): Your user ID
  • agentId (string, required): The ID of the agent
  • files (File[], required): Array of files to upload (max 10 files, 10MB each)
Supported File Types:
  • PDF (.pdf)
  • Word documents (.docx)
  • Text files (.txt)
Response:
{
  "documentIds": ["string"],
  "message": "Files uploaded successfully"
}

Delete Document

Method: DELETE
Endpoint: /api/agent-documents
Headers:
  • X-Authorization: Your API key (required)
Query Parameters:
  • uid (string, required): Your user ID
  • agentId (string, required): The ID of the agent
  • documentId (string, required): The ID of the document to delete
Response:
{
  "message": "Document deleted successfully"
}

Error Responses

  • 400 Bad Request: Invalid request parameters, too many files, file too large, or unsupported file type
  • 401 Unauthorized: Invalid or missing API key, or insufficient permissions
  • 404 Not Found: Document not found (for DELETE operations)
  • 500 Internal Server Error: Server error

Examples

List documents:
curl -X GET "https://app.phonely.ai/api/agent-documents?uid=user123&agentId=agent456" \
  -H "X-Authorization: your-api-key"
Upload documents:
curl -X POST https://app.phonely.ai/api/agent-documents \
  -H "X-Authorization: your-api-key" \
  -F "uid=user123" \
  -F "agentId=agent456" \
  -F "[email protected]" \
  -F "[email protected]"
Delete document:
curl -X DELETE "https://app.phonely.ai/api/agent-documents?uid=user123&agentId=agent456&documentId=doc789" \
  -H "X-Authorization: your-api-key"

Authorizations

X-Authorization
string
header
required

Query Parameters

uid
string
required

User ID

agentId
string
required

Agent ID

Response

List of documents

documents
object[]
Last modified on July 11, 2026