PHP

Call the Create a Fillable PDF API from PHP.

Use cURL (built in) to convert a flat PDF.

<?php
$ch = curl_init("https://api.createafillablepdf.com/v1/convert");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("CAFP_KEY")],
  CURLOPT_POSTFIELDS => [
    "file"   => new CURLFile("applicant.pdf", "application/pdf"),
    "detect" => "fields",
  ],
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($status === 200) {
  $data = json_decode($response, true);
  echo $data["fields"] . " fields → " . $data["document_url"];
} else {
  $err = json_decode($response, true)["error"];
  fwrite(STDERR, $err["type"] . ": " . $err["message"]);
}

To fill a converted document, POST /v1/fill with Content-Type: application/json and a body of { "conversion_id": "...", "values": { ... } }.