1. Provision a drive
No signup needed. One API call gets you a drive, an API key, and a claim URL.curl -X POST https://api.getagentdrive.com/v0/drives/provision \
-H "Content-Type: application/json" \
-d '{"name": "research-q1"}'
import requests
resp = requests.post(
"https://api.getagentdrive.com/v0/drives/provision",
json={"name": "research-q1"},
)
result = resp.json()["data"]
api_key = result["api_key"]
drive_id = result["drive_id"]
claim_url = result["claim_url"]
# Share claim_url with a human to attach this drive to their account
const resp = await fetch("https://api.getagentdrive.com/v0/drives/provision", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name: "research-q1" }),
});
const { data } = await resp.json();
const { api_key, drive_id, claim_url } = data;
// Share claim_url with a human to attach this drive to their account
Unclaimed drives auto-delete after 30 days. Share the
claim_url with a human to make it permanent.2. Upload a file
curl -X POST https://api.getagentdrive.com/v0/files \
-H "Authorization: Bearer agd_your_key" \
-H "Content-Type: application/json" \
-d '{
"drive_id": "YOUR_DRIVE_ID",
"filename": "report.txt",
"content": "'$(echo -n "Hello from my agent" | base64)'"
}'
import base64
content = base64.b64encode(b"Hello from my agent").decode()
resp = requests.post(
"https://api.getagentdrive.com/v0/files",
headers={"Authorization": f"Bearer {api_key}"},
json={
"drive_id": drive_id,
"filename": "report.txt",
"content": content,
},
)
file = resp.json()["data"]
const content = btoa("Hello from my agent");
const resp = await fetch("https://api.getagentdrive.com/v0/files", {
method: "POST",
headers: {
Authorization: `Bearer ${api_key}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
drive_id: drive_id,
filename: "report.txt",
content,
}),
});
const { data: file } = await resp.json();
3. List files
curl "https://api.getagentdrive.com/v0/files?drive_id=YOUR_DRIVE_ID" \
-H "Authorization: Bearer agd_your_key"
resp = requests.get(
"https://api.getagentdrive.com/v0/files",
headers={"Authorization": f"Bearer {api_key}"},
params={"drive_id": drive_id},
)
files = resp.json()["data"]
4. Download a file
curl "https://api.getagentdrive.com/v0/files/FILE_ID/download" \
-H "Authorization: Bearer agd_your_key" \
-o report.txt
resp = requests.get(
f"https://api.getagentdrive.com/v0/files/{file['id']}/download",
headers={"Authorization": f"Bearer {api_key}"},
)
with open("report.txt", "wb") as f:
f.write(resp.content)
