Invoice Creation API
curl --request POST \
--url https://api.pazy.io/v1.0/invoiceimport requests
url = "https://api.pazy.io/v1.0/invoice"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.pazy.io/v1.0/invoice', 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",
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"
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")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pazy.io/v1.0/invoice")
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 Creation API
Create invoices by uploading invoice files (PDF or images) for processing
Invoice Creation API
curl --request POST \
--url https://api.pazy.io/v1.0/invoiceimport requests
url = "https://api.pazy.io/v1.0/invoice"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.pazy.io/v1.0/invoice', 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",
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"
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")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pazy.io/v1.0/invoice")
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
Request
Content-Type:multipart/form-data
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The invoice file to upload. Supported formats: PDF, JPEG, JPG, PNG |
remarks | String or Object | No | Optional remarks/notes for the invoice. Can be provided as a string value directly, or as an object with a value property containing the remarks string |
File Requirements
- Maximum file size: 50 MB
- Supported formats: PDF (application/pdf), JPEG (image/jpeg), JPG (image/jpg), PNG (image/png)
- The file should contain a readable invoice document
Code Examples
curl -X POST https://api.pazy.io/v1.0/invoice \
-H "Authorization: Api-Key YOUR_API_KEY" \
-F "file=@/path/to/invoice.pdf" \
-F "remarks=Payment due in 30 days"
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('remarks', 'Payment due in 30 days'); // Optional
const response = await fetch('https://api.pazy.io/v1.0/invoice', {
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"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
files = {
'file': ('invoice.pdf', open('/path/to/invoice.pdf', 'rb'), 'application/pdf')
}
data = {
'remarks': 'Payment due in 30 days' # Optional
}
response = requests.post(url, headers=headers, files=files, data=data)
result = response.json()
Success Response
HTTP Status:200 OK
Response Fields:
| Field | Type | Description |
|---|---|---|
ok | boolean | Indicates whether the request was successful |
data | object | Contains the invoice creation response data |
data.id | string | Unique identifier for the invoice. Use this ID to retrieve invoice details later |
data.status | string | Current processing status. Possible values: PROCESSING, QUEUED |
data.processingId | string | Identifier for the processing job. Used for tracking invoice processing status |
data.isReady | boolean | Indicates whether the invoice is ready for use. Initially false as the invoice is being processed |
Response Example
{
"ok": true,
"data": {
"id": "invoice_identifier",
"status": "PROCESSING",
"processingId": "job_123456",
"isReady": false
}
}
Status Values
- PROCESSING: The invoice is currently being processed and parsed
- QUEUED: The invoice has been queued for processing
After successful upload, the invoice will be processed asynchronously. Use the returned
id to check the invoice status and retrieve details once processing is complete.Error Responses
Missing File
HTTP Status:400 Bad Request
{
"ok": false,
"error": {
"code": "MISSING_REQUIRED_FIELD",
"message": "File is required"
}
}
Invalid File Type
HTTP Status:400 Bad Request
{
"ok": false,
"error": {
"code": "INVALID_FILE_TYPE",
"message": "Invalid file type. Only PDF, JPEG, JPG, and PNG files are allowed"
}
}
File Too Large
HTTP Status:413 Payload Too Large (or 400 Bad Request)
{
"ok": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed: fileSize: File size exceeds maximum allowed size"
}
}
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"
}
}
Processing Errors
HTTP Status:500 Internal Server Error
{
"ok": false,
"error": {
"code": "INVOICE_CREATION_FAILED",
"message": "Failed to create invoice"
}
}
Best Practices
File Uploads
- Verify file size before upload (max 50 MB)
- Ensure file format is supported (PDF, JPEG, JPG, PNG)
- Use appropriate MIME types when setting Content-Type headers
- Handle upload errors gracefully with retry logic
Invoice Processing
- Store the returned
idfor future reference - Poll the invoice status using the invoice detail endpoint
- Wait for
isReadyto becometruebefore using the invoice data - The
statusfield will indicate if the invoice is still being processed
Was this page helpful?