Java

Call the Create a Fillable PDF API from Java.

Using Java 11+ HttpClient with a multipart body.

import java.net.http.*;
import java.net.URI;
import java.nio.file.*;
import java.util.*;

var boundary = "----cafp" + System.nanoTime();
var file = Path.of("applicant.pdf");
var sep = "--" + boundary + "\r\n";

var body = new ByteArrayOutputStream();
body.writeBytes((sep + "Content-Disposition: form-data; name=\"file\"; filename=\"applicant.pdf\"\r\n"
    + "Content-Type: application/pdf\r\n\r\n").getBytes());
body.writeBytes(Files.readAllBytes(file));
body.writeBytes(("\r\n" + sep + "Content-Disposition: form-data; name=\"detect\"\r\n\r\nfields\r\n").getBytes());
body.writeBytes(("--" + boundary + "--\r\n").getBytes());

var req = HttpRequest.newBuilder(URI.create("https://api.createafillablepdf.com/v1/convert"))
    .header("Authorization", "Bearer " + System.getenv("CAFP_KEY"))
    .header("Content-Type", "multipart/form-data; boundary=" + boundary)
    .POST(HttpRequest.BodyPublishers.ofByteArray(body.toByteArray()))
    .build();

var res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.statusCode() + " " + res.body());

Fill with POST /v1/fill (JSON body { "conversion_id": "...", "values": { ... } }).