# Create Link

Create a shareable link for a file or folder. You can configure access settings such as expiration date, download permissions, password protection, and allowed/blocked users.

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

Create a shareable link for a file or folder. You can configure access settings such as expiration date, download permissions, password protection, and allowed/blocked users.

### 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
{
  "name": "test link",
  "resource": "{{resource-id}}",
  "resourceType": "folder",
  "settings": {
    "isActive": true,
    "allowDownloading": true,
    "expireAt": 1728698842000,
    "maxViews": 1000,
    "requirePassword": false,
    "password": "",
    "requireEmail": false,
    "enableEmailVerification": false,
    "allowedEmails": [],
    "allowedDomains": [],
    "blockedEmails": [],
    "blockedDomains": []
  }
}
```

## Example request

**cURL**
```bash
curl --request POST \
     --url 'https://api.cloudfiles.io/v1/links?library=string&driveId=string' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'authorization: Bearer API_Key' \
     --data '"{\n  \"name\": \"test link\",\n  \"resource\": \"{{resource-id}}\",\n  \"resourceType\": \"folder\",\n  \"settings\": {\n    \"isActive\": true,\n    \"allowDownloading\": true,\n    \"expireAt\": 1728698842000,\n    \"maxViews\": 1000,\n    \"requirePassword\": false,\n    \"password\": \"\",\n    \"requireEmail\": false,\n    \"enableEmailVerification\": false,\n    \"allowedEmails\": [],\n    \"allowedDomains\": [],\n    \"blockedEmails\": [],\n    \"blockedDomains\": []\n  }\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 link\",\n  \"resource\": \"{{resource-id}}\",\n  \"resourceType\": \"folder\",\n  \"settings\": {\n    \"isActive\": true,\n    \"allowDownloading\": true,\n    \"expireAt\": 1728698842000,\n    \"maxViews\": 1000,\n    \"requirePassword\": false,\n    \"password\": \"\",\n    \"requireEmail\": false,\n    \"enableEmailVerification\": false,\n    \"allowedEmails\": [],\n    \"allowedDomains\": [],\n    \"blockedEmails\": [],\n    \"blockedDomains\": []\n  }\n}");

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

fetch("https://api.cloudfiles.io/v1/links?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/links?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  \"name\": \"test link\",\n  \"resource\": \"{{resource-id}}\",\n  \"resourceType\": \"folder\",\n  \"settings\": {\n    \"isActive\": true,\n    \"allowDownloading\": true,\n    \"expireAt\": 1728698842000,\n    \"maxViews\": 1000,\n    \"requirePassword\": false,\n    \"password\": \"\",\n    \"requireEmail\": false,\n    \"enableEmailVerification\": false,\n    \"allowedEmails\": [],\n    \"allowedDomains\": [],\n    \"blockedEmails\": [],\n    \"blockedDomains\": []\n  }\n}")

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

```

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

url = "https://api.cloudfiles.io/v1/links?library=string&driveId=string"

payload = json.dumps("{\n  \"name\": \"test link\",\n  \"resource\": \"{{resource-id}}\",\n  \"resourceType\": \"folder\",\n  \"settings\": {\n    \"isActive\": true,\n    \"allowDownloading\": true,\n    \"expireAt\": 1728698842000,\n    \"maxViews\": 1000,\n    \"requirePassword\": false,\n    \"password\": \"\",\n    \"requireEmail\": false,\n    \"enableEmailVerification\": false,\n    \"allowedEmails\": [],\n    \"allowedDomains\": [],\n    \"blockedEmails\": [],\n    \"blockedDomains\": []\n  }\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)

```

## Response body

```json
{
  "id": "lnk_123",
  "name": "Q3 Deck",
  "url": "https://share.cloudfiles.io/a1b2c3",
  "hash": "a1b2c3",
  "createdAt": "2026-07-09T10:00:00Z",
  "createdBy": "usr_1",
  "updatedAt": "2026-07-09T10:00:00Z"
}
```
