Preskoči na sadržaj

Prepare JSON and calculate hash (PreSign)

POST
/jades/v1
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.
Media typeapplication/json

PreSign request: the ePotpis transaction token, the signer data and the documents.

object
token
required

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.

string
>= 1 characters
signatureFormat
required

Signature format.

string
>= 1 characters
signatureType
required

Signature type, the same as signingData.signatureType in the ePotpis transaction:

  • sign: electronic signature.
  • seal: electronic seal.
string
>= 1 characters
addVisualData
required

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.

boolean
personNaturalData

Natural person (signer) data.

object
nameSurname

Name and surname of the natural person.

string
nullable
pin

Personal identification number of the natural person (in Croatia, the OIB).

string
nullable
pinCountry

Country code of the personal identification number.

string
nullable
personLegalData

Legal person (organisation) data.

object
name

Organisation name.

string
nullable
vat

Organisation identification (VAT) number (in Croatia, the OIB).

string
nullable
vatCountry

Country code of the VAT number.

string
nullable
sealName

Seal name, for an electronic seal certificate.

string
nullable
documents
required

Documents to prepare.

Array<object>

One JSON document to prepare.

object
verificationCode
required

Verification code of this document, received from ePotpis when the transaction was created. Use each code for one document only.

string
>= 1 characters
documentName

Optional human-readable name of the document, for display in client services.

string
nullable
base64Document
required

The JSON document to sign, Base64-encoded.

string
>= 1 characters
firstRowMessage

Optional message, row 1. The same field as in the PAdES web API, where it is a row of the visual.

string
nullable
secondRowMessage

Optional message, row 2. The same field as in the PAdES web API, where it is a row of the visual.

string
nullable
thirdRowMessage

Optional message, row 3. The same field as in the PAdES web API, where it is a row of the visual.

string
nullable

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"
}
]
}

The hash of each prepared document.

Media typeapplication/json

PreSign response.

object
token
required

EPotpis transaction token, the same as in the request.

string
>= 1 characters
documents
required

One entry per prepared document.

Array<object>

One prepared document.

object
verificationCode
required

Verification code, the same as in the request.

string
>= 1 characters
hash
required

Hash of the prepared document (96 hexadecimal characters). Send it unchanged to ePotpis for signing, and send it again in the PostSign request.

string
>= 1 characters
documentName

Document name, as sent in the request, for display to the user. Left out if not sent.

string
nullable
mimeType
required

Document type, json.

string
>= 1 characters

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.

Media typeapplication/json

Error response.

object
error

Error details.

object
traceId

Trace identifier. Send it to support when you report a problem.

string
nullable
type

Error type, the group the error belongs to.

string
nullable
code

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.

string
nullable
status

HTTP status code.

integer format: int32
message

Public error name.

string
nullable
description

Localised error description, in Croatian or English. The language is set on the server; the default is Croatian (HR).

string
nullable
info

Additional information about the error.

string
nullable
language

Language of description.

string
nullable
name

Public error name, the same as message (kept for compatibility).

string
nullable

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"
}
}