> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getagentdrive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# REST API Quickstart

> Upload your first file in 2 minutes

## 1. Provision a drive

No signup needed. One API call gets you a drive, an API key, and a claim URL.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.getagentdrive.com/v0/drives/provision \
    -H "Content-Type: application/json" \
    -d '{"name": "research-q1"}'
  ```

  ```python Python theme={null}
  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
  ```

  ```javascript JavaScript theme={null}
  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
  ```
</CodeGroup>

<Note>
  Unclaimed drives auto-delete after 30 days. Share the `claim_url` with a human to make it permanent.
</Note>

## 2. Upload a file

<CodeGroup>
  ```bash curl theme={null}
  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)'"
    }'
  ```

  ```python Python theme={null}
  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"]
  ```

  ```javascript JavaScript theme={null}
  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();
  ```
</CodeGroup>

## 3. List files

<CodeGroup>
  ```bash curl theme={null}
  curl "https://api.getagentdrive.com/v0/files?drive_id=YOUR_DRIVE_ID" \
    -H "Authorization: Bearer agd_your_key"
  ```

  ```python Python theme={null}
  resp = requests.get(
      "https://api.getagentdrive.com/v0/files",
      headers={"Authorization": f"Bearer {api_key}"},
      params={"drive_id": drive_id},
  )
  files = resp.json()["data"]
  ```
</CodeGroup>

## 4. Download a file

<CodeGroup>
  ```bash curl theme={null}
  curl "https://api.getagentdrive.com/v0/files/FILE_ID/download" \
    -H "Authorization: Bearer agd_your_key" \
    -o report.txt
  ```

  ```python Python theme={null}
  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)
  ```
</CodeGroup>

## Next steps

* [Search and tag files](/api-reference/files/search)
* [Generate presigned download URLs](/api-reference/files/presigned-url)
* [Set up MCP for Claude or ChatGPT](/quickstart/mcp)
