Preskoči na sadržaj

Prepare XML and calculate hash (PreSign)

POST
/xades/v1
curl --request POST \
--url https://api.test.certilia.com/xades/v1 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "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+..." } ] }'

Prepares each XML document for signing and returns the hash to be signed in ePotpis.

  • One request holds the ePotpis transaction token and one or more documents, each with the verificationCode that ePotpis issued for it.
  • signatureFormat is xades.
Media typeapplication/json

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

object
token
required

EPotpis transaction token, received from ePotpis (the eSign solution) when the transaction was created. One token per transaction; a transaction can hold one or more documents.

string
>= 1 characters
signatureFormat
required

Signature format, xades.

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 an XML comment with data about the signature to the signature element: 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 data.

object
nameSurname

Name and surname of the natural person, as written in the certificate.

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 XML 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
base64Document
required

The XML 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": "xades",
"signatureType": "sign",
"addVisualData": true,
"personNaturalData": {
"nameSurname": "Ivan Horvat",
"pin": "00000000001",
"pinCountry": "HR"
},
"documents": [
{
"verificationCode": "00000000-0000-0000-0000-000000000001",
"base64Document": "PD94bWwgdmVyc2lvbj0iMS4wIj8+..."
}
]
}

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
mimeType

Document type, xml.

string
nullable

Example

{
"token": "<token from ePotpis>",
"documents": [
{
"verificationCode": "00000000-0000-0000-0000-000000000001",
"hash": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
"mimeType": "xml"
}
]
}

The request contains invalid values, or another error occurred during PreSign.

Media typeapplication/json

Error response.

object
error

Error details.

object
type

Error type, the group the error belongs to.

string
code

Error code. The first character identifies the API (7 for XAdES), the rest is the error number.

string
message

Public error name. Rely on code or message in your code, not on description.

string
description

Error description.

string

Example

{
"error": {
"type": "HG_GENERAL_ERROR",
"code": "7111",
"message": "POSTSIGN_BUILD_ERROR",
"description": "Postsign error."
}
}