Prepare JSON and calculate hash (PreSign)
const url = 'https://api.test.certilia.com/jades/v1';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"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"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.test.certilia.com/jades/v1 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "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" } ] }'Prepares each JSON document for signing and returns the hash to be signed in ePotpis.
- Uses the eIDAS JAdES standard.
- Prepares the original document for embedding the signature value.
- Elements with natural and/or legal person data can be used.
- One request can hold one or more JSON documents, for a signature or a seal.
- By default the prepared (presign) file stays on the API server until the signature is created on the
user’s side and the signature value arrives with
PATCH /jades/v1. Prepared files are kept for 20 minutes; the signature can be embedded only within that time.
Authorizations
Odjeljak „Authorizations”Request Bodyrequired
Odjeljak „Request Bodyrequired”PreSign request: the ePotpis transaction token, the signer data and the documents.
object
EPotpis transaction token (a JWT), received from ePotpis when the transaction was created. One token per transaction; a transaction can hold one or more documents.
Signature format.
Signature type, the same as signingData.signatureType in the ePotpis transaction:
sign: electronic signature.seal: electronic seal.
true adds AKD’s hr block with data about the signature to the unsigned header etsiU: the signer and
their identification number from personNaturalData, the signing time, the verification link, the record
number (the verification code) and the message rows from documents[]. false leaves it out.
Natural person (signer) data.
object
Name and surname of the natural person.
Personal identification number of the natural person (in Croatia, the OIB).
Country code of the personal identification number.
Legal person (organisation) data.
object
Organisation name.
Organisation identification (VAT) number (in Croatia, the OIB).
Country code of the VAT number.
Seal name, for an electronic seal certificate.
Documents to prepare.
One JSON document to prepare.
object
Verification code of this document, received from ePotpis when the transaction was created. Use each code for one document only.
Optional human-readable name of the document, for display in client services.
The JSON document to sign, Base64-encoded.
Optional message, row 1. The same field as in the PAdES web API, where it is a row of the visual.
Optional message, row 2. The same field as in the PAdES web API, where it is a row of the visual.
Optional message, row 3. The same field as in the PAdES web API, where it is a row of the visual.
Example
{ "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" } ]}Responses
Odjeljak „Responses”The hash of each prepared document.
PreSign response.
object
EPotpis transaction token, the same as in the request.
One entry per prepared document.
One prepared document.
object
Verification code, the same as in the request.
Hash of the prepared document (96 hexadecimal characters). Send it unchanged to ePotpis for signing, and send it again in the PostSign request.
Document name, as sent in the request, for display to the user. Left out if not sent.
Document type, json.
Example
{ "token": "<token from ePotpis>", "documents": [ { "verificationCode": "00000000-0000-0000-0000-000000000001", "hash": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "documentName": "Order 2026-0001.json", "mimeType": "json" } ]}The request contains invalid values, or another error occurred during PreSign.
All error codes are listed by GET /jades/errors.
Error response.
object
Error details.
object
Trace identifier. Send it to support when you report a problem.
Error type, the group the error belongs to.
Error code. Structure: the first character identifies the API (B for JAdES), the remaining characters
are the error number. Example: B111 is error 111 of the JAdES web API.
HTTP status code.
Public error name.
Localised error description, in Croatian or English. The language is set on the server; the default is
Croatian (HR).
Additional information about the error.
Language of description.
Public error name, the same as message (kept for compatibility).
Example
{ "error": { "traceId": "00000000-0000-0000-0000-000000000000", "type": "HG_INVALID_REQUEST", "code": "B111", "status": 400, "message": "INVALID_PERSON_NAME_SURNAME", "description": "Neispravno ime i prezime osobe.", "info": "Please check your request for parameters and values.", "language": "HR", "name": "INVALID_PERSON_NAME_SURNAME" }}