Sign PDF width certificate X509

If you find any problem with API, please make an issue at GitHub


3.2 How to sign a PDF document with certificate X509 using API Rest


URL

To sign a PDF width a certificate X509 using our API Rest is necessary to perform a POST call to the following URL (ENDPOINT):

https://getoutpdf.com/api/sign/pdf-with-x509


GET Parameters

Our Rest API does not have operations via GET parameters


POST Parameters

  • api_keyApi key generated for your license. You can see your api key
    (string, required)
  • pdf_inSource PDF encoded in base64
    (string, required)
  • imageSource image encoded in base64
    (string, optional)
  • crtCertificate X509 enconded in base64
    (string, required)
  • crt_private_passwordPrivate certificate password
    (string, required)
  • owner_passwordOwner password of pdf file. If your PDF is encrypted you must to specify it password. If your PDF is not encrypted you can avoid this field
    (string, optional)
  • append_signature_blockAdd (show) signature block on the last page
    (boolean, optional, default: true)
  • lang_signatureLanguage of signature block
    (string, optional, default: en, values: en | es | it | de | pl | cs)

Supported image file formats: jpg, jpeg, exif, tiff, gif, bmp, png, ppm, pgm, pbm, pnm

Supported certificate file formats: pfx, p12


You can make a POST call using the HTML Header application/x-www-form-urlencoded, with the parameters described above.

Or you can send parameters via the JSON format, using the HTML Header application/json:

{
    "api_key" : "...",                  // string, required
    "pdf_in" : "...",                   // string, required
    "image" : "...",                    // string, optional
    "crt" : "...",                      // string, required
    "crt_private_password" : "...",     // string, required, can be empty
    "owner_password" : "...",           // string, optional
    "append_signature_block" : "...",   // boolean, optional, default: true
    "lang_signature" : "..."            // string, optional, default: en, values: en|es|it|de|pl|cs
}

Example

{
    "api_key" : "64b5d1054b69e676b9984d8406c5209a6ba78...",
    "pdf_in" : "JVBERi0xLjQNJeLjz9MNCjYgMCBvYmo8PC9I...",
    "image" : "JVBERi0xLjQNJeLjz9MNCjYgMCBvYmo8PC9I...",
    "crt" : "JVBERi0xLjQNJeLjz9MNCjYgMCBvYmo8PC9I...",
    "crt_private_password" : "passwordCert",
    "owner_password" : "passwordPdf",
    "append_signature_block" : true,
    "lang_signature" : "en"
}

Response

If the operation is successful the response is a JSON with the following structure:

{
    "api_key": "...",       // string - Api key used for your license
    "pdf_base64": "...",    // string - PDF file encoded in base64
    "tokens_used": "...",   // integer - Tokens used in operation
    "tokens_left": "..."    // integer - Tokens left
}

Errors

If an error in sending parameters occurs, the response is a JSON with the following structure:

{
    "errors": {
        "param1": [     // string - Parameter name that generated the error
            "message"   // string - Error description
        ],
        "param2": [
            "message"
        ],
        ...
        "paramN": [
            "message"
        ]
    }
}

If a operation error occurs, the answer will be a JSON with the following structure:

{
    "errors": [
        "message1",
        "message2",
        ...
        "messageN"
    ]
}