---
title: "Upload file to cloud storage"
method: POST
path: "/api/files/upload"
tags: ["v1", "files"]
---

# Upload file to cloud storage

`POST /api/files/upload`

Upload a file to cloud storage and return a storage key that can be used
with FileStoreBlock and AgentFileInputBlock.

Args:
    file: The file to upload
    user_id: The user ID
    provider: Cloud storage provider ("gcs", "s3", "azure")
    expiration_hours: Hours until file expires (1-48)

Returns:
    Dict containing the cloud storage path and signed URL

## Query parameters

- `expiration_hours` integer

## Response `200`

Successful Response

- BackendApiModelUploadFileResponse
  - `file_uri` string, required
  - `file_name` string, required
  - `size` integer, required
  - `content_type` string, required
  - `expires_in_hours` integer, required

## Other responses

- `401` — Authentication required
- `422` — Validation Error

---

[API](https://skmtc.net/significant-gravitas/apis/autogpt-agent-server.md) · [All operations](https://skmtc.net/significant-gravitas/apis/autogpt-agent-server/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/significant-gravitas/autogpt-agent-server/versions/382041c7ecb2/schema)
