# Get Upload Sessions

Create an upload session for one or more files before uploading them to any storage. This API returns the upload URLs and identifiers required to complete the file upload process.

> Kind: REST endpoint · Updated: Mar 6, 2026 · POST /v1/files/upload-sessions

Create an upload session for one or more files before uploading them to any storage. This API returns the upload URLs and identifiers required to complete the file upload process.

### Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| library | string | optional | One of sharepoint, msteams, google, onedrive, box, dropbox, cloudfiles, s3, azure, hubspot, azurefiles, sftp |
| driveId | string | optional | Drive Id. Required when library is sharepoint or msteams. |

### Header parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | string | optional | Replace the API_Key placeholder with your actual API key. |

## Request body

```json
{
  "files": [
    {
      "name": "test.pdf",
      "type": "application/pdf"
    }
  ],
  "folderId": "{{Parent_Folder_Id}}"
}
```

## Example request

**cURL**
```bash
curl --request POST \
     --url 'https://api.cloudfiles.io/v1/files/upload-sessions?library=string&driveId=string' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'authorization: Bearer API_Key' \
     --data '"{\n  \"files\": [\n    {\n      \"name\": \"test.pdf\",\n      \"type\": \"application/pdf\"\n    }\n  ],\n  \"folderId\": \"{{Parent_Folder_Id}}\"\n}"'
```

**JavaScript**
```js
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
myHeaders.append("authorization", "Bearer API_Key");

var raw = JSON.stringify("{\n  \"files\": [\n    {\n      \"name\": \"test.pdf\",\n      \"type\": \"application/pdf\"\n    }\n  ],\n  \"folderId\": \"{{Parent_Folder_Id}}\"\n}");

var requestOptions = {
   method: 'POST',
   headers: myHeaders,
   body: raw,
   redirect: 'follow'
};

fetch("https://api.cloudfiles.io/v1/files/upload-sessions?library=string&driveId=string", requestOptions)
   .then(response => response.text())
   .then(result => console.log(result))
   .catch(error => console.log('error', error));
```

**Ruby**
```ruby
require "uri"
require "json"
require "net/http"

url = URI("https://api.cloudfiles.io/v1/files/upload-sessions?library=string&driveId=string")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request["authorization"] = "Bearer API_Key"
request.body = JSON.dump("{\n  \"files\": [\n    {\n      \"name\": \"test.pdf\",\n      \"type\": \"application/pdf\"\n    }\n  ],\n  \"folderId\": \"{{Parent_Folder_Id}}\"\n}")

response = https.request(request)
puts response.read_body

```

**Python**
```py
import requests
import json

url = "https://api.cloudfiles.io/v1/files/upload-sessions?library=string&driveId=string"

payload = json.dumps("{\n  \"files\": [\n    {\n      \"name\": \"test.pdf\",\n      \"type\": \"application/pdf\"\n    }\n  ],\n  \"folderId\": \"{{Parent_Folder_Id}}\"\n}")
headers = {
   'accept': 'application/json',
   'content-type': 'application/json',
   'authorization': 'Bearer API_Key'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```
