Workspace: File Share
curl --request POST \
--url https://api.xpander.ai/v1/agents/{agent_id}/workspace/file_share \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"path": "notes/demo.txt"
}
'import requests
url = "https://api.xpander.ai/v1/agents/{agent_id}/workspace/file_share"
payload = { "path": "notes/demo.txt" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({path: 'notes/demo.txt'})
};
fetch('https://api.xpander.ai/v1/agents/{agent_id}/workspace/file_share', 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.xpander.ai/v1/agents/{agent_id}/workspace/file_share",
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([
'path' => 'notes/demo.txt'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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.xpander.ai/v1/agents/{agent_id}/workspace/file_share"
payload := strings.NewReader("{\n \"path\": \"notes/demo.txt\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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.xpander.ai/v1/agents/{agent_id}/workspace/file_share")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"notes/demo.txt\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xpander.ai/v1/agents/{agent_id}/workspace/file_share")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"notes/demo.txt\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://links.xpander.ai/a1b2c3d.txt"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Agent Workspace
File Share
Publish a file from the agent’s workspace to a public CDN URL
POST
/
v1
/
agents
/
{agent_id}
/
workspace
/
file_share
Workspace: File Share
curl --request POST \
--url https://api.xpander.ai/v1/agents/{agent_id}/workspace/file_share \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"path": "notes/demo.txt"
}
'import requests
url = "https://api.xpander.ai/v1/agents/{agent_id}/workspace/file_share"
payload = { "path": "notes/demo.txt" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({path: 'notes/demo.txt'})
};
fetch('https://api.xpander.ai/v1/agents/{agent_id}/workspace/file_share', 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.xpander.ai/v1/agents/{agent_id}/workspace/file_share",
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([
'path' => 'notes/demo.txt'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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.xpander.ai/v1/agents/{agent_id}/workspace/file_share"
payload := strings.NewReader("{\n \"path\": \"notes/demo.txt\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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.xpander.ai/v1/agents/{agent_id}/workspace/file_share")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"notes/demo.txt\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xpander.ai/v1/agents/{agent_id}/workspace/file_share")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"notes/demo.txt\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://links.xpander.ai/a1b2c3d.txt"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Publish a file from the per-agent workspace to a public CDN URL that can be shared externally (for example, to return a download link from an agent response).
Path Parameters
string
required
Agent ID (UUID)
Request Body
string
required
Path to the file in the workspace to publish.
Response
string
A shareable link to the file.
Example Request
curl -X POST "https://api.xpander.ai/v1/agents/<agent-id>/workspace/file_share" \
-H "Content-Type: application/json" \
-H "x-api-key: <your-api-key>" \
-d '{
"path": "output/report.csv"
}'
Notes
- The returned URL is a short link anyone with the link can open. Share it only with people who should see the file, and never share files that contain secrets.
See Also
Authorizations
API Key for authentication
Path Parameters
Body
application/json
Relative path to the file in the workspace to share publicly.
Example:
"output/report.csv"
Response
Successful Response
Public CDN URL for the shared file
Was this page helpful?

