# Commit CloudFiles File

Finalize a previously uploaded file from the ‘Upload CloudFiles File’ API.

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

Finalize a previously uploaded file from the ‘Upload CloudFiles File’ API.

### Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| library | string | optional |  |

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

## Request body

```json
{
  "name": "test.pdf",
  "folderId": "{{parent-folder-id}}",
  "externalId": "{{external-id-from-get-upload-session}}",
  "size": 12345
}
```

## Example request

**cURL**
```bash
curl --request POST \
     --url 'https://api.cloudfiles.io/v1/files?library=cloudfiles' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'authorization: Bearer API_Key' \
     --data '"{\n  \"name\": \"test.pdf\",\n  \"folderId\": \"{{parent-folder-id}}\",\n  \"externalId\": \"{{external-id-from-get-upload-session}}\",\n  \"size\": 12345\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  \"name\": \"test.pdf\",\n  \"folderId\": \"{{parent-folder-id}}\",\n  \"externalId\": \"{{external-id-from-get-upload-session}}\",\n  \"size\": 12345\n}");

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

fetch("https://api.cloudfiles.io/v1/files?library=cloudfiles", 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?library=cloudfiles")

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  \"name\": \"test.pdf\",\n  \"folderId\": \"{{parent-folder-id}}\",\n  \"externalId\": \"{{external-id-from-get-upload-session}}\",\n  \"size\": 12345\n}")

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

```

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

url = "https://api.cloudfiles.io/v1/files?library=cloudfiles"

payload = json.dumps("{\n  \"name\": \"test.pdf\",\n  \"folderId\": \"{{parent-folder-id}}\",\n  \"externalId\": \"{{external-id-from-get-upload-session}}\",\n  \"size\": 12345\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)

```
