curl --request POST \
--url https://api.pdf.co/v1/pdf/convert/to/e-invoice \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf",
"xml_url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml",
"profile": "facturx"
}
'import requests
url = "https://api.pdf.co/v1/pdf/convert/to/e-invoice"
payload = {
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf",
"xml_url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml",
"profile": "facturx"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf',
xml_url: 'https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml',
profile: 'facturx'
})
};
fetch('https://api.pdf.co/v1/pdf/convert/to/e-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.pdf.co/v1/pdf/convert/to/e-invoice",
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([
'url' => 'https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf',
'xml_url' => 'https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml',
'profile' => 'facturx'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://api.pdf.co/v1/pdf/convert/to/e-invoice"
payload := strings.NewReader("{\n \"url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf\",\n \"xml_url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml\",\n \"profile\": \"facturx\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://api.pdf.co/v1/pdf/convert/to/e-invoice")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf\",\n \"xml_url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml\",\n \"profile\": \"facturx\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdf.co/v1/pdf/convert/to/e-invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf\",\n \"xml_url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml\",\n \"profile\": \"facturx\"\n}"
response = http.request(request)
puts response.read_body{
"pageCount": 1,
"error": false,
"status": 200,
"duration": 120,
"jobId": "EXAMPLEJOBID0123456789ABCDEFGHIJ--167-300",
"credits": 100,
"remainingCredits": 9900
}{
"errorCode": 400,
"error": true,
"message": "Bad request. Typically due to bad input parameters or unreachable input URLs (e.g., access restrictions like login or password)."
}{
"status": "error",
"errorCode": 401,
"error": true,
"message": "Unauthorized. Authentication is required and has failed or has not yet been provided."
}{
"status": "error",
"errorCode": 402,
"error": true,
"message": "Not enough credits."
}{
"status": "error",
"errorCode": 403,
"error": true,
"message": "Access forbidden for input URL."
}{
"errorCode": 404,
"error": true,
"message": "The requested resource could not be found."
}{
"error": true,
"message": "Too many requests in a given time period."
}{
"errorCode": 500,
"error": true,
"message": "Something went wrong. Please try again or contact support."
}PDF to E-Invoice (API Tester)
Submit a PDF and invoice XML for asynchronous embedding and validation.
curl --request POST \
--url https://api.pdf.co/v1/pdf/convert/to/e-invoice \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf",
"xml_url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml",
"profile": "facturx"
}
'import requests
url = "https://api.pdf.co/v1/pdf/convert/to/e-invoice"
payload = {
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf",
"xml_url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml",
"profile": "facturx"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf',
xml_url: 'https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml',
profile: 'facturx'
})
};
fetch('https://api.pdf.co/v1/pdf/convert/to/e-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.pdf.co/v1/pdf/convert/to/e-invoice",
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([
'url' => 'https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf',
'xml_url' => 'https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml',
'profile' => 'facturx'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://api.pdf.co/v1/pdf/convert/to/e-invoice"
payload := strings.NewReader("{\n \"url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf\",\n \"xml_url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml\",\n \"profile\": \"facturx\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://api.pdf.co/v1/pdf/convert/to/e-invoice")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf\",\n \"xml_url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml\",\n \"profile\": \"facturx\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdf.co/v1/pdf/convert/to/e-invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample.pdf\",\n \"xml_url\": \"https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-e-invoice/sample-document-services-invoice.xml\",\n \"profile\": \"facturx\"\n}"
response = http.request(request)
puts response.read_body{
"pageCount": 1,
"error": false,
"status": 200,
"duration": 120,
"jobId": "EXAMPLEJOBID0123456789ABCDEFGHIJ--167-300",
"credits": 100,
"remainingCredits": 9900
}{
"errorCode": 400,
"error": true,
"message": "Bad request. Typically due to bad input parameters or unreachable input URLs (e.g., access restrictions like login or password)."
}{
"status": "error",
"errorCode": 401,
"error": true,
"message": "Unauthorized. Authentication is required and has failed or has not yet been provided."
}{
"status": "error",
"errorCode": 402,
"error": true,
"message": "Not enough credits."
}{
"status": "error",
"errorCode": 403,
"error": true,
"message": "Access forbidden for input URL."
}{
"errorCode": 404,
"error": true,
"message": "The requested resource could not be found."
}{
"error": true,
"message": "Too many requests in a given time period."
}{
"errorCode": 500,
"error": true,
"message": "Something went wrong. Please try again or contact support."
}Authorizations
Body
Source PDF URL accessible to PDF.co. Encrypted and digitally signed PDFs are not supported.
Supported invoice XML formats: Factur-X or ZUGFeRD.
Provide the URL of your XML file as the value. Use a public or temporary presigned XML URL. The source PDF HTTP credentials do not apply to this URL. XML is limited to 5 MiB and must be a supported CrossIndustryInvoice document without DTD or entity declarations. Malformed XML, missing or duplicate guideline identifiers, and unsupported profiles are rejected. The XML determines the detailed profile, conformance level, and canonical embedded filename.
profile selects the invoice family. It is distinct from the profiles configuration parameter used by other endpoints.
Expected invoice family. Detailed conformance and embedded filename are derived from supported XML guideline identifiers.
facturx, zugferd HTTP authentication username for the source PDF URL only. Does not unlock PDF encryption.
HTTP authentication password for the source PDF URL only. Does not apply to xml_url.
Callback URL for the asynchronous terminal result.
Output file name. The endpoint appends .pdf when needed. If omitted, it derives the name from url when possible.
Number of minutes before the temporary output URL expires. After this period, generated files are deleted from PDF.co Temporary Files Storage. The maximum retention depends on your subscription plan. To store permanent input files (e.g. re-usable images, pdf templates, documents) consider using PDF.co Built-In Files Storage.
Response
Job accepted. No converted PDF or report URL is available yet. Poll /v1/job/check or use a callback.
Always 1 in the submission response, even for multi-page PDFs. This value is a submission placeholder and does not represent the actual number of pages in the output PDF. The actual output page count is returned in the final job-check or callback result.
Numeric submission HTTP status, not the string background job status.
Use as jobid in POST /v1/job/check.
100 processing credits for the asynchronous submission, regardless of page count.
Was this page helpful?