A PDF generated via the API can be signed with an electronic signature. Simply add the report-sign=true parameter to your request and have a valid personal certificate uploaded in ABRA Flexi.
Request
GET /c/{firma}/faktura-vydana/1.pdf?report-sign=true
If the certificate is valid, a signed PDF will be returned. If not, the request will fail with a 400 error:
Nemáte naimportován žádný platný certifikát. Nelze vyexportovat podepsané PDF.
ℹ️ Without the parameter (or with report-sign=false), a regular unsigned PDF is returned. Signing therefore never happens automatically.
Certificate
Personal certificates are stored in the certifikat record, and each one is linked to a user:
GET /c/{firma}/certifikat.xml?detail=full
In the list you'll find certNazev, certOrgan, validity (platiOd, platiDo), the linked user, and the purpose (ucelCertK.osobni). A certificate can also be uploaded via the API:
PUT /c/{firma}/certifikat/import?heslo={heslo certifikátu}
Content-Type: application/x-pkcs12 (soubory .p12, .pfx)
Content-Type: application/x-pem-file (soubory .pem, .cer, .crt)
⚠️ For signing to work, the user under which you call the API must have exactly one valid personal certificate. It can also be uploaded through the application — for an API user, you'll need to temporarily switch their type to Normal, upload the certificate, and then switch the type back.
💡 An imported certificate can also be used to sign data other than print reports — the /c/{firma}/certifikat/{id}/sign endpoint can sign PDF, XML, and binary files (optionally in PKCS#7 format using the output=pkcs7 parameter).
