Upload File
curl --request POST \
--url https://api.personal.ai/v1/upload-file \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"message_request": "<any>"
}
'import requests
url = "https://api.personal.ai/v1/upload-file"
payload = { "message_request": "<any>" }
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': '<content-type>'},
body: JSON.stringify({message_request: '<any>'})
};
fetch('https://api.personal.ai/v1/upload-file', 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://api.personal.ai/v1/upload-file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message_request' => '<any>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>",
"x-api-key: <x-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.personal.ai/v1/upload-file"
payload := strings.NewReader("{\n \"message_request\": \"<any>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.personal.ai/v1/upload-file")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.body("{\n \"message_request\": \"<any>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.personal.ai/v1/upload-file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"message_request\": \"<any>\"\n}"
response = http.request(request)
puts response.read_body{
"Title": "<string>",
"Starttime": "<string>",
"EndTime": "<string>",
"Tags": "<string>",
"is_stack": true,
"message": "<string>"
}Personal AI APIs
Upload File
Upload a file to your memory
POST
/
v1
/
upload-file
Upload File
curl --request POST \
--url https://api.personal.ai/v1/upload-file \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"message_request": "<any>"
}
'import requests
url = "https://api.personal.ai/v1/upload-file"
payload = { "message_request": "<any>" }
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': '<content-type>'},
body: JSON.stringify({message_request: '<any>'})
};
fetch('https://api.personal.ai/v1/upload-file', 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://api.personal.ai/v1/upload-file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message_request' => '<any>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>",
"x-api-key: <x-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.personal.ai/v1/upload-file"
payload := strings.NewReader("{\n \"message_request\": \"<any>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.personal.ai/v1/upload-file")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.body("{\n \"message_request\": \"<any>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.personal.ai/v1/upload-file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"message_request\": \"<any>\"\n}"
response = http.request(request)
puts response.read_body{
"Title": "<string>",
"Starttime": "<string>",
"EndTime": "<string>",
"Tags": "<string>",
"is_stack": true,
"message": "<string>"
}Overview
API endpoint for uploading files (PDF, DOCX, etc.) to your Personal AI memory.Authorization
string
required
Your Personal AI API key
Headers
string
required
Must be set to application/json
Query Params
string
required
The hyphenated text below the AI’s name when clicked into a Persona.

File
File
required
The file to be uploaded
JSON
required
A JSON-encoded string containing additional request parameters
Example message_request
{"DomainName": "product-demo-jebzrhw", "Title": "Uploaded Files"}
Body
string
Title of the uploaded document
Example Request
"Title": "My Document"
string
ISO timestamp string indicating start time (UTC). Defaults to current time.
Example Request
"Starttime": "2024-10-09T10:00:00.000Z"
string
ISO timestamp string indicating end time (UTC). Defaults to current time.
Example Request
"Endtime": "2024-10-10T10:00:00.000Z"
string
Comma delimited list of tags for context and reference
Example Request
"Tags": "documents,developers,coding"
boolean
Boolean to specify whether to add the document to memory. If false, upload shows up as draft in Documents.
Defaults to true.
Example Request
"is_stack": true
Example Responses
string
Success or error message
Example Success Response
{
"message": "file accepted and processing"
}
Example Error Response
{
"detail": "AI memory api unauthorized."
}
Example cURL
cURL
curl --location 'https://api.personal.ai/v1/upload-file?DomainName={DomainName}' \
--header 'x-api-key: <your-api-key>' \
--form 'file=@"/path/to/file.pdf"' \
--form 'message_request="{\"DomainName\": \"product-demo-jebzrhw\", \"Title\": \"My Document\"}"'
Error Codes
| Code | Description |
|---|---|
| 403 | Forbidden - Check that API key is invalid |