Cloud APIs for extracting, generating, converting, validating, and reviewing high-stakes documents — with structured output agents can use and humans can trust.
Use case finder
curl -X POST https://api.nutrient.io/build \ -H "Authorization: Bearer your_api_key_here" \ -o result.json \ --fail \ -F instructions='{ "parts": [ { "file": "invoice" } ], "output": { "type": "json-content", "keyValuePairs": true } }'curl -X POST https://api.nutrient.io/build ^ -H "Authorization: Bearer your_api_key_here" ^ -o result.json ^ --fail ^ -F instructions="{\"parts\": [{\"file\": \"invoice\"}], \"output\": {\"type\": \"json-content\", \"keyValuePairs\": true}}"package com.example.pspdfkit;
import java.io.File;import java.io.IOException;import java.nio.file.FileSystems;import java.nio.file.Files;import java.nio.file.StandardCopyOption;
import org.json.JSONArray;import org.json.JSONObject;
import okhttp3.MediaType;import okhttp3.MultipartBody;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.RequestBody;import okhttp3.Response;
public final class PspdfkitApiExample { public static void main(final String[] args) throws IOException { final RequestBody body = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart( "invoice", "invoice.webp", RequestBody.create( MediaType.parse("application/octet-stream"), new File("invoice.webp") ) ) .addFormDataPart( "instructions", new JSONObject() .put("parts", new JSONArray() .put(new JSONObject() .put("file", "invoice") ) ) .put("output", new JSONObject() .put("type", "json-content") .put("keyValuePairs", true) ).toString() ) .build();
final Request request = new Request.Builder() .url("https://api.nutrient.io/build") .method("POST", body) .addHeader("Authorization", "Bearer your_api_key_here") .build();
final OkHttpClient client = new OkHttpClient() .newBuilder() .build();
final Response response = client.newCall(request).execute();
if (response.isSuccessful()) { Files.copy( response.body().byteStream(), FileSystems.getDefault().getPath("result.json"), StandardCopyOption.REPLACE_EXISTING ); } else { // Handle the error throw new IOException(response.body().string()); } }}using System;using System.IO;using System.Net;using RestSharp;
namespace PspdfkitApiDemo{ class Program { static void Main(string[] args) { var client = new RestClient("https://api.nutrient.io/build");
var request = new RestRequest(Method.POST) .AddHeader("Authorization", "Bearer your_api_key_here") .AddFile("invoice", "invoice.webp") .AddParameter("instructions", new JsonObject { ["parts"] = new JsonArray { new JsonObject { ["file"] = "invoice" } }, ["output"] = new JsonObject { ["type"] = "json-content", ["keyValuePairs"] = true } }.ToString());
request.AdvancedResponseWriter = (responseStream, response) => { if (response.StatusCode == HttpStatusCode.OK) { using (responseStream) { using var outputFileWriter = File.OpenWrite("result.json"); responseStream.CopyTo(outputFileWriter); } } else { var responseStreamReader = new StreamReader(responseStream); Console.Write(responseStreamReader.ReadToEnd()); } };
client.Execute(request); } }}// This code requires Node.js. Do not run this code directly in a web browser.
const axios = require('axios')const FormData = require('form-data')const fs = require('fs')
const formData = new FormData()formData.append('instructions', JSON.stringify({ parts: [ { file: "invoice" } ], output: { type: "json-content", keyValuePairs: true }}))formData.append('invoice', fs.createReadStream('invoice.webp'))
;(async () => { try { const response = await axios.post('https://api.nutrient.io/build', formData, { headers: formData.getHeaders({ 'Authorization': 'Bearer your_api_key_here' }), responseType: "stream" })
response.data.pipe(fs.createWriteStream("result.json")) } catch (e) { const errorString = await streamToString(e.response.data) console.log(errorString) }})()
function streamToString(stream) { const chunks = [] return new Promise((resolve, reject) => { stream.on("data", (chunk) => chunks.push(Buffer.from(chunk))) stream.on("error", (err) => reject(err)) stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8"))) })}import requestsimport json
response = requests.request( 'POST', 'https://api.nutrient.io/build', headers = { 'Authorization': 'Bearer your_api_key_here' }, files = { 'invoice': open('invoice.webp', 'rb') }, data = { 'instructions': json.dumps({ 'parts': [ { 'file': 'invoice' } ], 'output': { 'type': 'json-content', 'keyValuePairs': True } }) }, stream = True)
if response.ok: with open('result.json', 'wb') as fd: for chunk in response.iter_content(chunk_size=8096): fd.write(chunk)else: print(response.text) exit()<?php
$FileHandle = fopen('result.json', 'w+');
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.nutrient.io/build', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_POSTFIELDS => array( 'instructions' => '{ "parts": [ { "file": "invoice" } ], "output": { "type": "json-content", "keyValuePairs": true } }', 'invoice' => new CURLFILE('invoice.webp') ), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer your_api_key_here' ), CURLOPT_FILE => $FileHandle,));
$response = curl_exec($curl);
curl_close($curl);
fclose($FileHandle);POST https://api.nutrient.io/build HTTP/1.1Content-Type: multipart/form-data; boundary=--customboundaryAuthorization: Bearer your_api_key_here
--customboundaryContent-Disposition: form-data; name="instructions"Content-Type: application/json
{ "parts": [ { "file": "invoice" } ], "output": { "type": "json-content", "keyValuePairs": true }}--customboundaryContent-Disposition: form-data; name="invoice"; filename="invoice.webp"Content-Type: image/webp
(invoice data)--customboundary--curl -X POST https://api.nutrient.io/processor/generate_pdf \ -H "Authorization: Bearer your_api_key_here" \ -o result.pdf \ --fail \curl -X POST https://api.nutrient.io/processor/generate_pdf ^ -H "Authorization: Bearer your_api_key_here" ^ -o result.pdf ^ --fail ^package com.example.pspdfkit;
import java.io.File;import java.io.IOException;import java.nio.file.FileSystems;import java.nio.file.Files;import java.nio.file.StandardCopyOption;
import org.json.JSONArray;import org.json.JSONObject;
import okhttp3.MediaType;import okhttp3.MultipartBody;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.RequestBody;import okhttp3.Response;
public final class PspdfkitApiExample { public static void main(final String[] args) throws IOException { final RequestBody body = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart( "html", "index.html", RequestBody.create( MediaType.parse("text/html"), new File("index.html") ) ) .build();
final Request request = new Request.Builder() .url("https://api.nutrient.io/processor/generate_pdf") .method("POST", body) .addHeader("Authorization", "Bearer your_api_key_here") .build();
final OkHttpClient client = new OkHttpClient() .newBuilder() .build();
final Response response = client.newCall(request).execute();
if (response.isSuccessful()) { Files.copy( response.body().byteStream(), FileSystems.getDefault().getPath("result.pdf"), StandardCopyOption.REPLACE_EXISTING ); } else { // Handle the error throw new IOException(response.body().string()); } }}using System;using System.IO;using System.Net;using RestSharp;
namespace PspdfkitApiDemo{ class Program { static void Main(string[] args) { var client = new RestClient("https://api.nutrient.io/processor/generate_pdf");
var request = new RestRequest(Method.POST) .AddHeader("Authorization", "Bearer your_api_key_here") .AddFile("html", "index.html");
request.AdvancedResponseWriter = (responseStream, response) => { if (response.StatusCode == HttpStatusCode.OK) { using (responseStream) { using var outputFileWriter = File.OpenWrite("result.pdf"); responseStream.CopyTo(outputFileWriter); } } else { var responseStreamReader = new StreamReader(responseStream); Console.Write(responseStreamReader.ReadToEnd()); } };
client.Execute(request); } }}// This code requires Node.js. Do not run this code directly in a web browser.
const axios = require('axios')const FormData = require('form-data')const fs = require('fs')
const formData = new FormData()formData.append('html', fs.createReadStream('index.html'))
;(async () => { try { const response = await axios.post('https://api.nutrient.io/processor/generate_pdf', formData, { headers: formData.getHeaders({ 'Authorization': 'Bearer your_api_key_here' }), responseType: "stream" })
response.data.pipe(fs.createWriteStream("result.pdf")) } catch (e) { const errorString = await streamToString(e.response.data) console.log(errorString) }})()
function streamToString(stream) { const chunks = [] return new Promise((resolve, reject) => { stream.on("data", (chunk) => chunks.push(Buffer.from(chunk))) stream.on("error", (err) => reject(err)) stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8"))) })}import requestsimport json
response = requests.request( 'POST', 'https://api.nutrient.io/processor/generate_pdf', headers = { 'Authorization': 'Bearer your_api_key_here' }, files = { 'html': open('index.html', 'rb') }, stream = True)
if response.ok: with open('result.pdf', 'wb') as fd: for chunk in response.iter_content(chunk_size=8096): fd.write(chunk)else: print(response.text) exit()<?php
$FileHandle = fopen('result.pdf', 'w+');
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.nutrient.io/processor/generate_pdf', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_POSTFIELDS => array( 'html' => new CURLFILE('index.html') ), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer your_api_key_here' ), CURLOPT_FILE => $FileHandle,));
$response = curl_exec($curl);
curl_close($curl);
fclose($FileHandle);POST https://api.nutrient.io/processor/generate_pdf HTTP/1.1Content-Type: multipart/form-data; boundary=--customboundaryAuthorization: Bearer your_api_key_here
--customboundaryContent-Disposition: form-data; name="html"; filename="index.html"Content-Type: text/html
(html data)--customboundary--curl -X POST https://api.nutrient.io/processor/convert_to_pdf \ -H "Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document" \ -H "Authorization: Bearer your_api_key_here" \ -o result.pdf \ --fail \ --data-binary @document.docxcurl -X POST https://api.nutrient.io/processor/convert_to_pdf ^ -H "Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document" ^ -H "Authorization: Bearer your_api_key_here" ^ -o result.pdf ^ --fail ^ --data-binary @document.docxpackage com.example.pspdfkit;
import java.io.File;import java.io.IOException;import java.nio.file.FileSystems;import java.nio.file.Files;import java.nio.file.StandardCopyOption;
import org.json.JSONArray;import org.json.JSONObject;
import okhttp3.MediaType;import okhttp3.MultipartBody;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.RequestBody;import okhttp3.Response;
public final class PspdfkitApiExample { public static void main(final String[] args) throws IOException { final MediaType mediaType = MediaType.parse("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); final RequestBody body = RequestBody.create( mediaType, new File("document.docx") );
final Request request = new Request.Builder() .url("https://api.nutrient.io/processor/convert_to_pdf") .method("POST", body) .addHeader("Content-Type", "application/vnd.openxmlformats-officedocument.wordprocessingml.document") .addHeader("Authorization", "Bearer your_api_key_here") .build();
final OkHttpClient client = new OkHttpClient() .newBuilder() .build();
final Response response = client.newCall(request).execute();
if (response.isSuccessful()) { Files.copy( response.body().byteStream(), FileSystems.getDefault().getPath("result.pdf"), StandardCopyOption.REPLACE_EXISTING ); } else { // Handle the error throw new IOException(response.body().string()); } }}using System;using System.IO;using System.Net;using RestSharp;
namespace PspdfkitApiDemo{ class Program { static void Main(string[] args) { var client = new RestClient("https://api.nutrient.io/processor/convert_to_pdf");
var request = new RestRequest(Method.POST) .AddHeader("Authorization", "Bearer your_api_key_here") .AddFile("document.docx", "document.docx");
request.AdvancedResponseWriter = (responseStream, response) => { if (response.StatusCode == HttpStatusCode.OK) { using (responseStream) { using var outputFileWriter = File.OpenWrite("result.pdf"); responseStream.CopyTo(outputFileWriter); } } else { var responseStreamReader = new StreamReader(responseStream); Console.Write(responseStreamReader.ReadToEnd()); } };
client.Execute(request); } }}// This code requires Node.js. Do not run this code directly in a web browser.
const axios = require('axios')const FormData = require('form-data')const fs = require('fs')
const body = fs.createReadStream('document.docx')
;(async () => { try { const response = await axios.post('https://api.nutrient.io/processor/convert_to_pdf', body, { headers: { 'Content-Type': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Authorization': 'Bearer your_api_key_here' }, responseType: "stream" })
response.data.pipe(fs.createWriteStream("result.pdf")) } catch (e) { const errorString = await streamToString(e.response.data) console.log(errorString) }})()
function streamToString(stream) { const chunks = [] return new Promise((resolve, reject) => { stream.on("data", (chunk) => chunks.push(Buffer.from(chunk))) stream.on("error", (err) => reject(err)) stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8"))) })}import requestsimport json
body = open('document.docx', 'rb')
response = requests.request( 'POST', 'https://api.nutrient.io/processor/convert_to_pdf', headers = { 'Content-Type': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Authorization': 'Bearer your_api_key_here' }, data = body, stream = True)
if response.ok: with open('result.pdf', 'wb') as fd: for chunk in response.iter_content(chunk_size=8096): fd.write(chunk)else: print(response.text) exit()<?php
$FileHandle = fopen('result.pdf', 'w+');
$curl = curl_init();
$body = file_get_contents('document.docx');
curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.nutrient.io/processor/convert_to_pdf', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_POSTFIELDS => $body, CURLOPT_HTTPHEADER => array( 'Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Authorization: Bearer your_api_key_here' ), CURLOPT_FILE => $FileHandle,));
$response = curl_exec($curl);
curl_close($curl);
fclose($FileHandle);POST https://api.nutrient.io/processor/convert_to_pdf HTTP/1.1Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.documentAuthorization: Bearer your_api_key_here
<document.docx contents>curl -X POST https://api.nutrient.io/processor/ocr \ -H "Authorization: Bearer your_api_key_here" \ -o result.pdf \ --fail \ -F data='{ "language": "english" }'curl -X POST https://api.nutrient.io/processor/ocr ^ -H "Authorization: Bearer your_api_key_here" ^ -o result.pdf ^ --fail ^ -F data="{\"language\": \"english\"}"package com.example.pspdfkit;
import java.io.File;import java.io.IOException;import java.nio.file.FileSystems;import java.nio.file.Files;import java.nio.file.StandardCopyOption;
import org.json.JSONArray;import org.json.JSONObject;
import okhttp3.MediaType;import okhttp3.MultipartBody;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.RequestBody;import okhttp3.Response;
public final class PspdfkitApiExample { public static void main(final String[] args) throws IOException { final RequestBody body = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart( "file", "document.pdf", RequestBody.create( MediaType.parse("application/pdf"), new File("document.pdf") ) ) .addFormDataPart( "data", new JSONObject() .put("language", "english").toString() ) .build();
final Request request = new Request.Builder() .url("https://api.nutrient.io/processor/ocr") .method("POST", body) .addHeader("Authorization", "Bearer your_api_key_here") .build();
final OkHttpClient client = new OkHttpClient() .newBuilder() .build();
final Response response = client.newCall(request).execute();
if (response.isSuccessful()) { Files.copy( response.body().byteStream(), FileSystems.getDefault().getPath("result.pdf"), StandardCopyOption.REPLACE_EXISTING ); } else { // Handle the error throw new IOException(response.body().string()); } }}using System;using System.IO;using System.Net;using RestSharp;
namespace PspdfkitApiDemo{ class Program { static void Main(string[] args) { var client = new RestClient("https://api.nutrient.io/processor/ocr");
var request = new RestRequest(Method.POST) .AddHeader("Authorization", "Bearer your_api_key_here") .AddFile("file", "document.pdf") .AddParameter("data", new JsonObject { ["language"] = "english" }.ToString());
request.AdvancedResponseWriter = (responseStream, response) => { if (response.StatusCode == HttpStatusCode.OK) { using (responseStream) { using var outputFileWriter = File.OpenWrite("result.pdf"); responseStream.CopyTo(outputFileWriter); } } else { var responseStreamReader = new StreamReader(responseStream); Console.Write(responseStreamReader.ReadToEnd()); } };
client.Execute(request); } }}// This code requires Node.js. Do not run this code directly in a web browser.
const axios = require('axios')const FormData = require('form-data')const fs = require('fs')
const formData = new FormData()formData.append('data', JSON.stringify({ language: "english"}))formData.append('file', fs.createReadStream('document.pdf'))
;(async () => { try { const response = await axios.post('https://api.nutrient.io/processor/ocr', formData, { headers: formData.getHeaders({ 'Authorization': 'Bearer your_api_key_here' }), responseType: "stream" })
response.data.pipe(fs.createWriteStream("result.pdf")) } catch (e) { const errorString = await streamToString(e.response.data) console.log(errorString) }})()
function streamToString(stream) { const chunks = [] return new Promise((resolve, reject) => { stream.on("data", (chunk) => chunks.push(Buffer.from(chunk))) stream.on("error", (err) => reject(err)) stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8"))) })}import requestsimport json
response = requests.request( 'POST', 'https://api.nutrient.io/processor/ocr', headers = { 'Authorization': 'Bearer your_api_key_here' }, files = { 'file': open('document.pdf', 'rb') }, data = { 'data': json.dumps({ 'language': 'english' }) }, stream = True)
if response.ok: with open('result.pdf', 'wb') as fd: for chunk in response.iter_content(chunk_size=8096): fd.write(chunk)else: print(response.text) exit()<?php
$FileHandle = fopen('result.pdf', 'w+');
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.nutrient.io/processor/ocr', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_POSTFIELDS => array( 'data' => '{ "language": "english" }', 'file' => new CURLFILE('document.pdf') ), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer your_api_key_here' ), CURLOPT_FILE => $FileHandle,));
$response = curl_exec($curl);
curl_close($curl);
fclose($FileHandle);POST https://api.nutrient.io/processor/ocr HTTP/1.1Content-Type: multipart/form-data; boundary=--customboundaryAuthorization: Bearer your_api_key_here
--customboundaryContent-Disposition: form-data; name="data"Content-Type: application/json
{ "language": "english"}--customboundaryContent-Disposition: form-data; name="file"; filename="document.pdf"Content-Type: application/pdf
(file data)--customboundary--curl -X POST https://api.nutrient.io/processor/generate_pdf \ -H "Authorization: Bearer your_api_key_here" \ -o result.pdf \ --fail \curl -X POST https://api.nutrient.io/processor/generate_pdf ^ -H "Authorization: Bearer your_api_key_here" ^ -o result.pdf ^ --fail ^package com.example.pspdfkit;
import java.io.File;import java.io.IOException;import java.nio.file.FileSystems;import java.nio.file.Files;import java.nio.file.StandardCopyOption;
import org.json.JSONArray;import org.json.JSONObject;
import okhttp3.MediaType;import okhttp3.MultipartBody;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.RequestBody;import okhttp3.Response;
public final class PspdfkitApiExample { public static void main(final String[] args) throws IOException { final RequestBody body = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart( "html", "index.html", RequestBody.create( MediaType.parse("text/html"), new File("index.html") ) ) .build();
final Request request = new Request.Builder() .url("https://api.nutrient.io/processor/generate_pdf") .method("POST", body) .addHeader("Authorization", "Bearer your_api_key_here") .build();
final OkHttpClient client = new OkHttpClient() .newBuilder() .build();
final Response response = client.newCall(request).execute();
if (response.isSuccessful()) { Files.copy( response.body().byteStream(), FileSystems.getDefault().getPath("result.pdf"), StandardCopyOption.REPLACE_EXISTING ); } else { // Handle the error throw new IOException(response.body().string()); } }}using System;using System.IO;using System.Net;using RestSharp;
namespace PspdfkitApiDemo{ class Program { static void Main(string[] args) { var client = new RestClient("https://api.nutrient.io/processor/generate_pdf");
var request = new RestRequest(Method.POST) .AddHeader("Authorization", "Bearer your_api_key_here") .AddFile("html", "index.html");
request.AdvancedResponseWriter = (responseStream, response) => { if (response.StatusCode == HttpStatusCode.OK) { using (responseStream) { using var outputFileWriter = File.OpenWrite("result.pdf"); responseStream.CopyTo(outputFileWriter); } } else { var responseStreamReader = new StreamReader(responseStream); Console.Write(responseStreamReader.ReadToEnd()); } };
client.Execute(request); } }}// This code requires Node.js. Do not run this code directly in a web browser.
const axios = require('axios')const FormData = require('form-data')const fs = require('fs')
const formData = new FormData()formData.append('html', fs.createReadStream('index.html'))
;(async () => { try { const response = await axios.post('https://api.nutrient.io/processor/generate_pdf', formData, { headers: formData.getHeaders({ 'Authorization': 'Bearer your_api_key_here' }), responseType: "stream" })
response.data.pipe(fs.createWriteStream("result.pdf")) } catch (e) { const errorString = await streamToString(e.response.data) console.log(errorString) }})()
function streamToString(stream) { const chunks = [] return new Promise((resolve, reject) => { stream.on("data", (chunk) => chunks.push(Buffer.from(chunk))) stream.on("error", (err) => reject(err)) stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8"))) })}import requestsimport json
response = requests.request( 'POST', 'https://api.nutrient.io/processor/generate_pdf', headers = { 'Authorization': 'Bearer your_api_key_here' }, files = { 'html': open('index.html', 'rb') }, stream = True)
if response.ok: with open('result.pdf', 'wb') as fd: for chunk in response.iter_content(chunk_size=8096): fd.write(chunk)else: print(response.text) exit()<?php
$FileHandle = fopen('result.pdf', 'w+');
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.nutrient.io/processor/generate_pdf', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_POSTFIELDS => array( 'html' => new CURLFILE('index.html') ), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer your_api_key_here' ), CURLOPT_FILE => $FileHandle,));
$response = curl_exec($curl);
curl_close($curl);
fclose($FileHandle);POST https://api.nutrient.io/processor/generate_pdf HTTP/1.1Content-Type: multipart/form-data; boundary=--customboundaryAuthorization: Bearer your_api_key_here
--customboundaryContent-Disposition: form-data; name="html"; filename="index.html"Content-Type: text/html
(html data)--customboundary--curl -X POST https://api.nutrient.io/sign \ -H "Authorization: Bearer your_api_key_here" \ -o result.pdf \ --fail \ -F data='{ "signatureType": "cades", "cadesLevel": "b-lt" }'curl -X POST https://api.nutrient.io/sign ^ -H "Authorization: Bearer your_api_key_here" ^ -o result.pdf ^ --fail ^ -F data="{\"signatureType\": \"cades\", \"cadesLevel\": \"b-lt\"}"package com.example.pspdfkit;
import java.io.File;import java.io.IOException;import java.nio.file.FileSystems;import java.nio.file.Files;import java.nio.file.StandardCopyOption;
import org.json.JSONObject;
import okhttp3.MediaType;import okhttp3.MultipartBody;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.RequestBody;import okhttp3.Response;
public final class PspdfkitApiExample { public static void main(final String[] args) throws IOException { final RequestBody body = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart( "file", "document.pdf", RequestBody.create( MediaType.parse("application/pdf"), new File("document.pdf") ) ) .addFormDataPart( "data", new JSONObject() .put("signatureType", "cades") .put("cadesLevel", "b-lt").toString() ) .build();
final Request request = new Request.Builder() .url("https://api.nutrient.io/sign") .method("POST", body) .addHeader("Authorization", "Bearer your_api_key_here") .build();
final OkHttpClient client = new OkHttpClient() .newBuilder() .build();
final Response response = client.newCall(request).execute();
if (response.isSuccessful()) { Files.copy( response.body().byteStream(), FileSystems.getDefault().getPath("result.pdf"), StandardCopyOption.REPLACE_EXISTING ); } else { // Handle the error throw new IOException(response.body().string()); } }}using System;using System.IO;using System.Net;using RestSharp;
namespace PspdfkitApiDemo{ class Program { static void Main(string[] args) { var client = new RestClient("https://api.nutrient.io/sign");
var request = new RestRequest(Method.POST) .AddHeader("Authorization", "Bearer your_api_key_here") .AddFile("file", "document.pdf") .AddParameter("data", new JsonObject { ["signatureType"] = "cades", ["cadesLevel"] = "b-lt" }.ToString());
request.AdvancedResponseWriter = (responseStream, response) => { if (response.StatusCode == HttpStatusCode.OK) { using (responseStream) { using var outputFileWriter = File.OpenWrite("result.pdf"); responseStream.CopyTo(outputFileWriter); } } else { var responseStreamReader = new StreamReader(responseStream); Console.Write(responseStreamReader.ReadToEnd()); } };
client.Execute(request); } }}// This code requires Node.js. Do not run this code directly in a web browser.
const axios = require('axios')const FormData = require('form-data')const fs = require('fs')
const formData = new FormData()formData.append('data', JSON.stringify({ signatureType: "cades", cadesLevel: "b-lt"}))formData.append('file', fs.createReadStream('document.pdf'))
;(async () => { try { const response = await axios.post('https://api.nutrient.io/sign', formData, { headers: formData.getHeaders({ 'Authorization': 'Bearer your_api_key_here' }), responseType: "stream" })
response.data.pipe(fs.createWriteStream("result.pdf")) } catch (e) { const errorString = await streamToString(e.response.data) console.log(errorString) }})()
function streamToString(stream) { const chunks = [] return new Promise((resolve, reject) => { stream.on("data", (chunk) => chunks.push(Buffer.from(chunk))) stream.on("error", (err) => reject(err)) stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8"))) })}import requestsimport json
response = requests.request( 'POST', 'https://api.nutrient.io/sign', headers = { 'Authorization': 'Bearer your_api_key_here' }, files = { 'file': open('document.pdf', 'rb') }, data = { 'data': json.dumps({ 'signatureType': 'cades', 'cadesLevel': 'b-lt' }) }, stream = True)
if response.ok: with open('result.pdf', 'wb') as fd: for chunk in response.iter_content(chunk_size=8096): fd.write(chunk)else: print(response.text) exit()<?php
$FileHandle = fopen('result.pdf', 'w+');
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.nutrient.io/sign', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_POSTFIELDS => array( 'data' => '{ "signatureType": "cades", "cadesLevel": "b-lt" }', 'file' => new CURLFILE('document.pdf') ), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer your_api_key_here' ), CURLOPT_FILE => $FileHandle,));
$response = curl_exec($curl);
curl_close($curl);
fclose($FileHandle);POST https://api.nutrient.io/sign HTTP/1.1Content-Type: multipart/form-data; boundary=--customboundaryAuthorization: Bearer your_api_key_here
--customboundaryContent-Disposition: form-data; name="data"Content-Type: application/json
{ "signatureType": "cades", "cadesLevel": "b-lt"}--customboundaryContent-Disposition: form-data; name="file"; filename="document.pdf"Content-Type: application/pdf
(file data)--customboundary--curl -X POST https://api.nutrient.io/processor/redact \ -H "Authorization: Bearer your_api_key_here" \ -o result.pdf \ --fail \ -F data='{ "strategy": "text", "strategyOptions": { "text": "macaque", "caseSensitive": false }, "redactionState": "apply" }'curl -X POST https://api.nutrient.io/processor/redact ^ -H "Authorization: Bearer your_api_key_here" ^ -o result.pdf ^ --fail ^ -F data="{\"strategy\": \"text\", \"strategyOptions\": {\"text\": \"macaque\", \"caseSensitive\": false}, \"redactionState\": \"apply\"}"package com.example.pspdfkit;
import java.io.File;import java.io.IOException;import java.nio.file.FileSystems;import java.nio.file.Files;import java.nio.file.StandardCopyOption;
import org.json.JSONArray;import org.json.JSONObject;
import okhttp3.MediaType;import okhttp3.MultipartBody;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.RequestBody;import okhttp3.Response;
public final class PspdfkitApiExample { public static void main(final String[] args) throws IOException { final RequestBody body = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart( "file", "document.pdf", RequestBody.create( MediaType.parse("application/pdf"), new File("document.pdf") ) ) .addFormDataPart( "data", new JSONObject() .put("strategy", "text") .put("strategyOptions", new JSONObject() .put("text", "macaque") .put("caseSensitive", false)) .put("redactionState", "apply").toString() ) .build();
final Request request = new Request.Builder() .url("https://api.nutrient.io/processor/redact") .method("POST", body) .addHeader("Authorization", "Bearer your_api_key_here") .build();
final OkHttpClient client = new OkHttpClient() .newBuilder() .build();
final Response response = client.newCall(request).execute();
if (response.isSuccessful()) { Files.copy( response.body().byteStream(), FileSystems.getDefault().getPath("result.pdf"), StandardCopyOption.REPLACE_EXISTING ); } else { // Handle the error throw new IOException(response.body().string()); } }}using System;using System.IO;using System.Net;using RestSharp;
namespace PspdfkitApiDemo{ class Program { static void Main(string[] args) { var client = new RestClient("https://api.nutrient.io/processor/redact");
var request = new RestRequest(Method.POST) .AddHeader("Authorization", "Bearer your_api_key_here") .AddFile("file", "document.pdf") .AddParameter("data", new JsonObject { ["strategy"] = "text", ["strategyOptions"] = new JsonObject { ["text"] = "macaque", ["caseSensitive"] = false }, ["redactionState"] = "apply" }.ToString());
request.AdvancedResponseWriter = (responseStream, response) => { if (response.StatusCode == HttpStatusCode.OK) { using (responseStream) { using var outputFileWriter = File.OpenWrite("result.pdf"); responseStream.CopyTo(outputFileWriter); } } else { var responseStreamReader = new StreamReader(responseStream); Console.Write(responseStreamReader.ReadToEnd()); } };
client.Execute(request); } }}// This code requires Node.js. Do not run this code directly in a web browser.
const axios = require('axios')const FormData = require('form-data')const fs = require('fs')
const formData = new FormData()formData.append('data', JSON.stringify({ strategy: "text", strategyOptions: { text: "macaque", caseSensitive: false }, redactionState: "apply"}))formData.append('file', fs.createReadStream('document.pdf'))
;(async () => { try { const response = await axios.post('https://api.nutrient.io/processor/redact', formData, { headers: formData.getHeaders({ 'Authorization': 'Bearer your_api_key_here' }), responseType: "stream" })
response.data.pipe(fs.createWriteStream("result.pdf")) } catch (e) { const errorString = await streamToString(e.response.data) console.log(errorString) }})()
function streamToString(stream) { const chunks = [] return new Promise((resolve, reject) => { stream.on("data", (chunk) => chunks.push(Buffer.from(chunk))) stream.on("error", (err) => reject(err)) stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8"))) })}import requestsimport json
response = requests.request( 'POST', 'https://api.nutrient.io/processor/redact', headers = { 'Authorization': 'Bearer your_api_key_here' }, files = { 'file': open('document.pdf', 'rb') }, data = { 'data': json.dumps({ 'strategy': 'text', 'strategyOptions': { 'text': 'macaque', 'caseSensitive': False }, 'redactionState': 'apply' }) }, stream = True)
if response.ok: with open('result.pdf', 'wb') as fd: for chunk in response.iter_content(chunk_size=8096): fd.write(chunk)else: print(response.text) exit()<?php
$FileHandle = fopen('result.pdf', 'w+');
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.nutrient.io/processor/redact', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_POSTFIELDS => array( 'data' => '{ "strategy": "text", "strategyOptions": { "text": "macaque", "caseSensitive": false }, "redactionState": "apply" }', 'file' => new CURLFILE('document.pdf') ), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer your_api_key_here' ), CURLOPT_FILE => $FileHandle,));
$response = curl_exec($curl);
curl_close($curl);
fclose($FileHandle);POST https://api.nutrient.io/processor/redact HTTP/1.1Content-Type: multipart/form-data; boundary=--customboundaryAuthorization: Bearer your_api_key_here
--customboundaryContent-Disposition: form-data; name="data"Content-Type: application/json
{ "strategy": "text", "strategyOptions": { "text": "macaque", "caseSensitive": false }, "redactionState": "apply"}--customboundaryContent-Disposition: form-data; name="file"; filename="document.pdf"Content-Type: application/pdf
(file data)--customboundary--curl -X POST https://api.nutrient.io/validate_pdfa \ -H "Authorization: Bearer your_api_key_here" \ -o result.json \ --fail \curl -X POST https://api.nutrient.io/validate_pdfa ^ -H "Authorization: Bearer your_api_key_here" ^ -o result.json ^ --fail ^POST https://api.nutrient.io/validate_pdfa HTTP/1.1Content-Type: multipart/form-data; boundary=--customboundaryAuthorization: Bearer your_api_key_here
--customboundaryContent-Disposition: form-data; name="file"; filename="pdfa.pdf"Content-Type: application/pdf
(file data)--customboundary--Turn PDFs, scans, forms, invoices, contracts, and Office files into typed JSON or LLM-ready Markdown. Preserve tables, key-value pairs, line items, coordinates, and confidence signals so downstream agents can validate before acting.
Explore data extractionCreate PDFs from HTML, templates, Markdown, or structured data. Add headers, footers, dynamic content, and accessibility-ready output for reports, agreements, statements, and customer-facing documents.
Explore PDF generationConvert between PDF, Word, Excel, PowerPoint, HTML, images, and Markdown while preserving layout and structure. Prepare documents for review, storage, automation, or AI ingestion.
Explore conversionMake scans, images, and photographed pages searchable, extractable, and ready for automation. Use OCR as the first step in document intake, classification, extraction, and review workflows.
Explore OCREmbed a production-ready document viewer for human review. Let users view, annotate, fill forms, compare, collaborate, and approve documents inside your product.
Explore document viewerAdd signing and approval flows to generated or uploaded documents. Support governed completion with audit trails and downstream workflow handoff.
Explore eSignaturesFind and remove sensitive information such as names, emails, SSNs, account numbers, and custom patterns. Build secure, audit-ready workflows for regulated document handling.
Explore redactionCheck PDF/A and PDF/UA requirements, accessibility readiness, archival formats, and compliance-sensitive outputs before documents move forward.
Explore complianceTurn PDFs, scans, forms, invoices, contracts, and Office files into typed JSON or LLM-ready Markdown. Preserve tables, key-value pairs, line items, coordinates, and confidence signals so downstream agents can validate before acting.
Explore data extractionCreate PDFs from HTML, templates, Markdown, or structured data. Add headers, footers, dynamic content, and accessibility-ready output for reports, agreements, statements, and customer-facing documents.
Explore PDF generationConvert between PDF, Word, Excel, PowerPoint, HTML, images, and Markdown while preserving layout and structure. Prepare documents for review, storage, automation, or AI ingestion.
Explore conversionMake scans, images, and photographed pages searchable, extractable, and ready for automation. Use OCR as the first step in document intake, classification, extraction, and review workflows.
Explore OCREmbed a production-ready document viewer for human review. Let users view, annotate, fill forms, compare, collaborate, and approve documents inside your product.
Explore document viewerAdd signing and approval flows to generated or uploaded documents. Support governed completion with audit trails and downstream workflow handoff.
Explore eSignaturesFind and remove sensitive information such as names, emails, SSNs, account numbers, and custom patterns. Build secure, audit-ready workflows for regulated document handling.
Explore redactionCheck PDF/A and PDF/UA requirements, accessibility readiness, archival formats, and compliance-sensitive outputs before documents move forward.
Explore complianceCAPABILITIES
CAPABILITIES
CAPABILITIES
CAPABILITIES
CAPABILITIES
CAPABILITIES
CAPABILITIES
CAPABILITIES
Extract line items, totals, VAT, dates, vendors, and payment terms into ERP-ready JSON.
Generate agreements from templates, extract key terms, compare versions, collect signatures, and archive final documents.
Convert document collections into clean Markdown and structured data for semantic embedding and agentic workflows.
Add document review, annotation, form filling, collaboration, and approval workflows directly inside your product.
Validate PDF/A and PDF/UA, redact sensitive information, preserve audit trails, and prepare compliant documents for regulated storage or review.
Classify patient forms, referrals, lab reports, and prescriptions into structured data; redact sensitive information; and route documents for review.
Convert, view, annotate, and compare construction drawings, patents, and architectural plans aligned with structured review and markup workflows.
Give agents reliable document capabilities: extraction, conversion, OCR, generation, redaction, validation, and Markdown output for downstream automation.
Use structured responses, confidence signals, audit-friendly processing, and compliance-ready outputs where mistakes are costly.
Embed viewing, annotation, signing, comparison, and approval experiences so people can review and control important document decisions.
Showcase
Replaced a patchwork of open source PDF tooling with Nutrient’s Web SDK and Document Engine — absorbing Harvey’s growth without adding internal infrastructure.
Pricing depends on the API you use. Processor, Viewer, Accessibility, Data Extraction, signing, and enterprise deployments may have different pricing models, limits, and evaluation paths. Use the pricing comparison above to choose the right starting point. Then view the detailed pricing page for current plan details.
Yes — It’s SOC 2 Type 2-audited, HIPAA-eligible, and GDPR-compliant. All API traffic is TLS-encrypted. Uploaded files are processed and discarded, not retained. Hosted in US and EU regions, with on-premises and dedicated deployments available.
Yes. Nutrient APIs help agents and applications work with documents in predictable ways: extracting structured data, converting files, generating documents, OCRing scans, redacting sensitive content, validating compliance, and preparing documents for human review. Responses can include structured data, Markdown, coordinates, and confidence signals so downstream systems can check outputs before acting.
Nutrient APIs support common document formats, including PDFs, images, Microsoft Office files, HTML, Markdown, and more. Supported formats vary by API, so check the relevant API documentation for exact input and output options.
Yes — It’s SOC 2 Type 2-audited, HIPAA-eligible, and GDPR-compliant. All API traffic is TLS-encrypted. Uploaded files are processed and discarded, not retained. Hosted in US and EU regions, with on-premises and dedicated deployments available.
Yes. Nutrient APIs help agents and applications work with documents in predictable ways: extracting structured data, converting files, generating documents, OCRing scans, redacting sensitive content, validating compliance, and preparing documents for human review. Responses can include structured data, Markdown, coordinates, and confidence signals so downstream systems can check outputs before acting.
Nutrient APIs support common document formats, including PDFs, images, Microsoft Office files, HTML, Markdown, and more. Supported formats vary by API, so check the relevant API documentation for exact input and output options.
Get your API key. Make your first call in 60 seconds. Scale when you’re ready.