API Reference
The aPDF.io API is an easy to use REST-based API. All requests are securely transmitted over HTTPS.
All responses from the API will be formatted as JSON.
For simplicity, all endpoints use the POST request method.
The base URL for all API endpoints is:
The API token should be included in the request as a bearer token value.
For simplicity, all endpoints use the POST request method.
The base URL for all API endpoints is:
Base URL
https://apdf.io/api
Authentication
The aPDF.io API uses API tokens to authenticate requests. You can view and manage your API tokens in your account.The API token should be included in the request as a bearer token value.
Authentication
curl https://apdf.io/api \
-H "Authorization: Bearer TOKEN"
Headers
Make sure you have the following content type headers are set on every request:Headers
Accept: application/json
Content-Type: application/json
Limitations
To ensure smooth and reliable API operation for all users, a few usage limitations are in place:- Each API token is limited to a maximum of 20 requests per second
- Generated PDF files are stored for 60 min. before being automatically deleted
- Uploaded PDF files must not exceed 100 MB in size
pdf/file/create
Create a PDF from HTML
Parameters
| Parameter | Required | Description |
|---|---|---|
| html | yes | HTML to be converted to a PDF document |
| scale | no | Scale factor of the document. Valid values: 0.1 - 2 |
| format | no | Format of the document. Valid values: letter, legal, tabloid, ledger, a0, a1, a2, a3, a4, a5, a6 |
| unit | no | Unit of the document. Valid values: px, in, cm, mm |
| width | no | Width of the document in mm or in the given unit |
| height | no | Height of the document in mm or in the given unit |
| orientation | no | Orientation of the document. Valid values: portrait, landscape |
| margin_top | no | Top margin of the document in mm or in the given unit |
| margin_right | no | Right margin of the document in mm or in the given unit |
| margin_bottom | no | Bottom margin of the document in mm or in the given unit |
| margin_left | no | Left margin of the document in mm or in the given unit |
| header | no | Header HTML to be used for the header on all pages |
| footer | no | Footer HTML to be used for the footer on all pages |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/file/create \
-H "Authorization: Bearer TOKEN" \
-d html="<html><body><h1>Hello World!</h1></body></html>"
const data = new FormData();
data.append('html', '<html><body><h1>Hello World!</h1></body></html>');
fetch('https://apdf.io/api/pdf/file/create', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/file/create', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'html' => '<html><body><h1>Hello World!</h1></body></html>'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/file/create',
{
'html' => '<html><body><h1>Hello World!</h1></body></html>'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/file/create',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'html': '<html><body><h1>Hello World!</h1></body></html>'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"html": "<html><body><h1>Hello World!</h1></body></html>"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/file/create")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("html", "<html><body><h1>Hello World!</h1></body></html>")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/file/create")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/6f1674e2703953aa.pdf",
"expiration": "2024-12-02T22:30:54.450552Z",
"pages": 1,
"size": 11838
}
pdf/file/split
Split a PDF into multiple PDF files
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| pages | yes | Pages at which the PDF will be split, examples: 1,2-3,4-z = 3 PDFs with page 1, page 2 and 3, and page 4 to the end n3 = every 3 pages a new PDF file 1-r2,z = 2 PDFs with page 1 to the penultimate page, and the last page |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/file/split \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d pages="1-3,4,5-z"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('pages', '1-3,4,5-z');
fetch('https://apdf.io/api/pdf/file/split', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/file/split', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'pages' => '1-3,4,5-z'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/file/split',
{
'file' => 'FILE_URL',
'pages' => '1-3,4,5-z'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/file/split',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'pages': '1-3,4,5-z'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"pages": "1-3,4,5-z"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/file/split")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("pages", "1-3,4,5-z")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/file/split")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
[
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/191674e262f952ca-1-3.pdf",
"expiration": "2024-12-02T22:27:11.610806Z",
"pages": 3,
"size": 390102
},
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/191674e262f952ca-4.pdf",
"expiration": "2024-12-02T22:27:11.610806Z",
"pages": 1,
"size": 241161
},
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/191674e262f952ca-5-z.pdf",
"expiration": "2024-12-02T22:27:11.610806Z",
"pages": 6,
"size": 570713
}
]
pdf/file/merge
Merge multiple PDF files into one file
Parameters
| Parameter | Required | Description |
|---|---|---|
| files[] | yes | Array of the PDF files to merge and their options |
| files[i][file] | yes | URL of the PDF file |
| files[i][pages] | no | Pages to be used for merging, examples: 1,6,4 = pages 1, 6, and 4 in that order 3-7 = pages 3 through 7 in increasing order 2,6-z = page 2 and 6 to the end r3-r1 = the last three pages |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/file/merge \
-H "Authorization: Bearer TOKEN" \
-d files[0][file]="FILE_1_URL" \
-d files[0][pages]="1,5-z" \
-d files[1][file]="FILE_2_URL"
const data = new FormData();
data.append('files[0][file]', 'FILE_1_URL');
data.append('files[0][pages]', '1,5-z');
data.append('files[1][file]', 'FILE_2_URL');
fetch('https://apdf.io/api/pdf/file/merge', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/file/merge', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'files[0][file]' => 'FILE_1_URL',
'files[0][pages]' => '1,5-z',
'files[1][file]' => 'FILE_2_URL'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/file/merge',
{
'files[0][file]' => 'FILE_1_URL',
'files[0][pages]' => '1,5-z',
'files[1][file]' => 'FILE_2_URL'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/file/merge',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'files[0][file]': 'FILE_1_URL',
'files[0][pages]': '1,5-z',
'files[1][file]': 'FILE_2_URL'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"files[0][file]": "FILE_1_URL",
"files[0][pages]": "1,5-z",
"files[1][file]": "FILE_2_URL"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/file/merge")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("files[0][file]", "FILE_1_URL")
.add("files[0][pages]", "1,5-z")
.add("files[1][file]", "FILE_2_URL")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/file/merge")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/a736755a3dab32b8.pdf",
"expiration": "2024-12-08T14:49:16.997135Z",
"pages": 12,
"size": 165310
}
pdf/file/compress
Compress a PDF file
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/file/compress \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL"
const data = new FormData();
data.append('file', 'FILE_URL');
fetch('https://apdf.io/api/pdf/file/compress', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/file/compress', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/file/compress',
{
'file' => 'FILE_URL'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/file/compress',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/file/compress")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/file/compress")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/b72674993b1ae785.pdf",
"expiration": "2024-11-30T11:13:09.716337Z",
"size_original": 26214400,
"size_compressed": 3145728
}
pdf/page/extract
Extract page(s) into a new PDF file
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| pages | yes | Pages to be extracted, examples: 1,6,4 = pages 1, 6, and 4 in that order 3-7 = pages 3 through 7 in increasing order 2,6-z = page 2 and 6 to the end r3-r1 = the last three pages |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/page/extract \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d pages="1-3,6,9-z"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('pages', '1-3,6,9-z');
fetch('https://apdf.io/api/pdf/page/extract', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/page/extract', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'pages' => '1-3,6,9-z'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/page/extract',
{
'file' => 'FILE_URL',
'pages' => '1-3,6,9-z'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/page/extract',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'pages': '1-3,6,9-z'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"pages": "1-3,6,9-z"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/page/extract")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("pages", "1-3,6,9-z")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/page/extract")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/6ac674c9c031e515.pdf",
"expiration": "2024-12-01T18:25:25.137351Z",
"pages": 8,
"size": 2304916
}
pdf/page/delete
Delete page(s) from a PDF file
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| pages | yes | Pages to be deleted, examples: 1,4,6 = pages 1, 4, and 6 2,6-z = page 2 and 6 to the end r3-r1 = the last three pages |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/page/delete \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d pages="1-3,z"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('pages', '1-3,z');
fetch('https://apdf.io/api/pdf/page/delete', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/page/delete', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'pages' => '1-3,z'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/page/delete',
{
'file' => 'FILE_URL',
'pages' => '1-3,z'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/page/delete',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'pages': '1-3,z'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"pages": "1-3,z"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/page/delete")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("pages", "1-3,z")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/page/delete")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/6ac674c9c031e515.pdf",
"expiration": "2024-12-01T18:25:25.137351Z",
"pages": 8,
"size": 2304916
}
pdf/page/rotate
Rotate page(s) in a PDF file
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| rotations[] | yes | Array of the rotations to perform |
| rotations[i][angle] | yes | Angle to rotate. Valid values: + or - followed by 0, 90, 180, 270 |
| rotations[i][pages] | no | Pages to be rotated (or keep empty for all pages), examples: 1,5 = pages 1 and 5 3-7,z = pages 3 through 7 and the last page r3-r1 = the last three pages |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/page/rotate \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d rotations[0][angle]="-90" \
-d rotations[0][pages]="1-3" \
-d rotations[1][angle]="+180" \
-d rotations[1][pages]="z"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('rotations[0][angle]', '-90');
data.append('rotations[0][pages]', '1-3');
data.append('rotations[1][angle]', '+180');
data.append('rotations[1][pages]', 'z');
fetch('https://apdf.io/api/pdf/page/rotate', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/page/rotate', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'rotations[0][angle]' => '-90',
'rotations[0][pages]' => '1-3',
'rotations[1][angle]' => '+180',
'rotations[1][pages]' => 'z'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/page/rotate',
{
'file' => 'FILE_URL',
'rotations[0][angle]' => '-90',
'rotations[0][pages]' => '1-3',
'rotations[1][angle]' => '+180',
'rotations[1][pages]' => 'z'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/page/rotate',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'rotations[0][angle]': '-90',
'rotations[0][pages]': '1-3',
'rotations[1][angle]': '+180',
'rotations[1][pages]': 'z'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"rotations[0][angle]": "-90",
"rotations[0][pages]": "1-3",
"rotations[1][angle]": "+180",
"rotations[1][pages]": "z"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/page/rotate")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("rotations[0][angle]", "-90")
.add("rotations[0][pages]", "1-3")
.add("rotations[1][angle]", "+180")
.add("rotations[1][pages]", "z")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/page/rotate")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/b72674993b1ae785.pdf",
"expiration": "2024-12-15T13:16:12.757041Z"
}
pdf/page/overlay
Overlay page(s) into a PDF file
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| overlay | yes | URL of the Overlay PDF file |
| from | no | Pages (from the overlay pdf) to be used for overlay |
| to | no | Pages (from the file pdf) that should have the overlay |
| repeat | no | Pages (from the overlay pdf) that will be repeated |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/page/overlay \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d overlay="OVERLAY_FILE_URL" \
-d from="1,3" \
-d to="2-z" \
-d repeat="1"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('overlay', 'OVERLAY_FILE_URL');
data.append('from', '1,3');
data.append('to', '2-z');
data.append('repeat', '1');
fetch('https://apdf.io/api/pdf/page/overlay', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/page/overlay', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'overlay' => 'OVERLAY_FILE_URL',
'from' => '1,3',
'to' => '2-z',
'repeat' => '1'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/page/overlay',
{
'file' => 'FILE_URL',
'overlay' => 'OVERLAY_FILE_URL',
'from' => '1,3',
'to' => '2-z',
'repeat' => '1'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/page/overlay',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'overlay': 'OVERLAY_FILE_URL',
'from': '1,3',
'to': '2-z',
'repeat': '1'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"overlay": "OVERLAY_FILE_URL",
"from": "1,3",
"to": "2-z",
"repeat": "1"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/page/overlay")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("overlay", "OVERLAY_FILE_URL")
.add("from", "1,3")
.add("to", "2-z")
.add("repeat", "1")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/page/overlay")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/b72674993b1ae785.pdf",
"expiration": "2024-12-15T13:16:12.757041Z"
}
pdf/page/underlay
Underlay page(s) into a PDF file
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| underlay | yes | URL of the Underlay PDF file |
| from | no | Pages (from the underlay pdf) to be used for underlay |
| to | no | Pages (from the file pdf) that should have the underlay |
| repeat | no | Pages (from the underlay pdf) that will be repeated |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/page/underlay \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d underlay="UNDERLAY_FILE_URL" \
-d from="3" \
-d to="2-z" \
-d repeat="1"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('underlay', 'UNDERLAY_FILE_URL');
data.append('from', '3');
data.append('to', '2-z');
data.append('repeat', '1');
fetch('https://apdf.io/api/pdf/page/underlay', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/page/underlay', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'underlay' => 'UNDERLAY_FILE_URL',
'from' => '3',
'to' => '2-z',
'repeat' => '1'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/page/underlay',
{
'file' => 'FILE_URL',
'underlay' => 'UNDERLAY_FILE_URL',
'from' => '3',
'to' => '2-z',
'repeat' => '1'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/page/underlay',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'underlay': 'UNDERLAY_FILE_URL',
'from': '3',
'to': '2-z',
'repeat': '1'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"underlay": "UNDERLAY_FILE_URL",
"from": "3",
"to": "2-z",
"repeat": "1"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/page/underlay")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("underlay", "UNDERLAY_FILE_URL")
.add("from", "3")
.add("to", "2-z")
.add("repeat", "1")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/page/underlay")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/b72674993b1ae785.pdf",
"expiration": "2024-12-15T13:16:12.757041Z"
}
pdf/content/search
Search in the PDF file
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| text | yes | Text to search for |
| case | no | Set case to 1 for a case-sensitive search |
| regex | no | Set regex to 1 to interpret the search text as a regular expression |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/content/search \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d text="SEARCH_TEXT"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('text', 'SEARCH_TEXT');
fetch('https://apdf.io/api/pdf/content/search', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/content/search', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'text' => 'SEARCH_TEXT'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/content/search',
{
'file' => 'FILE_URL',
'text' => 'SEARCH_TEXT'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/content/search',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'text': 'SEARCH_TEXT'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"text": "SEARCH_TEXT"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/content/search")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("text", "SEARCH_TEXT")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/content/search")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"search_text": "portable document format",
"results_total": 3,
"results_pages": 2,
"results": [
{
"page": "6",
"matched_line": "7. \"ISO 32000-1:2008 – Document management – Portable document format – Part 1: PDF",
"exact_word": "Portable document format"
},
{
"page": "17",
"matched_line": "37. Adobe Systems Inc. (July 1, 2008). \"Document Management – Portable Document Format –",
"exact_word": "Portable Document Format"
},
{
"page": "17",
"matched_line": "64. \"Processing Dangerous Paths – On Security and Privacy of the Portable Document Format\"",
"exact_word": "Portable Document Format"
}
]
}
pdf/content/read
Get the content of the PDF file
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/content/read \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL"
const data = new FormData();
data.append('file', 'FILE_URL');
fetch('https://apdf.io/api/pdf/content/read', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/content/read', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/content/read',
{
'file' => 'FILE_URL'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/content/read',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/content/read")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/content/read")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"pages_total": 3,
"characters_total": 8642,
"pages": [
{
"page": 1,
"characters": 2398,
"content": "PDF\\nPortable Document Format (PDF), standardized as\\nISO 32000 ..."
},
{
"page": 2,
"characters": 2900,
"content": "PDF was a proprietary format controlled by Adobe until it was released ..."
},
{
"page": 3,
"characters": 3344,
"content": "PostScript was originally designed for a drastically different use case ..."
}
]
}
pdf/security/add
Add password protection to the PDF
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| owner_password | yes | The owner password used for encryption and for setting/removing restrictions |
| user_password | no | The user password required to open and view the PDF |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/security/add \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d owner_password="OWNER_PASSWORD" \
-d user_password="USER_PASSWORD"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('owner_password', 'OWNER_PASSWORD');
data.append('user_password', 'USER_PASSWORD');
fetch('https://apdf.io/api/pdf/security/add', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/security/add', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'owner_password' => 'OWNER_PASSWORD',
'user_password' => 'USER_PASSWORD'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/security/add',
{
'file' => 'FILE_URL',
'owner_password' => 'OWNER_PASSWORD',
'user_password' => 'USER_PASSWORD'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/security/add',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'owner_password': 'OWNER_PASSWORD',
'user_password': 'USER_PASSWORD'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"owner_password": "OWNER_PASSWORD",
"user_password": "USER_PASSWORD"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/security/add")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("owner_password", "OWNER_PASSWORD")
.add("user_password", "USER_PASSWORD")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/security/add")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/b72674993b1ae785.pdf",
"expiration": "2024-12-15T13:16:12.757041Z"
}
pdf/security/remove
Remove password protection from the PDF
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| password | no | The owner or user password |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/security/remove \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d password="PASSWORD"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('password', 'PASSWORD');
fetch('https://apdf.io/api/pdf/security/remove', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/security/remove', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'password' => 'PASSWORD'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/security/remove',
{
'file' => 'FILE_URL',
'password' => 'PASSWORD'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/security/remove',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'password': 'PASSWORD'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"password": "PASSWORD"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/security/remove")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("password", "PASSWORD")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/security/remove")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/b72674993b1ae785.pdf",
"expiration": "2024-12-15T13:16:12.757041Z"
}
pdf/metadata/read
Get info data about a PDF file
Parameters
| Parameter | Required | Description |
|---|---|---|
| file | yes | URL of the PDF file |
| async | no | Set async to 1 for executing this call in the background. API will return a job ID for requesting the /job/status/check endpoint |
Request
curl -X POST https://apdf.io/api/pdf/metadata/read \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL"
const data = new FormData();
data.append('file', 'FILE_URL');
fetch('https://apdf.io/api/pdf/metadata/read', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/metadata/read', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/metadata/read',
{
'file' => 'FILE_URL'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/metadata/read',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/metadata/read")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/metadata/read")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
JSON
{
"title": "Example",
"creator": "aPDF.io",
"producer": "aPDF/API",
"created": "Tue Jul 1 07:24:47 2024 CEST",
"modified": "Tue Jul 1 07:24:47 2024 CEST",
"pages": 4,
"encrypted": false,
"page_size": "595.92 x 841.92 pts (A4)",
"file_size": 221441,
"pdf_version": "1.4"
}
job/status/check
Check the job status of an asynchronous API call
Parameters
| Parameter | Required | Description |
|---|---|---|
| id | yes | ID of the asynchronous job |
Request
curl -X POST https://apdf.io/api/job/status/check \
-H "Authorization: Bearer TOKEN" \
-d id="JOB_ID"
const data = new FormData();
data.append('id', 'JOB_ID');
fetch('https://apdf.io/api/job/status/check', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/job/status/check', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'id' => 'JOB_ID'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/job/status/check',
{
'id' => 'JOB_ID'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/job/status/check',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'id': 'JOB_ID'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"id": "JOB_ID"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/job/status/check")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("id", "JOB_ID")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/job/status/check")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Response
RUNNING
{
"id": "01JEB5W3960DD5363GCSPNSQVX",
"created": "2024-12-01T10:29:26.000000Z",
"status": "running",
"result": null
}
SUCCESSFUL
{
"id": "01JEB5W3960DD5363GCSPNSQVX",
"created": "2024-12-02T22:30:54.450552Z",
"status": "successful",
"result": {
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/6f1674e2703953aa.pdf",
"expiration": "2024-12-02T23:33:41.450552Z",
"pages": 1,
"size": 11838
}
}