Skip to main content

Sealing API

Overview

The Sealing API allows you to seal PDF documents to ensure their integrity and confidentiality. This process adds a digital seal to your documents, providing evidence that they have not been tampered with after sealing.

Getting Started

To seal a document:

  1. Prepare your PDF document by converting it to a base64 string
  2. Make a POST request to the sealing endpoint with your document and parameters
  3. Receive the sealed document in the response

API Endpoint

POST /management/sealing

Authentication

This endpoint requires basic authentication. You need to include your API credentials in the request header:

Authorization: Basic base64(companyKey:ApiKey)

Where base64(companyKey:ApiKey) is the Base64 encoding of your companyKey and ApiKey separated by a colon.

Request Body

ParameterTypeRequiredDescription
pdfDocumentstringYesBase64 string of the PDF document to seal
flowKeystringYesA valid flowKey provided by Taktikal that can be used for sealing
reasonstringNoSets the reason to display in the seal
languageTypeenumNoThe language type (defaults to Is)
addSealOnAllPagesbooleanNoSet to true to seal the document multiple times. One seal will be added per page

Response Format

The API returns the sealed PDF document directly as binary data.

Content-Type: application/pdf

Response Headers

The API also returns a custom HTTP header:

HeaderDescription
x-seal-countNumber of seals that were added to the document

This header is particularly useful when using addSealOnAllPages: true to receive the number of pages that were sealed.

Response Codes

  • 200 OK: Success. Returns the sealed PDF document.
  • 400 Bad Request: If any of the input is invalid. Returns an error message.
  • 500 Internal Server Error: Server error. Returns an error message.

Examples

const sealDocument = async () => {
// Create basic auth credentials
const credentials = btoa("your_companyKey:your_ApiKey");

const response = await fetch(
"https://onboarding.taktikal.is/management/sealing",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Basic ${credentials}`,
},
body: JSON.stringify({
pdfDocument: "JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQg...", // Base64 encoded PDF
flowKey: "722989cac3fx",
reason: "Document certification",
languageType: "Is",
}),
}
);

if (response.ok) {
// Get the seal count from the header
const sealCount = response.headers.get("x-seal-count");
console.log(`Document sealed successfully with ${sealCount} seals`);

// Get the PDF as a blob
const pdfBlob = await response.blob();

// You can now save or process the PDF
// Example: Create a download link
const url = URL.createObjectURL(pdfBlob);
const a = document.createElement("a");
a.href = url;
a.download = "sealed-document.pdf";
a.click();
} else {
console.error("Failed to seal document:", await response.text());
}
};

sealDocument();

Common Use Cases

Sealing Multiple Pages

If you need to add a seal to every page of your document, set addSealOnAllPages to true in your request:

{
"pdfDocument": "JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQg...",
"flowKey": "722989cac3fx",
"reason": "Document certification",
"addSealOnAllPages": true
}

Different Language Settings

The seal can be displayed in two languages. To change the language of the seal, use the languageType parameter:

  • Is - Icelandic (default)
  • En - English
{
"pdfDocument": "JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQg...",
"flowKey": "722989cac3fx",
"reason": "Document certification",
"languageType": "En"
}

Error Handling

If an error occurs during the sealing process, the API will return an appropriate error response:

{
"success": false,
"message": "Invalid PDF document format",
"errors": ["The provided PDF document could not be parsed"]
}

For more information about specific errors and troubleshooting, please refer to the complete API specification at: https://onboarding.taktikal.is/api/openapi