curl --request POST \
--url https://api.dock.us/{version}/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "pdf",
"name": "Sales deck",
"fileId": "f9Ghw2n0Ju3D",
"description": "<string>",
"tagIds": [
"RiHO4e0Ju3DS"
],
"isInternal": false,
"url": "https://example.com/pricing",
"customCode": "<iframe src=\"https://example.com\"></iframe>",
"metadata": {
"width": 123,
"height": 123,
"duration": 123,
"pages": 123
}
}
'import requests
url = "https://api.dock.us/{version}/assets"
payload = {
"type": "pdf",
"name": "Sales deck",
"fileId": "f9Ghw2n0Ju3D",
"description": "<string>",
"tagIds": ["RiHO4e0Ju3DS"],
"isInternal": False,
"url": "https://example.com/pricing",
"customCode": "<iframe src=\"https://example.com\"></iframe>",
"metadata": {
"width": 123,
"height": 123,
"duration": 123,
"pages": 123
}
}
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({
type: 'pdf',
name: 'Sales deck',
fileId: 'f9Ghw2n0Ju3D',
description: '<string>',
tagIds: ['RiHO4e0Ju3DS'],
isInternal: false,
url: 'https://example.com/pricing',
customCode: '<iframe src="https://example.com"></iframe>',
metadata: {width: 123, height: 123, duration: 123, pages: 123}
})
};
fetch('https://api.dock.us/{version}/assets', 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}/assets",
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([
'type' => 'pdf',
'name' => 'Sales deck',
'fileId' => 'f9Ghw2n0Ju3D',
'description' => '<string>',
'tagIds' => [
'RiHO4e0Ju3DS'
],
'isInternal' => false,
'url' => 'https://example.com/pricing',
'customCode' => '<iframe src="https://example.com"></iframe>',
'metadata' => [
'width' => 123,
'height' => 123,
'duration' => 123,
'pages' => 123
]
]),
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}/assets"
payload := strings.NewReader("{\n \"type\": \"pdf\",\n \"name\": \"Sales deck\",\n \"fileId\": \"f9Ghw2n0Ju3D\",\n \"description\": \"<string>\",\n \"tagIds\": [\n \"RiHO4e0Ju3DS\"\n ],\n \"isInternal\": false,\n \"url\": \"https://example.com/pricing\",\n \"customCode\": \"<iframe src=\\\"https://example.com\\\"></iframe>\",\n \"metadata\": {\n \"width\": 123,\n \"height\": 123,\n \"duration\": 123,\n \"pages\": 123\n }\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}/assets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"pdf\",\n \"name\": \"Sales deck\",\n \"fileId\": \"f9Ghw2n0Ju3D\",\n \"description\": \"<string>\",\n \"tagIds\": [\n \"RiHO4e0Ju3DS\"\n ],\n \"isInternal\": false,\n \"url\": \"https://example.com/pricing\",\n \"customCode\": \"<iframe src=\\\"https://example.com\\\"></iframe>\",\n \"metadata\": {\n \"width\": 123,\n \"height\": 123,\n \"duration\": 123,\n \"pages\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dock.us/{version}/assets")
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 \"type\": \"pdf\",\n \"name\": \"Sales deck\",\n \"fileId\": \"f9Ghw2n0Ju3D\",\n \"description\": \"<string>\",\n \"tagIds\": [\n \"RiHO4e0Ju3DS\"\n ],\n \"isInternal\": false,\n \"url\": \"https://example.com/pricing\",\n \"customCode\": \"<iframe src=\\\"https://example.com\\\"></iframe>\",\n \"metadata\": {\n \"width\": 123,\n \"height\": 123,\n \"duration\": 123,\n \"pages\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"asset": {
"id": "RiHO4e0Ju3DS",
"updatedAt": "2021-01-01T00:00:00.000Z",
"createdAt": "2021-01-01T00:00:00.000Z",
"tags": [
{
"id": "RiHO4e0Ju3DS",
"updatedAt": "2021-01-01T00:00:00.000Z",
"createdAt": "2021-01-01T00:00:00.000Z",
"object": "tag",
"url": "https://api.dock.us/v1/tags/RiHO4e0Ju3DS",
"title": "Logo"
}
],
"object": "asset",
"url": "https://api.dock.us/v1/assets/RiHO4e0Ju3DS",
"name": "Logo",
"description": "Logo of the asset",
"transcript": "<string>",
"views": 100,
"shares": 100,
"assetType": "image",
"assetUrl": "https://dock.us/logo.png",
"thumbnailUrl": "https://storage.googleapis.com/dock-production-private/thumbnail/RiHO4e0Ju3DS.png?X-Goog-Signature=...",
"isInternal": false
}
}
}{
"error": {
"code": "BAD_REQUEST",
"reason": "NOT_FOUND",
"message": "The request could not be understood or was missing required parameters",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>",
"details": [
{
"field": "body.shareSetting",
"message": "'shareSetting' is required in body"
}
]
}
}{
"error": {
"code": "INVALID_TOKEN",
"reason": "NOT_FOUND",
"message": "Access denied. You are not authorized to access this resource",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}{
"error": {
"code": "FORBIDDEN",
"reason": "NOT_FOUND",
"message": "Access to this resource is restricted",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}{
"error": {
"code": "NOT_FOUND",
"reason": "NOT_FOUND",
"message": "The requested resource could not be found",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"reason": "NOT_FOUND",
"message": "Rate limit exceeded. Please try again later",
"retryable": true,
"retryAfter": 2,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"reason": "NOT_FOUND",
"message": "The server has encountered a situation it does not know how to handle",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}Create an asset
Create an asset. For file-backed types (pdf, image, video, audio, docx, ppt, xlsx, htmlPage), first create a file via POST /files and PUT the bytes to its upload URL, then pass the file id here. Link and embed assets are created from a URL (or custom embed code) directly. Office documents (docx, ppt, xlsx) are converted to a PDF rendition asynchronously and are returned as the corresponding microsoft*EmbedPdf asset type — poll GET /files/ on the asset’s file to track conversion.
curl --request POST \
--url https://api.dock.us/{version}/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "pdf",
"name": "Sales deck",
"fileId": "f9Ghw2n0Ju3D",
"description": "<string>",
"tagIds": [
"RiHO4e0Ju3DS"
],
"isInternal": false,
"url": "https://example.com/pricing",
"customCode": "<iframe src=\"https://example.com\"></iframe>",
"metadata": {
"width": 123,
"height": 123,
"duration": 123,
"pages": 123
}
}
'import requests
url = "https://api.dock.us/{version}/assets"
payload = {
"type": "pdf",
"name": "Sales deck",
"fileId": "f9Ghw2n0Ju3D",
"description": "<string>",
"tagIds": ["RiHO4e0Ju3DS"],
"isInternal": False,
"url": "https://example.com/pricing",
"customCode": "<iframe src=\"https://example.com\"></iframe>",
"metadata": {
"width": 123,
"height": 123,
"duration": 123,
"pages": 123
}
}
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({
type: 'pdf',
name: 'Sales deck',
fileId: 'f9Ghw2n0Ju3D',
description: '<string>',
tagIds: ['RiHO4e0Ju3DS'],
isInternal: false,
url: 'https://example.com/pricing',
customCode: '<iframe src="https://example.com"></iframe>',
metadata: {width: 123, height: 123, duration: 123, pages: 123}
})
};
fetch('https://api.dock.us/{version}/assets', 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}/assets",
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([
'type' => 'pdf',
'name' => 'Sales deck',
'fileId' => 'f9Ghw2n0Ju3D',
'description' => '<string>',
'tagIds' => [
'RiHO4e0Ju3DS'
],
'isInternal' => false,
'url' => 'https://example.com/pricing',
'customCode' => '<iframe src="https://example.com"></iframe>',
'metadata' => [
'width' => 123,
'height' => 123,
'duration' => 123,
'pages' => 123
]
]),
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}/assets"
payload := strings.NewReader("{\n \"type\": \"pdf\",\n \"name\": \"Sales deck\",\n \"fileId\": \"f9Ghw2n0Ju3D\",\n \"description\": \"<string>\",\n \"tagIds\": [\n \"RiHO4e0Ju3DS\"\n ],\n \"isInternal\": false,\n \"url\": \"https://example.com/pricing\",\n \"customCode\": \"<iframe src=\\\"https://example.com\\\"></iframe>\",\n \"metadata\": {\n \"width\": 123,\n \"height\": 123,\n \"duration\": 123,\n \"pages\": 123\n }\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}/assets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"pdf\",\n \"name\": \"Sales deck\",\n \"fileId\": \"f9Ghw2n0Ju3D\",\n \"description\": \"<string>\",\n \"tagIds\": [\n \"RiHO4e0Ju3DS\"\n ],\n \"isInternal\": false,\n \"url\": \"https://example.com/pricing\",\n \"customCode\": \"<iframe src=\\\"https://example.com\\\"></iframe>\",\n \"metadata\": {\n \"width\": 123,\n \"height\": 123,\n \"duration\": 123,\n \"pages\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dock.us/{version}/assets")
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 \"type\": \"pdf\",\n \"name\": \"Sales deck\",\n \"fileId\": \"f9Ghw2n0Ju3D\",\n \"description\": \"<string>\",\n \"tagIds\": [\n \"RiHO4e0Ju3DS\"\n ],\n \"isInternal\": false,\n \"url\": \"https://example.com/pricing\",\n \"customCode\": \"<iframe src=\\\"https://example.com\\\"></iframe>\",\n \"metadata\": {\n \"width\": 123,\n \"height\": 123,\n \"duration\": 123,\n \"pages\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"asset": {
"id": "RiHO4e0Ju3DS",
"updatedAt": "2021-01-01T00:00:00.000Z",
"createdAt": "2021-01-01T00:00:00.000Z",
"tags": [
{
"id": "RiHO4e0Ju3DS",
"updatedAt": "2021-01-01T00:00:00.000Z",
"createdAt": "2021-01-01T00:00:00.000Z",
"object": "tag",
"url": "https://api.dock.us/v1/tags/RiHO4e0Ju3DS",
"title": "Logo"
}
],
"object": "asset",
"url": "https://api.dock.us/v1/assets/RiHO4e0Ju3DS",
"name": "Logo",
"description": "Logo of the asset",
"transcript": "<string>",
"views": 100,
"shares": 100,
"assetType": "image",
"assetUrl": "https://dock.us/logo.png",
"thumbnailUrl": "https://storage.googleapis.com/dock-production-private/thumbnail/RiHO4e0Ju3DS.png?X-Goog-Signature=...",
"isInternal": false
}
}
}{
"error": {
"code": "BAD_REQUEST",
"reason": "NOT_FOUND",
"message": "The request could not be understood or was missing required parameters",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>",
"details": [
{
"field": "body.shareSetting",
"message": "'shareSetting' is required in body"
}
]
}
}{
"error": {
"code": "INVALID_TOKEN",
"reason": "NOT_FOUND",
"message": "Access denied. You are not authorized to access this resource",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}{
"error": {
"code": "FORBIDDEN",
"reason": "NOT_FOUND",
"message": "Access to this resource is restricted",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}{
"error": {
"code": "NOT_FOUND",
"reason": "NOT_FOUND",
"message": "The requested resource could not be found",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"reason": "NOT_FOUND",
"message": "Rate limit exceeded. Please try again later",
"retryable": true,
"retryAfter": 2,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"reason": "NOT_FOUND",
"message": "The server has encountered a situation it does not know how to handle",
"retryable": true,
"requestId": "6f1c2a9e-3b4d-4c5e-8f70-1a2b3c4d5e6f",
"docUrl": "<string>"
}
}403 and nothing is
created.Authorizations
Query Parameters
Select the asset properties that should be returned
name, description, updatedAt, createdAt, views, shares, assetType, assetUrl, isInternal, transcript, thumbnailUrl, tags.title, tags.createdAt, tags.updatedAt, id, object, url, tags.id, tags.object, tags.url Body
Asset to create
- File-backed asset
- Link asset
- Embed asset from a URL
- Embed asset from custom code
Id of an uploaded file (from POST /files). Required for pdf, image, video, audio, docx, ppt, xlsx and htmlPage assets. The file's bytes must already be uploaded, its mimeType must match the asset type, and it can only back one asset.
64"f9Ghw2n0Ju3D"