curl https://api.kovapdf.com/api/v1/sign-requests \
-H "Authorization: Bearer kova_test_YOUR_KEY" \
-H "Idempotency-Key: 6f1c2a8e-3d4b-4f7a-9a51-2b8f0c9e7d13" \
-F "file=@lease.pdf" \
-F 'spec={
"title": "Lease agreement",
"sequential": false,
"expiresInDays": 14,
"signers": [{ "name": "Emily Carter", "email": "emily@example.com", "order": 1 }],
"fields": [{ "signer": 0, "kind": "SIGNATURE", "page": 1, "x": 72, "y": 90, "width": 180, "height": 48 }]
}'
import { readFile } from "node:fs/promises";
import { randomUUID } from "node:crypto";
// Store this with your own record, and send the same one again on a retry.
const idempotencyKey = randomUUID();
const form = new FormData();
form.append("file", new Blob([await readFile("lease.pdf")], { type: "application/pdf" }), "lease.pdf");
form.append("spec", JSON.stringify({
title: "Lease agreement",
sequential: false,
expiresInDays: 14,
signers: [{ name: "Emily Carter", email: "emily@example.com", order: 1 }],
fields: [{ signer: 0, kind: "SIGNATURE", page: 1, x: 72, y: 90, width: 180, height: 48 }],
}));
const res = await fetch("https://api.kovapdf.com/api/v1/sign-requests", {
method: "POST",
headers: { Authorization: "Bearer kova_test_YOUR_KEY", "Idempotency-Key": idempotencyKey },
body: form,
});
const request = await res.json();
console.log(res.status, res.headers.get("KovaPDF-Test-Tasks-Left"), request.id, request.status);
import json, uuid
import requests
# Store this with your own record, and send the same one again on a retry.
idempotency_key = str(uuid.uuid4())
spec = {
"title": "Lease agreement",
"sequential": False,
"expiresInDays": 14,
"signers": [{"name": "Emily Carter", "email": "emily@example.com", "order": 1}],
"fields": [{"signer": 0, "kind": "SIGNATURE", "page": 1, "x": 72, "y": 90, "width": 180, "height": 48}],
}
with open("lease.pdf", "rb") as pdf:
res = requests.post(
"https://api.kovapdf.com/api/v1/sign-requests",
headers={"Authorization": "Bearer kova_test_YOUR_KEY", "Idempotency-Key": idempotency_key},
files={"file": ("lease.pdf", pdf, "application/pdf")},
data={"spec": json.dumps(spec)},
)
request = res.json()
print(res.status_code, res.headers.get("KovaPDF-Test-Tasks-Left"), request["id"], request["status"])
<?php
// Store this with your own record, and send the same one again on a retry.
$idempotencyKey = bin2hex(random_bytes(16));
$spec = [
"title" => "Lease agreement",
"sequential" => false,
"expiresInDays" => 14,
"signers" => [["name" => "Emily Carter", "email" => "emily@example.com", "order" => 1]],
"fields" => [["signer" => 0, "kind" => "SIGNATURE", "page" => 1, "x" => 72, "y" => 90, "width" => 180, "height" => 48]],
];
$ch = curl_init("https://api.kovapdf.com/api/v1/sign-requests");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer kova_test_YOUR_KEY", "Idempotency-Key: $idempotencyKey"],
CURLOPT_POSTFIELDS => [
"file" => new CURLFile("lease.pdf", "application/pdf"),
"spec" => json_encode($spec),
],
]);
$request = json_decode(curl_exec($ch), true);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), " ", $request["id"], " ", $request["status"], PHP_EOL;