Skip to main content Link Search Menu Expand Document (external link) Copy Copied

Initialize authentication via smart id

Table of contents
  1. Endpoint
  2. Request body parameter description
  3. Response body parameter description
    1. Successful response
    2. Failed response
  4. Sample request
  5. Sample response
    1. Sample success response
    2. Sample failed response
  6. Implementation
    1. CURL
    2. Using php-client

Short description

Endpoint

Path (Locale: LT) /smartid/login.json
Path (Locale: EN) /en/smartid/login.json
Method POST
Request Body Schema application/json

Request body parameter description

Key Requirement Type Description
access_token Mandatory String API Access Token
code Mandatory String Personal code related to the phone number
country Mandatory String Country related to person code: LT, LV, EE
message Optional String Message to be displayed on the phone screen
peps Optional Boolean Whether to check PEPs information, default is false
sanctions Optional Boolean Whether to check sanctions information, default is false

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/login.json HTTP/1.1
Host: app.marksign.local
Content-Type: application/json

{
  "access_token": "52900c96-3f60-5307-3719-5948f0191da6",
  "code": "30303039914",
  "country": "LT",
  "message": "any message",
  "peps": true,
  "sanctions": true
}

Sample response

Sample success response


{
  "status": "ok",
  "token": "1c5cd62c-bbf7-779e-3fb4-bad3433ad83f",
  "control_code": "5210"
}

Sample failed response


{
  "status": "error",
  "message": "Invalid parameter [country]: Invalid country code",
  "error_code": 40001
}

Implementation

CURL


curl --location --request POST 'https://app.marksign.local/en/smartid/login.json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "access_token": "52900c96-3f60-5307-3719-5948f0191da6",
  "code": "30303039914",
  "country": "LT",
  "message": "any message",
  "peps": true,
  "sanctions": true
}'

Using php-client

To use the php-client, please follow the installation and basic usage here, and use AppBundle\GatewaySDKPhp\RequestBuilder\SmartidInitAuthRequestBuilder as request builder.


/**
 * The token in response ($initAuthResArray['token'] in this example),
 * might need to be saved for future purposes.
 */
$initAuthReq = (new SmartidInitAuthRequestBuilder)
  ->withCode('30303039914')
  ->withCountry('LT')
  ->withMessage('any message')
  ->withPeps(true)
  ->withsanctions(true)
  ->createRequest();
$initAuthRes = $client->postRequest($initAuthReq);
$initAuthResArray = $initAuthRes->toArray();
var_dump($initAuthResArray);