Preview template
curl --request POST \
--url https://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview \
--header 'Content-Type: application/json' \
--header 'X-Preferred-Language: <x-preferred-language>' \
--header 'x-admin-api-key: <x-admin-api-key>' \
--data '
{
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"previewData": {
"invoiceNumber": "INV-2023-001",
"description": "Monthly subscription fee",
"amount": 99.99,
"currency": "USD",
"planName": "Premium Plan",
"customerName": "John Doe",
"customerEmail": "john.doe@example.com",
"startDate": "2023-01-01T00:00:00Z",
"renewalDate": "2023-02-01T00:00:00Z",
"paymentTerms": 30
}
}
'import requests
url = "https://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview"
payload = {
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"previewData": {
"invoiceNumber": "INV-2023-001",
"description": "Monthly subscription fee",
"amount": 99.99,
"currency": "USD",
"planName": "Premium Plan",
"customerName": "John Doe",
"customerEmail": "john.doe@example.com",
"startDate": "2023-01-01T00:00:00Z",
"renewalDate": "2023-02-01T00:00:00Z",
"paymentTerms": 30
}
}
headers = {
"x-admin-api-key": "<x-admin-api-key>",
"X-Preferred-Language": "<x-preferred-language>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-admin-api-key': '<x-admin-api-key>',
'X-Preferred-Language': '<x-preferred-language>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
templateId: '550e8400-e29b-41d4-a716-446655440000',
previewData: {
invoiceNumber: 'INV-2023-001',
description: 'Monthly subscription fee',
amount: 99.99,
currency: 'USD',
planName: 'Premium Plan',
customerName: 'John Doe',
customerEmail: 'john.doe@example.com',
startDate: '2023-01-01T00:00:00Z',
renewalDate: '2023-02-01T00:00:00Z',
paymentTerms: 30
}
})
};
fetch('https://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview', 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://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview",
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([
'templateId' => '550e8400-e29b-41d4-a716-446655440000',
'previewData' => [
'invoiceNumber' => 'INV-2023-001',
'description' => 'Monthly subscription fee',
'amount' => 99.99,
'currency' => 'USD',
'planName' => 'Premium Plan',
'customerName' => 'John Doe',
'customerEmail' => 'john.doe@example.com',
'startDate' => '2023-01-01T00:00:00Z',
'renewalDate' => '2023-02-01T00:00:00Z',
'paymentTerms' => 30
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Preferred-Language: <x-preferred-language>",
"x-admin-api-key: <x-admin-api-key>"
],
]);
$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://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview"
payload := strings.NewReader("{\n \"templateId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"previewData\": {\n \"invoiceNumber\": \"INV-2023-001\",\n \"description\": \"Monthly subscription fee\",\n \"amount\": 99.99,\n \"currency\": \"USD\",\n \"planName\": \"Premium Plan\",\n \"customerName\": \"John Doe\",\n \"customerEmail\": \"john.doe@example.com\",\n \"startDate\": \"2023-01-01T00:00:00Z\",\n \"renewalDate\": \"2023-02-01T00:00:00Z\",\n \"paymentTerms\": 30\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-admin-api-key", "<x-admin-api-key>")
req.Header.Add("X-Preferred-Language", "<x-preferred-language>")
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://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview")
.header("x-admin-api-key", "<x-admin-api-key>")
.header("X-Preferred-Language", "<x-preferred-language>")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"previewData\": {\n \"invoiceNumber\": \"INV-2023-001\",\n \"description\": \"Monthly subscription fee\",\n \"amount\": 99.99,\n \"currency\": \"USD\",\n \"planName\": \"Premium Plan\",\n \"customerName\": \"John Doe\",\n \"customerEmail\": \"john.doe@example.com\",\n \"startDate\": \"2023-01-01T00:00:00Z\",\n \"renewalDate\": \"2023-02-01T00:00:00Z\",\n \"paymentTerms\": 30\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-admin-api-key"] = '<x-admin-api-key>'
request["X-Preferred-Language"] = '<x-preferred-language>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"templateId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"previewData\": {\n \"invoiceNumber\": \"INV-2023-001\",\n \"description\": \"Monthly subscription fee\",\n \"amount\": 99.99,\n \"currency\": \"USD\",\n \"planName\": \"Premium Plan\",\n \"customerName\": \"John Doe\",\n \"customerEmail\": \"john.doe@example.com\",\n \"startDate\": \"2023-01-01T00:00:00Z\",\n \"renewalDate\": \"2023-02-01T00:00:00Z\",\n \"paymentTerms\": 30\n }\n}"
response = http.request(request)
puts response.read_body"<string>"Invoice Templates
Preview template
Generates a preview of an invoice template with customizable data.
- Uses template ID to get layout and components
- Accepts optional preview data to customize all aspects of the preview
- Returns PDF buffer of preview invoice
POST
/
api
/
v1
/
invoices-templates
/
preview
Preview template
curl --request POST \
--url https://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview \
--header 'Content-Type: application/json' \
--header 'X-Preferred-Language: <x-preferred-language>' \
--header 'x-admin-api-key: <x-admin-api-key>' \
--data '
{
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"previewData": {
"invoiceNumber": "INV-2023-001",
"description": "Monthly subscription fee",
"amount": 99.99,
"currency": "USD",
"planName": "Premium Plan",
"customerName": "John Doe",
"customerEmail": "john.doe@example.com",
"startDate": "2023-01-01T00:00:00Z",
"renewalDate": "2023-02-01T00:00:00Z",
"paymentTerms": 30
}
}
'import requests
url = "https://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview"
payload = {
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"previewData": {
"invoiceNumber": "INV-2023-001",
"description": "Monthly subscription fee",
"amount": 99.99,
"currency": "USD",
"planName": "Premium Plan",
"customerName": "John Doe",
"customerEmail": "john.doe@example.com",
"startDate": "2023-01-01T00:00:00Z",
"renewalDate": "2023-02-01T00:00:00Z",
"paymentTerms": 30
}
}
headers = {
"x-admin-api-key": "<x-admin-api-key>",
"X-Preferred-Language": "<x-preferred-language>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-admin-api-key': '<x-admin-api-key>',
'X-Preferred-Language': '<x-preferred-language>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
templateId: '550e8400-e29b-41d4-a716-446655440000',
previewData: {
invoiceNumber: 'INV-2023-001',
description: 'Monthly subscription fee',
amount: 99.99,
currency: 'USD',
planName: 'Premium Plan',
customerName: 'John Doe',
customerEmail: 'john.doe@example.com',
startDate: '2023-01-01T00:00:00Z',
renewalDate: '2023-02-01T00:00:00Z',
paymentTerms: 30
}
})
};
fetch('https://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview', 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://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview",
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([
'templateId' => '550e8400-e29b-41d4-a716-446655440000',
'previewData' => [
'invoiceNumber' => 'INV-2023-001',
'description' => 'Monthly subscription fee',
'amount' => 99.99,
'currency' => 'USD',
'planName' => 'Premium Plan',
'customerName' => 'John Doe',
'customerEmail' => 'john.doe@example.com',
'startDate' => '2023-01-01T00:00:00Z',
'renewalDate' => '2023-02-01T00:00:00Z',
'paymentTerms' => 30
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Preferred-Language: <x-preferred-language>",
"x-admin-api-key: <x-admin-api-key>"
],
]);
$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://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview"
payload := strings.NewReader("{\n \"templateId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"previewData\": {\n \"invoiceNumber\": \"INV-2023-001\",\n \"description\": \"Monthly subscription fee\",\n \"amount\": 99.99,\n \"currency\": \"USD\",\n \"planName\": \"Premium Plan\",\n \"customerName\": \"John Doe\",\n \"customerEmail\": \"john.doe@example.com\",\n \"startDate\": \"2023-01-01T00:00:00Z\",\n \"renewalDate\": \"2023-02-01T00:00:00Z\",\n \"paymentTerms\": 30\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-admin-api-key", "<x-admin-api-key>")
req.Header.Add("X-Preferred-Language", "<x-preferred-language>")
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://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview")
.header("x-admin-api-key", "<x-admin-api-key>")
.header("X-Preferred-Language", "<x-preferred-language>")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"previewData\": {\n \"invoiceNumber\": \"INV-2023-001\",\n \"description\": \"Monthly subscription fee\",\n \"amount\": 99.99,\n \"currency\": \"USD\",\n \"planName\": \"Premium Plan\",\n \"customerName\": \"John Doe\",\n \"customerEmail\": \"john.doe@example.com\",\n \"startDate\": \"2023-01-01T00:00:00Z\",\n \"renewalDate\": \"2023-02-01T00:00:00Z\",\n \"paymentTerms\": 30\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev-billing-api.iqraa.ai/api/v1/api/v1/invoices-templates/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-admin-api-key"] = '<x-admin-api-key>'
request["X-Preferred-Language"] = '<x-preferred-language>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"templateId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"previewData\": {\n \"invoiceNumber\": \"INV-2023-001\",\n \"description\": \"Monthly subscription fee\",\n \"amount\": 99.99,\n \"currency\": \"USD\",\n \"planName\": \"Premium Plan\",\n \"customerName\": \"John Doe\",\n \"customerEmail\": \"john.doe@example.com\",\n \"startDate\": \"2023-01-01T00:00:00Z\",\n \"renewalDate\": \"2023-02-01T00:00:00Z\",\n \"paymentTerms\": 30\n }\n}"
response = http.request(request)
puts response.read_body"<string>"Headers
The API key to access the admin API
Language for the PDF preview
Available options:
ar, en Body
application/json
Template ID and optional preview data for customization
Response
Template preview generated successfully
PDF buffer of the preview invoice
⌘I