Compress PDF
curl --request POST \
--url https://api.aisa.one/apis/v1/pdf-co/pdf-compress \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>"
}
'import requests
url = "https://api.aisa.one/apis/v1/pdf-co/pdf-compress"
payload = { "url": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>'})
};
fetch('https://api.aisa.one/apis/v1/pdf-co/pdf-compress', 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.aisa.one/apis/v1/pdf-co/pdf-compress",
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' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.aisa.one/apis/v1/pdf-co/pdf-compress"
payload := strings.NewReader("{\n \"url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.aisa.one/apis/v1/pdf-co/pdf-compress")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/pdf-co/pdf-compress")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"error": true,
"status": 123,
"credits": 123,
"duration": 123,
"name": "<string>",
"outputLinkValidTill": "<string>",
"pageCount": 123,
"remainingCredits": 123,
"url": "<string>"
}PDF.co
Compress PDF
Compress PDF
POST
https://api.aisa.one
/
apis
/
v1
/
pdf-co
/
pdf-compress
Compress PDF
curl --request POST \
--url https://api.aisa.one/apis/v1/pdf-co/pdf-compress \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>"
}
'import requests
url = "https://api.aisa.one/apis/v1/pdf-co/pdf-compress"
payload = { "url": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>'})
};
fetch('https://api.aisa.one/apis/v1/pdf-co/pdf-compress', 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.aisa.one/apis/v1/pdf-co/pdf-compress",
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' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.aisa.one/apis/v1/pdf-co/pdf-compress"
payload := strings.NewReader("{\n \"url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.aisa.one/apis/v1/pdf-co/pdf-compress")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/pdf-co/pdf-compress")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"error": true,
"status": 123,
"credits": 123,
"duration": 123,
"name": "<string>",
"outputLinkValidTill": "<string>",
"pageCount": 123,
"remainingCredits": 123,
"url": "<string>"
}Request contract
- Method and path: POST /apis/v1/pdf-co/pdf-compress
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/pdf-co/pdf-compress
{
"operationId": "pdf-co.pdf-compress",
"method": "POST",
"path": "/apis/v1/pdf-co/pdf-compress",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
"colorQuality": {
"description": "JPEG quality for color and grayscale images from 1 to 100.",
"maximum": 100,
"minimum": 1,
"type": "integer"
},
"compressionLevel": {
"description": "Ready-to-use PDF compression preset.",
"enum": [
"low",
"medium",
"high",
"aggressive"
],
"type": "string"
},
"config": {
"additionalProperties": false,
"description": "Partial advanced compression configuration.",
"properties": {
"fonts": {
"additionalProperties": false,
"description": "Font optimization overrides.",
"properties": {
"compress": {
"description": "Whether to compress font streams.",
"type": "boolean"
},
"subset": {
"description": "Whether to remove unused glyphs from fonts.",
"type": "boolean"
}
},
"type": "object"
},
"images": {
"additionalProperties": false,
"description": "Image optimization overrides.",
"properties": {
"color": {
"additionalProperties": false,
"description": "Color image optimization overrides.",
"properties": {
"compression": {
"additionalProperties": false,
"description": "Image re-encoding settings.",
"properties": {
"compression_format": {
"description": "Image compression format.",
"enum": [
"jpeg",
"jpeg2000",
"ccitt_g4",
"ccitt_g3",
"zip"
],
"type": "string"
},
"compression_params": {
"additionalProperties": false,
"description": "JPEG or JPEG2000 compression settings.",
"properties": {
"irreversible": {
"description": "Whether JPEG2000 uses irreversible lossy encoding.",
"type": "boolean"
},
"mct": {
"description": "Whether JPEG2000 enables the multi-component transform.",
"enum": [
0,
1
],
"type": "integer"
},
"quality": {
"description": "JPEG quality from 1 (smallest) to 100 (highest quality).",
"maximum": 100,
"minimum": 1,
"type": "integer"
},
"quality_layers": {
"description": "JPEG2000 quality layer values.",
"items": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
}
]
},
"type": "array"
},
"quality_mode": {
"description": "JPEG2000 quality layer interpretation mode.",
"enum": [
"rates",
"dB"
],
"type": "string"
}
},
"type": "object"
},
"skip": {
"description": "Whether to skip image re-encoding.",
"type": "boolean"
}
},
"type": "object"
},
"downsample": {
"additionalProperties": false,
"description": "Image resolution reduction settings.",
"properties": {
"downsample_ppi": {
"description": "Target image resolution in pixels per inch.",
"type": "integer"
},
"skip": {
"description": "Whether to preserve the image dimensions.",
"type": "boolean"
},
"threshold_ppi": {
"description": "Resolution above which the image is downsampled.",
"type": "integer"
}
},
"type": "object"
},
"skip": {
"description": "Whether to skip all optimization for this image type.",
"type": "boolean"
}
},
"type": "object"
},
"grayscale": {
"additionalProperties": false,
"description": "Grayscale image optimization overrides.",
"properties": {
"compression": {
"additionalProperties": false,
"description": "Image re-encoding settings.",
"properties": {
"compression_format": {
"description": "Image compression format.",
"enum": [
"jpeg",
"jpeg2000",
"ccitt_g4",
"ccitt_g3",
"zip"
],
"type": "string"
},
"compression_params": {
"additionalProperties": false,
"description": "JPEG or JPEG2000 compression settings.",
"properties": {
"irreversible": {
"description": "Whether JPEG2000 uses irreversible lossy encoding.",
"type": "boolean"
},
"mct": {
"description": "Whether JPEG2000 enables the multi-component transform.",
"enum": [
0,
1
],
"type": "integer"
},
"quality": {
"description": "JPEG quality from 1 (smallest) to 100 (highest quality).",
"maximum": 100,
"minimum": 1,
"type": "integer"
},
"quality_layers": {
"description": "JPEG2000 quality layer values.",
"items": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
}
]
},
"type": "array"
},
"quality_mode": {
"description": "JPEG2000 quality layer interpretation mode.",
"enum": [
"rates",
"dB"
],
"type": "string"
}
},
"type": "object"
},
"skip": {
"description": "Whether to skip image re-encoding.",
"type": "boolean"
}
},
"type": "object"
},
"downsample": {
"additionalProperties": false,
"description": "Image resolution reduction settings.",
"properties": {
"downsample_ppi": {
"description": "Target image resolution in pixels per inch.",
"type": "integer"
},
"skip": {
"description": "Whether to preserve the image dimensions.",
"type": "boolean"
},
"threshold_ppi": {
"description": "Resolution above which the image is downsampled.",
"type": "integer"
}
},
"type": "object"
},
"skip": {
"description": "Whether to skip all optimization for this image type.",
"type": "boolean"
}
},
"type": "object"
},
"monochrome": {
"additionalProperties": false,
"description": "Monochrome image optimization overrides.",
"properties": {
"compression": {
"additionalProperties": false,
"description": "Image re-encoding settings.",
"properties": {
"compression_format": {
"description": "Image compression format.",
"enum": [
"jpeg",
"jpeg2000",
"ccitt_g4",
"ccitt_g3",
"zip"
],
"type": "string"
},
"compression_params": {
"additionalProperties": false,
"description": "JPEG or JPEG2000 compression settings.",
"properties": {
"irreversible": {
"description": "Whether JPEG2000 uses irreversible lossy encoding.",
"type": "boolean"
},
"mct": {
"description": "Whether JPEG2000 enables the multi-component transform.",
"enum": [
0,
1
],
"type": "integer"
},
"quality": {
"description": "JPEG quality from 1 (smallest) to 100 (highest quality).",
"maximum": 100,
"minimum": 1,
"type": "integer"
},
"quality_layers": {
"description": "JPEG2000 quality layer values.",
"items": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
}
]
},
"type": "array"
},
"quality_mode": {
"description": "JPEG2000 quality layer interpretation mode.",
"enum": [
"rates",
"dB"
],
"type": "string"
}
},
"type": "object"
},
"skip": {
"description": "Whether to skip image re-encoding.",
"type": "boolean"
}
},
"type": "object"
},
"downsample": {
"additionalProperties": false,
"description": "Image resolution reduction settings.",
"properties": {
"downsample_ppi": {
"description": "Target image resolution in pixels per inch.",
"type": "integer"
},
"skip": {
"description": "Whether to preserve the image dimensions.",
"type": "boolean"
},
"threshold_ppi": {
"description": "Resolution above which the image is downsampled.",
"type": "integer"
}
},
"type": "object"
},
"skip": {
"description": "Whether to skip all optimization for this image type.",
"type": "boolean"
}
},
"type": "object"
}
},
"type": "object"
},
"save": {
"additionalProperties": false,
"description": "PDF cleanup overrides.",
"properties": {
"garbage": {
"description": "PDF garbage collection level from 0 to 4.",
"maximum": 4,
"minimum": 0,
"type": "integer"
}
},
"type": "object"
}
},
"type": "object"
},
"expiration": {
"description": "Number of minutes before the temporary output link expires.",
"type": "integer"
},
"name": {
"description": "File name for the generated PDF.",
"type": "string"
},
"password": {
"description": "Password for opening a protected source PDF.",
"type": "string"
},
"url": {
"description": "URL of the source PDF file to compress.",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
Usage-based pricing. Default request estimate: $0.0103 USD. The final charge depends on actual usage. Your account price may differ; use a request quote where supported.Authorizations
Body
application/json