cURL
curl --request POST \
--url https://api.dock.us/{version}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "contract.pdf",
"mimeType": "application/pdf",
"size": 24576
}
'import requests
url = "https://api.dock.us/{version}/files"
payload = {
"fileName": "contract.pdf",
"mimeType": "application/pdf",
"size": 24576
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileName: 'contract.pdf', mimeType: 'application/pdf', size: 24576})
};
fetch('https://api.dock.us/{version}/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dock.us/{version}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fileName' => 'contract.pdf',
'mimeType' => 'application/pdf',
'size' => 24576
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dock.us/{version}/files"
payload := strings.NewReader("{\n \"fileName\": \"contract.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 24576\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dock.us/{version}/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"contract.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 24576\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dock.us/{version}/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"contract.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 24576\n}"
response = http.request(request)
puts response.read_body{
"data": {
"file": {
"id": "RiHO4e0Ju3DS",
"updatedAt": "2021-01-01T00:00:00.000Z",
"createdAt": "2021-01-01T00:00:00.000Z",
"object": "file",
"name": "contract.pdf",
"thumbnail": "https://storage.googleapis.com/dock-production-private/thumbnails/contract.png",
"size": 24576,
"url": "https://storage.googleapis.com/dock-production-private/signed-url",
"expiresAt": "2026-06-12T12:00:00.000Z",
"uploadStatus": "success",
"mimeType": "application/pdf"
},
"upload": {
"url": "https://storage.googleapis.com/dock-production-private/asset/abc123/6f1b.pdf?X-Goog-Signature=...",
"method": "PUT",
"headers": {
"Content-Type": "application/pdf"
},
"expiresAt": "2026-06-12T12:00:00.000Z"
}
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request could not be understood or was missing required parameters"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Access denied. You are not authorized to access this resource"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Access to this resource is restricted"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "The requested resource could not be found"
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded. Please try again later"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "The server has encountered a situation it does not know how to handle"
}
}Files
Create a file
Create a file and receive a presigned upload URL. PUT the raw file bytes to the returned upload URL (with the matching Content-Type header), then pass the file id to POST /assets to create an asset from it.
POST
/
files
cURL
curl --request POST \
--url https://api.dock.us/{version}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "contract.pdf",
"mimeType": "application/pdf",
"size": 24576
}
'import requests
url = "https://api.dock.us/{version}/files"
payload = {
"fileName": "contract.pdf",
"mimeType": "application/pdf",
"size": 24576
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileName: 'contract.pdf', mimeType: 'application/pdf', size: 24576})
};
fetch('https://api.dock.us/{version}/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dock.us/{version}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fileName' => 'contract.pdf',
'mimeType' => 'application/pdf',
'size' => 24576
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dock.us/{version}/files"
payload := strings.NewReader("{\n \"fileName\": \"contract.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 24576\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dock.us/{version}/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"contract.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 24576\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dock.us/{version}/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"contract.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 24576\n}"
response = http.request(request)
puts response.read_body{
"data": {
"file": {
"id": "RiHO4e0Ju3DS",
"updatedAt": "2021-01-01T00:00:00.000Z",
"createdAt": "2021-01-01T00:00:00.000Z",
"object": "file",
"name": "contract.pdf",
"thumbnail": "https://storage.googleapis.com/dock-production-private/thumbnails/contract.png",
"size": 24576,
"url": "https://storage.googleapis.com/dock-production-private/signed-url",
"expiresAt": "2026-06-12T12:00:00.000Z",
"uploadStatus": "success",
"mimeType": "application/pdf"
},
"upload": {
"url": "https://storage.googleapis.com/dock-production-private/asset/abc123/6f1b.pdf?X-Goog-Signature=...",
"method": "PUT",
"headers": {
"Content-Type": "application/pdf"
},
"expiresAt": "2026-06-12T12:00:00.000Z"
}
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request could not be understood or was missing required parameters"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Access denied. You are not authorized to access this resource"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Access to this resource is restricted"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "The requested resource could not be found"
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded. Please try again later"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "The server has encountered a situation it does not know how to handle"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
File to create
Name of the file, including its extension
Example:
"contract.pdf"
MIME type of the file to upload
Available options:
application/pdf, image/jpeg, image/png, image/gif, image/webp, video/mp4, video/webm, video/quicktime, video/mov, video/mpeg, video/mpg, video/avi, audio/mpeg, audio/mp3, audio/wav, audio/ogg, audio/m4a, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/msword, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/html Example:
"application/pdf"
File size in bytes. Validated against the per-type upload limit: 50MB for images and audio, 150MB for office documents and HTML, 500MB for PDFs, 10GB for videos.
Required range:
x >= 1Example:
24576
Response
File created
Show child attributes
Show child attributes
⌘I