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.
Signing flow
Section titled “Signing flow”- Your server opens a transaction in ePotpis and gets a token and one verification code per document.
- The AdES web API prepares each document (PreSign) and returns its hash.
- Your server submits the hashes to ePotpis.
- Your application redirects the user to the ePotpis page, where the user signs.
- ePotpis sends the signature values and the signing certificate to your URL.
- The AdES web API embeds the signature in the document (PostSign) and returns the signed document.
- ePotpis redirects the user to your success or error page.
1. Open a transaction in ePotpis
Section titled “1. Open a transaction in ePotpis”POST /api/v2/epotpis HTTP/1.1Host: esign.test.certilia.comContent-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.1Host: api.test.certilia.comAuthorization: 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.
POST /xades/v1 HTTP/1.1Host: api.test.certilia.comAuthorization: Bearer <signing API key>Content-Type: application/json
{ "token": "<token from ePotpis>", "signatureFormat": "xades", "signatureType": "sign", "addVisualData": true, "personNaturalData": { "nameSurname": "Ivan Horvat", "pin": "00000000001", "pinCountry": "HR" }, "documents": [ { "verificationCode": "00000000-0000-0000-0000-000000000001", "base64Document": "PD94bWwgdmVyc2lvbj0iMS4wIj8+..." } ]}addVisualData is required. XML has no visible signature like a PDF: with true, the API adds an XML comment to the
signature element with data about the signature (the signer and their OIB, the signing time, the verification link,
the record number and up to three rows of message from firstRowMessage, secondRowMessage and thirdRowMessage);
with false, it leaves them out.
Response:
{ "token": "<token from ePotpis>", "documents": [ { "verificationCode": "00000000-0000-0000-0000-000000000001", "hash": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "mimeType": "xml" } ]}The prepared document is kept on the API server for 20 minutes: within that time the user has to sign and your server has to embed the signature (step 6). The ePotpis transaction is valid longer, but that does not extend this limit. Therefore, prepare the document only when the user is ready to sign.
POST /jades/v1 HTTP/1.1Host: api.test.certilia.comAuthorization: Bearer <signing API key>Content-Type: application/json
{ "token": "<token from ePotpis>", "signatureFormat": "jades", "signatureType": "sign", "addVisualData": true, "personNaturalData": { "nameSurname": "Ivan Horvat", "pin": "00000000001", "pinCountry": "HR" }, "documents": [ { "verificationCode": "00000000-0000-0000-0000-000000000001", "base64Document": "eyJleGFtcGxlIjp0cnVlfQ==", "documentName": "Order 2026-0001.json" } ]}addVisualData is required. JSON has no visible signature like a PDF: with true, the API adds AKD’s hr block with
data about the signature, in the unsigned header etsiU (the signer and their OIB, the signing time, the verification
link, the record number and up to three rows of message from firstRowMessage, secondRowMessage and
thirdRowMessage); with false, it leaves them out.
Response:
{ "token": "<token from ePotpis>", "documents": [ { "verificationCode": "00000000-0000-0000-0000-000000000001", "hash": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "documentName": "Order 2026-0001.json", "mimeType": "json" } ]}The prepared file is kept on the API server for 20 minutes: within that time the user has to sign and your server has to embed the signature (step 6). Therefore, prepare the document only when the user is ready to sign.
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.
3. Submit the hash to ePotpis
Section titled “3. Submit the hash to ePotpis”PATCH /api/v2/epotpis/hash HTTP/1.1Host: esign.test.certilia.comContent-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).
4. Redirect the user to ePotpis
Section titled “4. Redirect the user to ePotpis”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).
5. Receive the signed data
Section titled “5. Receive the signed data”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.1Host: service.example.comContent-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).
6. Embed the signature (PostSign)
Section titled “6. Embed the signature (PostSign)”PATCH /pades/v2 HTTP/1.1Host: api.test.certilia.comAuthorization: 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" } ]}PATCH /xades/v1 HTTP/1.1Host: api.test.certilia.comAuthorization: Bearer <signing API key>Content-Type: application/json
{ "token": "<token from ePotpis>", "signatureFormat": "xades", "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>", "timeStamp": "<timeStamp from step 5>" } ]}For XML, timeStamp is required for every document. It is the signing time in UTC, written as hex-encoded ASCII text
(323032362D31312D31335432333A34323A34305A is 2026-11-13T23:42:40Z). The API writes it into the signature as the
signing time (SigningTime).
Response:
{ "token": "<token from ePotpis>", "documents": [ { "verificationCode": "00000000-0000-0000-0000-000000000001", "base64Document": "PD94bWwgdmVyc2lvbj0iMS4wIj8+...", "mimeType": "xml" } ]}PATCH /jades/v1 HTTP/1.1Host: api.test.certilia.comAuthorization: Bearer <signing API key>Content-Type: application/json
{ "token": "<token from ePotpis>", "signatureFormat": "jades", "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>", "timeStamp": "<timeStamp from step 5>" } ]}timeStamp is the signing time in UTC, written as hex-encoded ASCII text (for example
323032362D31312D31335432333A34323A34305A is 2026-11-13T23:42:40Z). The API writes it into the signature as the
signing time.
Response:
{ "token": "<token from ePotpis>", "documents": [ { "verificationCode": "00000000-0000-0000-0000-000000000001", "base64Document": "<signed document in Base64>", "mimeType": "json" } ]}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.
7. Result
Section titled “7. Result”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.
The signed XML document. The signature (XAdES, enveloped) is inside the document’s root element.
The signed document is a JWS in the JSON serialization: payload holds your JSON document (Base64url), and
signatures the signature with the signer’s certificate.
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.
The user refused to sign
Section titled “The user refused to sign”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.
Limits and recommendations
Section titled “Limits and recommendations”- 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_PROTECTEDandPDF_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.