Documents
Upload documents for a Business
Scopes: document:create
POST
/
v0
/
business
/
{business_id}
/
document
Upload documents for a Business
curl --request POST \
--url https://api.sandbox.getasset.com/v0/business/{business_id}/document \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files=<string>' \
--form 'task_id=<string>' \
--form 'entity_ids=<string>' \
--form files.items='@example-file'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/document"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = {
"files": "<string>",
"task_id": "<string>",
"entity_ids": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('task_id', '<string>');
form.append('entity_ids', '<string>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/document', 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.sandbox.getasset.com/v0/business/{business_id}/document",
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=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity_ids\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\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://api.sandbox.getasset.com/v0/business/{business_id}/document"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity_ids\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\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://api.sandbox.getasset.com/v0/business/{business_id}/document")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity_ids\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/business/{business_id}/document")
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=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity_ids\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": {
"business_id": "biz_R2fAXCjqJPdpYata112zyW",
"name": "receipt.pdf",
"description": "Receipt",
"document_type": "receipt",
"file_size": 1024,
"status": "processing",
"external_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"id": "doc_R2fAXCjqJPdpYata112zyW",
"created_at": "2023-11-07T05:31:56Z",
"task_id": "tsk_R2fAXCjqJPdpYata112zyW",
"source": "manual_upload",
"external_id": "gusto-payroll-abc123",
"metadata_": {},
"journal_entry_ids": "je_R2fAXCjqJPdpYata112zyW",
"external_account_ids": "eac_R2fAXCjqJPdpYata112zyW",
"transaction_ids": "txn_R2fAXCjqJPdpYata112zyW",
"status_reason": "<string>",
"failure_code": "<string>",
"bill_id": "bil_R2fAXCjqJPdpYata112zyW",
"invoice_id": "inv_R2fAXCjqJPdpYata112zyW"
}
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
The id of the business
Example:
"biz_GA6EG2qFxA97NZHtxeLPUy"
Body
multipart/form-data
Document files. 5MB each, max 12 files.
The ID of the associated task
The type of document being created.
Available options:
receipt, statement, other, payroll, bill, mileage, invoice entity_ids
(string<eac_string> | string<txn_string> | string<je_string> | string<bil_string> | string<inv_string>)[] | null
Optional list of entity ids to associate with the document. Only external accounts, transactions, and journal entries are supported.
Maximum array length:
100Response
Successful Response
- DocumentPublic
- DocumentUploadResponse
Show child attributes
Show child attributes
⌘I
Upload documents for a Business
curl --request POST \
--url https://api.sandbox.getasset.com/v0/business/{business_id}/document \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files=<string>' \
--form 'task_id=<string>' \
--form 'entity_ids=<string>' \
--form files.items='@example-file'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/document"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = {
"files": "<string>",
"task_id": "<string>",
"entity_ids": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('task_id', '<string>');
form.append('entity_ids', '<string>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/document', 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.sandbox.getasset.com/v0/business/{business_id}/document",
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=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity_ids\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\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://api.sandbox.getasset.com/v0/business/{business_id}/document"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity_ids\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\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://api.sandbox.getasset.com/v0/business/{business_id}/document")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity_ids\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/business/{business_id}/document")
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=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity_ids\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": {
"business_id": "biz_R2fAXCjqJPdpYata112zyW",
"name": "receipt.pdf",
"description": "Receipt",
"document_type": "receipt",
"file_size": 1024,
"status": "processing",
"external_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"id": "doc_R2fAXCjqJPdpYata112zyW",
"created_at": "2023-11-07T05:31:56Z",
"task_id": "tsk_R2fAXCjqJPdpYata112zyW",
"source": "manual_upload",
"external_id": "gusto-payroll-abc123",
"metadata_": {},
"journal_entry_ids": "je_R2fAXCjqJPdpYata112zyW",
"external_account_ids": "eac_R2fAXCjqJPdpYata112zyW",
"transaction_ids": "txn_R2fAXCjqJPdpYata112zyW",
"status_reason": "<string>",
"failure_code": "<string>",
"bill_id": "bil_R2fAXCjqJPdpYata112zyW",
"invoice_id": "inv_R2fAXCjqJPdpYata112zyW"
}
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}