Create a template upload
curl --request POST \
--url https://api.spacebring.com/contracts/templates/v1/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"media": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"size": 26214400
}
}
'import requests
url = "https://api.spacebring.com/contracts/templates/v1/media"
payload = { "media": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"size": 26214400
} }
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({
media: {
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
size: 26214400
}
})
};
fetch('https://api.spacebring.com/contracts/templates/v1/media', 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.spacebring.com/contracts/templates/v1/media",
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([
'media' => [
'mimeType' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'size' => 26214400
]
]),
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.spacebring.com/contracts/templates/v1/media"
payload := strings.NewReader("{\n \"media\": {\n \"mimeType\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"size\": 26214400\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.spacebring.com/contracts/templates/v1/media")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"media\": {\n \"mimeType\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"size\": 26214400\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spacebring.com/contracts/templates/v1/media")
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 \"media\": {\n \"mimeType\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"size\": 26214400\n }\n}"
response = http.request(request)
puts response.read_body{
"media": {
"key": "<string>",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"size": 0,
"status": "pending",
"upload": {
"expirationDate": "2023-11-07T05:31:56Z",
"headers": {
"Content-Length": "<string>",
"Content-Type": "<string>"
},
"method": "PUT",
"url": "<string>"
},
"url": "<string>"
}
}{
"message": "<string>",
"type": "<string>"
}Contracts
Create a template upload
Create a media upload for a contract template file, a .docx document of up to 50 MB. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, pass the returned key as template.file.key when creating or updating a template within an hour; a file that is not attached by then is discarded.
OAuth
Required scopes:invoicesPOST
/
contracts
/
templates
/
v1
/
media
Create a template upload
curl --request POST \
--url https://api.spacebring.com/contracts/templates/v1/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"media": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"size": 26214400
}
}
'import requests
url = "https://api.spacebring.com/contracts/templates/v1/media"
payload = { "media": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"size": 26214400
} }
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({
media: {
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
size: 26214400
}
})
};
fetch('https://api.spacebring.com/contracts/templates/v1/media', 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.spacebring.com/contracts/templates/v1/media",
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([
'media' => [
'mimeType' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'size' => 26214400
]
]),
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.spacebring.com/contracts/templates/v1/media"
payload := strings.NewReader("{\n \"media\": {\n \"mimeType\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"size\": 26214400\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.spacebring.com/contracts/templates/v1/media")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"media\": {\n \"mimeType\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"size\": 26214400\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spacebring.com/contracts/templates/v1/media")
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 \"media\": {\n \"mimeType\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"size\": 26214400\n }\n}"
response = http.request(request)
puts response.read_body{
"media": {
"key": "<string>",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"size": 0,
"status": "pending",
"upload": {
"expirationDate": "2023-11-07T05:31:56Z",
"headers": {
"Content-Length": "<string>",
"Content-Type": "<string>"
},
"method": "PUT",
"url": "<string>"
},
"url": "<string>"
}
}{
"message": "<string>",
"type": "<string>"
}Authorizations
See our authentication documentation for how to authorize your requests
Headers
The id of the network. Required when using bearer token authentication
Body
application/json
File to upload.
Show child attributes
Show child attributes
Response
Created
The created media upload.
Show child attributes
Show child attributes
Was this page helpful?