Initialize signing via smart id Table of contents Endpoint Request body parameter description Request pdf/asice/adoc/bdoc object description Request files object description Response body parameter description Successful response Failed response Sample request Sample response Sample success response Sample failed response Implementation CURL Using php-client Short description
Endpoint Path (Locale: LT) /smartid/sign.json Path (Locale: EN) /en/smartid/sign.json Method POST Request Body Schema application/json
Request body parameter description Key Requirement Type Description access_token Mandatory String API Access Token type Mandatory String Type of the file to be signed. Possible values: pdf, adoc, bdoc, asice country Mandatory String Signer country code: LT, LV, EE message Optional String Message displayed on the phone screen code Mandatory String Personal code related to the phone number signature_position Optional String Position of a visible signature (pdf annotation) in the pdf document. Possible values: auto, left_top, left_bottom, right_top, right_bottom. Unset value is equal to invisible signature signature_page Optional String Page of a visible signature (pdf annotation) in the pdf document. Possible values: first_page, last_page. Default value is last_page certificate_level Optional String Requested SK Smart-ID certificate level. Possible values: QSCD, QUALIFIED. Defaults to QSCD peps Optional Boolean Whether to check PEPs information, default is false
sanctions Optional Boolean Whether to check sanctions information, default is false
pdf Any one of pdf/asice/adoc/bdoc is mandatory Object Follow Request pdf/asice/adoc/bdoc object description asice Any one of pdf/asice/adoc/bdoc is mandatory Object Follow Request pdf/asice/adoc/bdoc object description adoc Any one of pdf/asice/adoc/bdoc is mandatory Object Follow Request pdf/asice/adoc/bdoc object description bdoc Any one of pdf/asice/adoc/bdoc is mandatory Object Follow Request pdf/asice/adoc/bdoc object description
Request pdf/asice/adoc/bdoc object description Request files object description Key Requirement Type Description name Mandatory String Name of the file content Mandatory String Base64 encoded file content digest Optional String Digest of the file
Response body parameter description Successful response Key Type Description status String Status of the request, ok
in this case token String Unique token to be used in future request control_code String Verification code
Failed response Key Type Description status String Status of the request, error
in this case message String Brief message about what is wrong error_code Integer Unique code for the error. Error codes are listed here
Sample request
POST /en/smartid/sign.json HTTP/1.1
Host: app.marksign.local
Content-Type: application/json
{
"access_token": "52900c96-3f60-5307-3719-5948f0191da6",
"type": "pdf",
"country": "LT",
"message": "any message",
"code": "30303039914",
"signature_position": "auto",
"signature_page": "last_page",
"certificate_level": "QUALIFIED",
"peps": true,
"sanctions": true,
"pdf": {
"files": [
{
"name": "demo.pdf",
"content": "JVBERi0xLjUKJbXtrvsKNzYgMCBvYmoKPDwgL0xlbmd0aCA3Ny..........RzdHJlYW0KZW5kb2JqCnN0YXJ0eHJlZgo1MDg5MwolJUVPRgo="
}
]
}
}
Please note that some json values have been truncated in the previous example.
Sample response Sample success response
{
"status": "ok",
"token": "aec29dc7-bde3-8299-6dc6-00686318e538",
"control_code": "9269"
}
Sample failed response
{
"status": "error",
"message": "Invalid parameter [type]: Invalid type",
"error_code": 40001
}
Implementation CURL
curl --location --request POST 'https://app.marksign.local/en/smartid/sign.json' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_token": "52900c96-3f60-5307-3719-5948f0191da6",
"type": "pdf",
"country": "LT",
"message": "any message",
"code": "30303039914",
"signature_position": "auto",
"signature_page": "last_page",
"certificate_level": "QUALIFIED",
"peps": true,
"sanctions": true,
"pdf": {
"files": [
{
"name": "demo.pdf",
"content": "JVBERi0xLjUKJbXtrvsKNzYgMCBvYmoKPDwgL0xlbmd0aCA3Ny..........RzdHJlYW0KZW5kb2JqCnN0YXJ0eHJlZgo1MDg5MwolJUVPRgo="
}
]
}
}'
Please note that some json values have been truncated in the previous example.
Using php-client To use the php-client, please follow the installation and basic usage here , and use AppBundle\GatewaySDKPhp\RequestBuilder\SmartidInitSigningRequestBuilder
as request builder.
$filePath = __DIR__ . '/demo.pdf';
$initSignReq = (new SmartidInitSigningRequestBuilder)
->withType('pdf')
->withCountry('LT')
->withMessage('any message')
->withCode('30303039914')
->withSignaturePosition('auto')
->withSignaturePage('last_page')
->withCertificateLevel('QUALIFIED')
->withPeps(true)
->withsanctions(true)
->withPdf(
(new Files)->setFiles([
(new FileUpload)->setName(basename($filePath))->setContent(base64_encode(file_get_contents($filePath)))
])
)
->createRequest();
$initSignRes = $client->postRequest($initSignReq);
$initSignResArray = $initSignRes->toArray();
var_dump($initSignResArray);