---
title: "Get a signed URL for uploading a file to Definite Drive (API)"
method: POST
path: "/v3/drive/upload-url"
tags: ["v3", "Drive"]
---

# Get a signed URL for uploading a file to Definite Drive (API)

`POST /v3/drive/upload-url`

Generate a signed URL for directly uploading a file to Definite Drive (GCS).

    Authenticate with your API key in the Authorization header:
    `Authorization: Bearer <your-api-key>`

    The file will be accessible in E2B sandboxes at `/home/user/drive/{path}`
    via the gcsfuse mount. Files persist across sessions and are shared with all
    team members.

    **Example:**
    ```
    POST /v3/drive/upload-url
    Authorization: Bearer def-xxxx-your-api-key
    Content-Type: application/json

    {"path": "data/reports/q4-2024.csv"}
    ```

## Request body

- DriveApiUploadUrlRequest — Request to generate a signed URL for uploading to Definite Drive (API).
  - `path` string, nullable — Destination path within the drive (e.g., 'data/reports/q4.csv'). Required when temporary=False; ignored when temporary=True (the server chooses a path).
  - `temporary` boolean — If True, the file is written under '_tmp/<date>/<uuid>/...' and auto-deleted after ttl_days via a GCS lifecycle rule on the bucket's customTime. path is ignored.
  - `ttl_days` integer — Only applies when temporary=True. Days until the temporary file is auto-deleted.
  - `filename_hint` string, nullable — Only applies when temporary=True. Suggested filename (preserves suffix for UX).

## Response `200`

Signed URL generated successfully

- DriveUploadUrlResponse — Response containing signed URL and instructions for direct GCS upload.
  - `upload_url` string, required — Signed PUT URL for direct upload to GCS
  - `http_method` string — HTTP method to use with upload_url
  - `headers` object — Headers that the client MUST send with the upload request. Includes Content-Type and, for temporary uploads, X-Goog-Custom-Time.
  - `gcs_path` string, required — Full GCS path where the file will be stored
  - `drive_path` string, required — Path in sandbox where the file will be accessible: /home/user/drive/{file_name}
  - `expires_at` string, date-time, nullable — When the file will be auto-deleted. Only set for temporary uploads.

## Other responses

- `400` — Invalid path
- `403` — Invalid or missing API key
- `422` — Validation Error
- `500` — Failed to generate signed URL

---

[API](https://skmtc.dev/definite/apis/defapi.md) · [All operations](https://skmtc.dev/definite/apis/defapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/definite/defapi/revisions/3943d8deb3be/schema)
