Upload file
curl --request POST \
--url https://sandbox.tight.com/v6/files/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'data={
"description": "Q1 2024 invoice",
"date": "2024-01-15",
"entityId": "btxn_28868401",
"notes": "Received from vendor on 2024-01-15",
"amount": 15000,
"customData": {
"internal_key": "some_internal_key",
"some_other_field": 23434
}
}'import requests
url = "https://sandbox.tight.com/v6/files/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "data": "{
\"description\": \"Q1 2024 invoice\",
\"date\": \"2024-01-15\",
\"entityId\": \"btxn_28868401\",
\"notes\": \"Received from vendor on 2024-01-15\",
\"amount\": 15000,
\"customData\": {
\"internal_key\": \"some_internal_key\",
\"some_other_field\": 23434
}
}" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('data', '{
"description": "Q1 2024 invoice",
"date": "2024-01-15",
"entityId": "btxn_28868401",
"notes": "Received from vendor on 2024-01-15",
"amount": 15000,
"customData": {
"internal_key": "some_internal_key",
"some_other_field": 23434
}
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://sandbox.tight.com/v6/files/upload', 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://sandbox.tight.com/v6/files/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n{\r\n \"description\": \"Q1 2024 invoice\",\r\n \"date\": \"2024-01-15\",\r\n \"entityId\": \"btxn_28868401\",\r\n \"notes\": \"Received from vendor on 2024-01-15\",\r\n \"amount\": 15000,\r\n \"customData\": {\r\n \"internal_key\": \"some_internal_key\",\r\n \"some_other_field\": 23434\r\n }\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://sandbox.tight.com/v6/files/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n{\r\n \"description\": \"Q1 2024 invoice\",\r\n \"date\": \"2024-01-15\",\r\n \"entityId\": \"btxn_28868401\",\r\n \"notes\": \"Received from vendor on 2024-01-15\",\r\n \"amount\": 15000,\r\n \"customData\": {\r\n \"internal_key\": \"some_internal_key\",\r\n \"some_other_field\": 23434\r\n }\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.tight.com/v6/files/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n{\r\n \"description\": \"Q1 2024 invoice\",\r\n \"date\": \"2024-01-15\",\r\n \"entityId\": \"btxn_28868401\",\r\n \"notes\": \"Received from vendor on 2024-01-15\",\r\n \"amount\": 15000,\r\n \"customData\": {\r\n \"internal_key\": \"some_internal_key\",\r\n \"some_other_field\": 23434\r\n }\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.tight.com/v6/files/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n{\r\n \"description\": \"Q1 2024 invoice\",\r\n \"date\": \"2024-01-15\",\r\n \"entityId\": \"btxn_28868401\",\r\n \"notes\": \"Received from vendor on 2024-01-15\",\r\n \"amount\": 15000,\r\n \"customData\": {\r\n \"internal_key\": \"some_internal_key\",\r\n \"some_other_field\": 23434\r\n }\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": {
"id": "fil_28868401",
"entity": {
"id": "btxn_28868401"
},
"description": "Q1 2024 invoice",
"notes": "Received from vendor on 2024-01-15",
"url": "https://cdn.sandbox.tight.com/files/fil_28868401.pdf",
"date": "2024-01-15",
"amount": 15000,
"status": "ACTIVE",
"customData": {
"internal_key": "some_internal_key",
"some_other_field": 23434
}
}
}{
"result": "FAILURE",
"error": [
{
"type": "REQUIRED",
"message": "Amount is required",
"param": "amount"
}
]
}{
"result": "FAILURE",
"error": [
{
"type": "INVALID_TOKEN",
"message": "Invalid access token"
}
]
}{
"result": "FAILURE",
"error": [
{
"type": "FORBIDDEN",
"message": "Expired access token"
}
]
}{
"result": "FAILURE",
"error": [
{
"type": "BAD_REQUEST",
"message": "Resource not found"
}
]
}{
"result": "FAILURE",
"error": [
{
"type": "UNKNOWN_ERROR",
"message": "Something went wrong. Please try again later."
}
]
}Files
Upload file
Upload a new file
POST
/
v6
/
files
/
upload
Upload file
curl --request POST \
--url https://sandbox.tight.com/v6/files/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'data={
"description": "Q1 2024 invoice",
"date": "2024-01-15",
"entityId": "btxn_28868401",
"notes": "Received from vendor on 2024-01-15",
"amount": 15000,
"customData": {
"internal_key": "some_internal_key",
"some_other_field": 23434
}
}'import requests
url = "https://sandbox.tight.com/v6/files/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "data": "{
\"description\": \"Q1 2024 invoice\",
\"date\": \"2024-01-15\",
\"entityId\": \"btxn_28868401\",
\"notes\": \"Received from vendor on 2024-01-15\",
\"amount\": 15000,
\"customData\": {
\"internal_key\": \"some_internal_key\",
\"some_other_field\": 23434
}
}" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('data', '{
"description": "Q1 2024 invoice",
"date": "2024-01-15",
"entityId": "btxn_28868401",
"notes": "Received from vendor on 2024-01-15",
"amount": 15000,
"customData": {
"internal_key": "some_internal_key",
"some_other_field": 23434
}
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://sandbox.tight.com/v6/files/upload', 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://sandbox.tight.com/v6/files/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n{\r\n \"description\": \"Q1 2024 invoice\",\r\n \"date\": \"2024-01-15\",\r\n \"entityId\": \"btxn_28868401\",\r\n \"notes\": \"Received from vendor on 2024-01-15\",\r\n \"amount\": 15000,\r\n \"customData\": {\r\n \"internal_key\": \"some_internal_key\",\r\n \"some_other_field\": 23434\r\n }\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://sandbox.tight.com/v6/files/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n{\r\n \"description\": \"Q1 2024 invoice\",\r\n \"date\": \"2024-01-15\",\r\n \"entityId\": \"btxn_28868401\",\r\n \"notes\": \"Received from vendor on 2024-01-15\",\r\n \"amount\": 15000,\r\n \"customData\": {\r\n \"internal_key\": \"some_internal_key\",\r\n \"some_other_field\": 23434\r\n }\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.tight.com/v6/files/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n{\r\n \"description\": \"Q1 2024 invoice\",\r\n \"date\": \"2024-01-15\",\r\n \"entityId\": \"btxn_28868401\",\r\n \"notes\": \"Received from vendor on 2024-01-15\",\r\n \"amount\": 15000,\r\n \"customData\": {\r\n \"internal_key\": \"some_internal_key\",\r\n \"some_other_field\": 23434\r\n }\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.tight.com/v6/files/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n{\r\n \"description\": \"Q1 2024 invoice\",\r\n \"date\": \"2024-01-15\",\r\n \"entityId\": \"btxn_28868401\",\r\n \"notes\": \"Received from vendor on 2024-01-15\",\r\n \"amount\": 15000,\r\n \"customData\": {\r\n \"internal_key\": \"some_internal_key\",\r\n \"some_other_field\": 23434\r\n }\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": {
"id": "fil_28868401",
"entity": {
"id": "btxn_28868401"
},
"description": "Q1 2024 invoice",
"notes": "Received from vendor on 2024-01-15",
"url": "https://cdn.sandbox.tight.com/files/fil_28868401.pdf",
"date": "2024-01-15",
"amount": 15000,
"status": "ACTIVE",
"customData": {
"internal_key": "some_internal_key",
"some_other_field": 23434
}
}
}{
"result": "FAILURE",
"error": [
{
"type": "REQUIRED",
"message": "Amount is required",
"param": "amount"
}
]
}{
"result": "FAILURE",
"error": [
{
"type": "INVALID_TOKEN",
"message": "Invalid access token"
}
]
}{
"result": "FAILURE",
"error": [
{
"type": "FORBIDDEN",
"message": "Expired access token"
}
]
}{
"result": "FAILURE",
"error": [
{
"type": "BAD_REQUEST",
"message": "Resource not found"
}
]
}{
"result": "FAILURE",
"error": [
{
"type": "UNKNOWN_ERROR",
"message": "Something went wrong. Please try again later."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, see Authentication for more detail.
⌘I