Skip to main content

Generating Tokens

Each ID type has its own configuration and parameters for generating tokens. Below are the steps to generate a token for the different types:

info

Tokens have a limited lifespan. Each token created is valid for 15 minutes from the time of generation.
Expired tokens will no longer be valid and cannot be used for verification purposes.

POST /initiate/token_verification

Description​

The /initiate/token_verification endpoint serves as the designated pathway for generating tokens required for remote verifications. Ensure that the body parameters are passed in the multipart/form-data format.

Required Body Paramaters (formdata)​

  • id_type: This is a string indicating the type of ID to be verified.
    It should be one of the following options: "GHANA_CARD" | "VOTER" | "PASSPORT" | "DRIVER_LICENCE". For this particular request, the idtype is set to "GHANA_CARD".

  • ghanacardnumber: This is a string representing the Ghana Card number of the individual being verified.
    It should follow the format GHA-XXXXXXXXX-X where X represents a digit.

  • send_token_to_client: This parameter has a value of 1, indicating that an SMS will be sent to the individual being verified to receive the token.

  • verificationtype: This parameter has a value of 3

  • phonenumber: This is the phone number of the individual being verified. An SMS containing the verification link will be sent to this number.

  • referenceid: This is a string that can be used to track this verification. In this case, set the referenceid as the client's phone number.

  • purpose: This is a string describing the purpose for the verification, such as "Identity Verification".

  • email: (optional) This is an optional email to send the remote verification link to.

  • with_instructions: (optional) This optional field has a defaults value of 1. Set it to 0 to skip verification guidelines and confirmation screens, proceeding directly to the liveness capture session. Include this parameter if needed.

  • require_location: (optional) This parameter determines whether the user's device location should be captured during the verification process. Set to 1 to enable location capture or 0 to omit it.

  • require_address_location: (optional) This parameter determines whether the user's device home address should be captured after the verification process. Set to 1 to enable home address capture or 0 to omit it.

curl --location 'https://service-prod.metric.africa/api/identification/initiate/token_verification' \
--header 'X-API-AUTH: abcdefghijklmnopqrstuvwxyz' \
--form 'id_type="GHANA_CARD"' \
--form 'ghanacardnumber="GHA-XXXXXXXXX-X"' \
--form 'send_token_to_client="1"' \
--form 'verificationtype="3"' \
--form 'phonenumber="0300000000"' \
--form 'referenceid="0300000000"' \
--form 'purpose="Testing purpose"' \
--form 'email="email@email.com"' \
--form 'with_instructions="1"' \