Invoice Supporting Document Upload API
curl --request POST \
--url https://api.pazy.io/v1.0/invoice/:invoiceId/supporting-documentsimport requests
url = "https://api.pazy.io/v1.0/invoice/:invoiceId/supporting-documents"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.pazy.io/v1.0/invoice/:invoiceId/supporting-documents', 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.pazy.io/v1.0/invoice/:invoiceId/supporting-documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.pazy.io/v1.0/invoice/:invoiceId/supporting-documents"
req, _ := http.NewRequest("POST", url, nil)
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.pazy.io/v1.0/invoice/:invoiceId/supporting-documents")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pazy.io/v1.0/invoice/:invoiceId/supporting-documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyInvoice APIs
Invoice Supporting Document Upload API
Upload one or more supporting documents against an existing invoice
Invoice Supporting Document Upload API
curl --request POST \
--url https://api.pazy.io/v1.0/invoice/:invoiceId/supporting-documentsimport requests
url = "https://api.pazy.io/v1.0/invoice/:invoiceId/supporting-documents"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.pazy.io/v1.0/invoice/:invoiceId/supporting-documents', 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.pazy.io/v1.0/invoice/:invoiceId/supporting-documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.pazy.io/v1.0/invoice/:invoiceId/supporting-documents"
req, _ := http.NewRequest("POST", url, nil)
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.pazy.io/v1.0/invoice/:invoiceId/supporting-documents")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pazy.io/v1.0/invoice/:invoiceId/supporting-documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyAuthentication
All requests require an API key in the request headers. Headers:Authorization: Api-Key YOUR_API_KEY
Content-Type: multipart/form-data
Request
Content-Type:multipart/form-data
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
invoiceId | string | Yes | Unique identifier of the invoice to attach documents to |
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
files | file | Yes | The file(s) to upload. Repeat the field name to upload multiple files in a single request. Max file size 50 MB per file. |
Code Examples
curl -X POST https://api.pazy.io/v1.0/invoice/<invoiceId>/supporting-documents \
-H "Authorization: Api-Key YOUR_API_KEY" \
-F "files=@/path/to/receipt.pdf"
const formData = new FormData();
formData.append('files', fileInput.files[0]);
const response = await fetch('https://api.pazy.io/v1.0/invoice/<invoiceId>/supporting-documents', {
method: 'POST',
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
},
body: formData
});
const result = await response.json();
import requests
url = "https://api.pazy.io/v1.0/invoice/<invoiceId>/supporting-documents"
headers = { "Authorization": "Api-Key YOUR_API_KEY" }
with open("/path/to/receipt.pdf", "rb") as f:
files = { "files": f }
response = requests.post(url, headers=headers, files=files)
result = response.json()
Success Response
HTTP Status:200 OK
Response Fields:
| Field | Type | Description |
|---|---|---|
ok | boolean | Indicates whether the request was successful |
insert | boolean | Indicates that the documents were inserted against the invoice |
context | object | Container for upload metadata |
context.fileUploaded | number | Number of files that were successfully uploaded in this request |
Response Example
{
"ok": true,
"insert": true,
"context": {
"fileUploaded": 1
}
}
Error Responses
Missing File
HTTP Status:400 Bad Request
{
"ok": false,
"error": {
"code": "MISSING_REQUIRED_FIELD",
"message": "Files field is required"
}
}
Invoice Not Found
HTTP Status:404 Not Found
{
"ok": false,
"error": {
"code": "INVOICE_NOT_FOUND",
"message": "Invoice not found"
}
}
Access Denied
HTTP Status:403 Forbidden
{
"ok": false,
"error": {
"code": "ACCESS_DENIED",
"message": "Access denied: You can only view your own invoices or invoices where you are the vendor owner"
}
}
Authentication Errors
HTTP Status:401 Unauthorized
{
"ok": false,
"error": {
"code": "MISSING_CREDENTIALS",
"message": "Missing Credentials"
}
}
{
"ok": false,
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API Key"
}
}
Permission Errors
HTTP Status:403 Forbidden
{
"ok": false,
"error": {
"code": "INSUFFICIENT_PERMISSIONS",
"message": "Permission check failed - PERMISSION_CHECK_FAILED"
}
}
Internal Error
HTTP Status:500 Internal Server Error
{
"ok": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "Internal error"
}
}
Best Practices
- Repeat the
filesfield name to upload multiple documents in a single call — they are saved as separate supporting documents - Use the Invoice Supporting Documents API to list the documents already attached to an invoice
- Each file is capped at 50 MB; split larger files before uploading
- Supporting documents are stored separately from the original invoice file uploaded via the Invoice Creation API
Was this page helpful?