curl --request POST \
--url https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview \
--header 'Authorization: <api-key>' \
--header 'x-api-key: <api-key>'import requests
url = "https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview"
headers = {
"x-api-key": "<api-key>",
"Authorization": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', Authorization: '<api-key>'}
};
fetch('https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview', 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.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "<api-key>")
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.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview")
.header("x-api-key", "<api-key>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"fileId": "b471682e-fa17-4e46-b7fe-9b2b8fdcb3c2",
"documentVersionId": "0f8fad5b-d9cb-469f-a165-70867728950e",
"downloadUrl": "https://bucket.s3.amazonaws.com/previews/accounts/b471682e-fa17-4e46-b7fe-9b2b8fdcb3c2/documents/0f8fad5b-d9cb-469f-a165-70867728950e?X-Amz-Expires=86400&X-Amz-Signature=...",
"expiry": "2022-04-23T14:30:00Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"errors": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Get or create a preview
Returns a PDF preview of the current version of the specified file, creating it if it does not exist yet.
The 202 response has two shapes:
- Preview already exists: ādownloadUrlā contains a presigned URL to the PDF preview and āexpiryā is its expiry time. The URL is valid for 1 day.
- Preview does not exist yet: a conversion is requested and processed asynchronously; ādownloadUrlā and āexpiryā are null. Poll the āLocationā header (GetPreviewById) until it returns 200.
The preview is always generated as a PDF, regardless of the source file type. Previews are keyed by document version, so uploading a new version of the file produces a new preview.
curl --request POST \
--url https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview \
--header 'Authorization: <api-key>' \
--header 'x-api-key: <api-key>'import requests
url = "https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview"
headers = {
"x-api-key": "<api-key>",
"Authorization": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', Authorization: '<api-key>'}
};
fetch('https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview', 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.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "<api-key>")
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.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview")
.header("x-api-key", "<api-key>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smokeball.com/matters/{matterId}/documents/files/{fileId}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"fileId": "b471682e-fa17-4e46-b7fe-9b2b8fdcb3c2",
"documentVersionId": "0f8fad5b-d9cb-469f-a165-70867728950e",
"downloadUrl": "https://bucket.s3.amazonaws.com/previews/accounts/b471682e-fa17-4e46-b7fe-9b2b8fdcb3c2/documents/0f8fad5b-d9cb-469f-a165-70867728950e?X-Amz-Expires=86400&X-Amz-Signature=...",
"expiry": "2022-04-23T14:30:00Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"errors": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Path Parameters
Unique identifier of the matter to which the file belongs.
Unique identifier of the file.
Response
When the request is accepted. Returns a 'PreviewFileInfo' object, with 'downloadUrl' and 'expiry' populated if the preview already exists and null if conversion is still pending.
Unique identifier of the requested file
"b471682e-fa17-4e46-b7fe-9b2b8fdcb3c2"
Unique identifier of the document version the preview was generated from. Pass this to GetPreviewById.
"0f8fad5b-d9cb-469f-a165-70867728950e"
Temporary presigned URL to download the PDF preview. Valid for 1 day. Null when the preview has not been generated yet (conversion is pending); poll GetPreviewById until it is available.
"https://bucket.s3.amazonaws.com/previews/accounts/b471682e-fa17-4e46-b7fe-9b2b8fdcb3c2/documents/0f8fad5b-d9cb-469f-a165-70867728950e?X-Amz-Expires=86400&X-Amz-Signature=..."
Expiry date/time (UTC) after which the download link is no longer accessible. Null when the preview has not been generated yet (conversion is pending).
"2022-04-23T14:30:00Z"