Upload a File
curl --request PUT \
--url https://composer.personal.ai/lab/api/v1/blob/{filename} \
--header 'x-api-key: <x-api-key>'import requests
url = "https://composer.personal.ai/lab/api/v1/blob/{filename}"
headers = {"x-api-key": "<x-api-key>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://composer.personal.ai/lab/api/v1/blob/{filename}', 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://composer.personal.ai/lab/api/v1/blob/{filename}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://composer.personal.ai/lab/api/v1/blob/{filename}"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://composer.personal.ai/lab/api/v1/blob/{filename}")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://composer.personal.ai/lab/api/v1/blob/{filename}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"object_uri": "<string>",
"bytes": 123
}Knowledge
Upload a File
Upload a file of any size, then ingest it
PUT
/
lab
/
api
/
v1
/
blob
/
{filename}
Upload a File
curl --request PUT \
--url https://composer.personal.ai/lab/api/v1/blob/{filename} \
--header 'x-api-key: <x-api-key>'import requests
url = "https://composer.personal.ai/lab/api/v1/blob/{filename}"
headers = {"x-api-key": "<x-api-key>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://composer.personal.ai/lab/api/v1/blob/{filename}', 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://composer.personal.ai/lab/api/v1/blob/{filename}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://composer.personal.ai/lab/api/v1/blob/{filename}"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://composer.personal.ai/lab/api/v1/blob/{filename}")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://composer.personal.ai/lab/api/v1/blob/{filename}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"object_uri": "<string>",
"bytes": 123
}Overview
Uploads a file’s raw bytes. The returnedobject_uri is what you pass to Ingest File as uri, or to Chat (Streaming) as an attachment’s image.
There’s no size limit on this route. For small files, you can skip it and send the file to Ingest File inline as content_b64.
Requires a key that isn’t read-only. Member keys can’t upload.
Authorization
Path
Body
The file’s raw bytes.Response
Example cURL
cURL
curl --request PUT 'https://composer.personal.ai/lab/api/v1/blob/menu.pdf' \
--header 'x-api-key: <your-api-key>' \
--data-binary '@menu.pdf'
cURL
curl --request POST 'https://composer.personal.ai/lab/api/v1/op/ingest.file' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{"uri": "<object_uri>", "filename": "menu.pdf", "agent": "my-assistant", "mode": "deep"}'
Error Codes
| Code | Description |
|---|---|
| 401 | Missing or invalid API key |
| 403 | This key can’t upload (read-only or member key) |