Skip to content

Integration guide

This guide describes the order of the calls and provides abridged examples. The steps are the same for all three formats; where they differ, the PDF, XML and JSON tabs show the request and the response for the chosen format, and the choice applies to the whole page. The prerequisites are listed in the overview. All fields are described in the API references (PAdES, XAdES, JAdES).

The examples use the test addresses (all addresses). The examples show the whole flow for a PDF as short programs in Java, .NET, Python, Node.js, PHP and Go.

  1. Your server opens a transaction in ePotpis and gets a token and one verification code per document.
  2. The AdES web API prepares each document (PreSign) and returns its hash.
  3. Your server submits the hashes to ePotpis.
  4. Your application redirects the user to the ePotpis page, where the user signs.
  5. ePotpis sends the signature values and the signing certificate to your URL.
  6. The AdES web API embeds the signature in the document (PostSign) and returns the signed document.
  7. ePotpis redirects the user to your success or error page.
POST /api/v2/epotpis HTTP/1.1
Host: esign.test.certilia.com
Content-Type: application/json
{
"authData": {
"systemId": "100",
"serviceId": "500",
"documentId": "600"
},
"signingData": {
"numOfDocs": "1",
"mimetype": "pdf",
"signatureType": "sign"
}
}
Field Description
authData.systemId, authData.serviceId, authData.documentId The identifiers of your service (the service’s page, Integration tab).
signingData.numOfDocs Number of documents in the transaction.
signingData.mimetype pdf (default), xml or json.
signingData.signatureType sign (signature) or seal. ePotpis shows the user only the matching certificates; without this field, it shows all.

Response:

{
"authDataResponse": {
"token": "<token from ePotpis>",
"verificationCodes": ["00000000-0000-0000-0000-000000000001"],
"expireAt": "2026-11-12T10:30:00.000Z"
}
}

verificationCodes holds one code per document, and expireAt the time until which the transaction is valid. On an error, ePotpis returns an error object (see Errors).

2. Prepare the document and calculate the hash (PreSign)

Section titled “2. Prepare the document and calculate the hash (PreSign)”
POST /pades/v2 HTTP/1.1
Host: api.test.certilia.com
Authorization: Bearer <signing API key>
Content-Type: application/json
{
"token": "<token from ePotpis>",
"signatureFormat": "pades",
"signatureType": "sign",
"addVisualData": true,
"personNaturalData": {
"nameSurname": "Ivan Horvat",
"pin": "00000000001",
"pinCountry": "HR"
},
"documents": [
{
"verificationCode": "00000000-0000-0000-0000-000000000001",
"base64Document": "JVBERi0xLjcK...",
"documentName": "Contract 2026-001.pdf",
"firstRowMessage": "Signed in the Primjer d.o.o. web shop.",
"pageNumber": 1,
"pageLocation": 5
}
]
}

addVisualData true gives a visible signature with a visual, false an invisible one. pageNumber, pageLocation and the messages set where the visual is and what it says.

Response:

{
"token": "<token from ePotpis>",
"documents": [
{
"verificationCode": "00000000-0000-0000-0000-000000000001",
"hash": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
"documentName": "Contract 2026-001.pdf"
}
]
}

The prepared file is kept on the API server for 24 hours; the signature can be embedded only within that time.

For all three formats:

Field Description
token The token from step 1.
signatureFormat pades, xades or jades.
signatureType sign or seal, as in step 1.
personNaturalData With signature data and sign: pin and pinCountry required, nameSurname optional (name and surname as written in the certificate).
personLegalData With signature data: required for seal, optional for sign (business signature). vat and vatCountry required, name and sealName optional.
documents[] For each document: a verification code from step 1 (each code once) and the document in Base64 (base64Document).

Other parts of the system (for example the Certilia mobile app) show documentName to the user instead of a generic name.

Pass the hash to ePotpis unchanged and keep it for step 6.

PATCH /api/v2/epotpis/hash HTTP/1.1
Host: esign.test.certilia.com
Content-Type: application/json
{
"authData": {
"token": "<token from ePotpis>"
},
"signingData": {
"documents": [
{
"hash": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
"verificationCode": "00000000-0000-0000-0000-000000000001"
}
]
}
}

Response:

{
"authDataResponse": {
"token": "<token from ePotpis>"
},
"signingDataResponse": {
"success": true
},
"redirectURL": "https://esign.test.certilia.com/epotpis/?token=<token from ePotpis>"
}

redirectURL is the complete address of the ePotpis page for step 4.

You can also send the user directly to signing in the Certilia mobile app (“Continue on mobile”), without choosing a signing method. In that case, add the following fields to signingData:

Field Description
mobileSign true – the user signs only in the Certilia mobile app. Optional.
oib The signer’s OIB. Required if mobileSign is true.
country The country that issued the identification number, for example HR. Required if mobileSign is true.

The user then needs a valid cloud certificate and an active Certilia mobile app.

When ePotpis answers a request with mobileSign true successfully (HTTP 2xx), redirecting the user in step 4 is not necessary. The user gets a notification in the Certilia mobile app and signs there, and ePotpis then sends the signed data to your server (step 5), which embeds the signature (step 6). Meanwhile redirectURL stays active until the user signs, so you can use it according to the logic of your service. For example, if the signed data does not arrive within a time you set, send the user the link by e-mail. Set that time within the validity of the transaction (expireAt from step 1) and of the prepared file (24 hours for PDF, 20 minutes for XML and JSON).

Redirect the user’s browser to the ePotpis page with the transaction token:

https://esign.test.certilia.com/epotpis/?token=<token from ePotpis>

There the user signs with the Croatian ID card (eOI), a Certilia card, a FINA certificate on a USB device (with the middleware) or a Certilia remote certificate. If signing fails, ePotpis, depending on the error, offers the user another attempt or informs them that signing is currently not possible.

With mobileSign true this step is not necessary (see the end of step 3).

When the user has signed, ePotpis sends a POST request to your URL for the signed data. Your server exposes this REST service.

POST /eSign/SignPdf HTTP/1.1
Host: service.example.com
Content-Type: application/json
{
"authData": {
"token": "<token from ePotpis>"
},
"signingData": {
"userCertificate": "<signing certificate>",
"documents": [
{
"hash": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
"signedHash": "<signature value>",
"verificationCode": "00000000-0000-0000-0000-000000000001"
}
]
}
}

userCertificate is the signing certificate (X.509) in hexadecimal. For XML and JSON documents each document also has a timeStamp field, the signing time, which is required in step 6.

When you have received the data, respond with HTTP 201:

{
"signingDataResponse": {
"status": "201"
}
}

If you cannot accept it, respond with HTTP 400:

{
"error": {
"status": "400",
"code": "<your error code>",
"title": "<error description>"
}
}

If the user refuses to sign, an error object arrives instead of the signed data (see The user refused to sign).

PATCH /pades/v2 HTTP/1.1
Host: api.test.certilia.com
Authorization: Bearer <signing API key>
Content-Type: application/json
{
"token": "<token from ePotpis>",
"signatureFormat": "pades",
"signatureLevel": "lta",
"userCertificate": "<userCertificate from step 5>",
"tsaAccess": {
"url": "https://tsa.test.certilia.com/qts",
"username": "<TSA username>",
"password": "<TSA password>"
},
"documents": [
{
"verificationCode": "00000000-0000-0000-0000-000000000001",
"hash": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
"signedHash": "<signedHash from step 5>"
}
]
}

Response:

{
"token": "<token from ePotpis>",
"documents": [
{
"verificationCode": "00000000-0000-0000-0000-000000000001",
"documentName": "Contract 2026-001.pdf",
"base64Document": "JVBERi0xLjcK...",
"mimeType": "pdf"
}
]
}

Use userCertificate and signedHash (and, for XML and JSON, timeStamp) unchanged from the data ePotpis sent in step 5, and hash from the response of step 2. Choose the signature level with signatureLevel (b, t, lt or lta); for t, lt and lta, send the access data of your time stamp service in tsaAccess. The examples use level lta; guidance on choosing a level is given on the Signature levels and time stamps page.

base64Document in the response of step 6 holds the signed document. Decode it from Base64 and save it.

The signed PDF. If the document has a visual, it carries a link and a QR code for verifying the signature in ePotpis (verification web application: https://esign.certilia.com/provjera). Verifying the signature in Acrobat Reader is described on the Signature visual page.

After step 5, ePotpis redirects the user to the success or error URL you registered, with the transaction token (for example https://service.example.com/eSign/Success/?token=<token from ePotpis>). On that page, show the user the outcome and offer them the signed document.

If you registered a URL where you keep signed documents, save them as <verification code>.pdf (for example https://service.example.com/docs/00000000-0000-0000-0000-000000000001.pdf). The user can then retrieve the original signed document during verification.

If the user refuses to sign in the Certilia mobile app, ePotpis sends a POST request to your URL for the signed data (step 5) with an error object instead of the signed data:

{
"error": {
"token": "<token from ePotpis>",
"message": "Korisnik je odbio potpisivanje transakcije putem mobilne aplikacije",
"errorId": "<error id>"
}
}

The message means “The user refused to sign the transaction in the mobile app”. Such a request holds no signature values, so you do not call PostSign. Record the transaction as refused. If the user wants to sign again, open a new transaction.

  • The number of documents in one call is not limited, but the request size is: about 35 MB per call.
  • Other limits, such as the number of calls per minute, follow common practice. The limits are soft: if you exceed the recommended values, processing can be considerably slower.
  • Make your documents as compact as possible; upload, download and processing are then faster. For PDF, reduce the resolution of the document and images to the lowest acceptable.
  • A password-protected or encrypted PDF cannot be signed (errors PDF_PASSWORD_PROTECTED and PDF_IS_ENCRYPTED).
  • The prepared file is kept for 24 hours for PDF and for 20 minutes for XML and JSON, and the ePotpis transaction is valid until expireAt. Embed the signature within these limits.