---
title: "Upload a file to space storage"
method: POST
path: "/space/{spaceId}/storage/upload/{path}"
tags: ["Space Storage"]
---

# Upload a file to space storage

`POST /space/{spaceId}/storage/upload/{path}`

## Request

- Base URL: `https://api.chatbotkit.com/api/v1`
- URL: `https://api.chatbotkit.com/api/v1/space/{spaceId}/storage/upload/{path}`
- Auth: HTTP bearer

Upload a file to space storage. The file path is specified in the URL
after /upload/. The file can be specified either as a HTTP URL, a data
URL, a multipart/form-data, or as a raw file stream. The maximum file
size for uploads is determined dynamically based on user limits and
configuration, and may vary.

## Path parameters

- `spaceId` string, required
- `path` string, required: The file path

## Request body

- union
  - object
    - `file` string, required: The file to upload either as http: or data: URL
  - object
    - `file` object, required: The file definition to upload
      - `type` string, required: The file type
      - `size` number, required: The file size
      - `meta` object: Optional metadata

## Response `200`

The file was uploaded successfully

- object
  - `id` string, required: The ID of the uploaded file
  - `path` string, required: The path where the file is stored
  - `uploadRequest` object: The request required to upload the file
    - `method` string, required: The HTTP method to use
    - `url` string, required: The HTTP url to use
    - `headers` object, required: The HTTP headers to use

## Other responses

- `default`: An error response

---

[API](https://skmtc.dev/chatbotkit/apis/cbk-api.md) · [All operations](https://skmtc.dev/chatbotkit/apis/cbk-api/llms.txt) · [OpenAPI document](https://skmtc.dev/chatbotkit/apis/cbk-api/revisions/13d250576136?raw)
