A service of Bangladesh Computer Council, Government of Bangladesh
ICT DivisionBangladesh Computer Council
API documentation

Integrate eSign into your systems.

Use the BCC-CA eSign API to request certificate-based signatures from your business app. Each signature is authorised by the user in QuickPass.

Overview

All endpoints accept and return JSON over HTTPS. The documented base URL is the staging environment:

https://staging-esign.bcc-ca.gov.bd:8443

You need client credentials and an organisation identity token (id-token) for your business app. Contact BCC-CA to get access.

Integration flow

  1. Register the signer in the QuickPass app, using their mobile number as the username. This is needed only once per user. See the QuickPass registration guide.
  2. Get an access token using your client username and password.
  3. Get the user’s certificate from your business app.
  4. Generate the digest of the PDF or XML data in your business app, using the user certificate.
  5. Send a sign request for the digest on the user’s behalf. The user authorises it in QuickPass.
  6. If authorisation succeeds, merge the returned signature into the document in your business app.

Headers

HeaderValueUsed by
Content-Typeapplication/jsonAll requests
AuthorizationBearer <access-token>All requests except Get access token
id-tokenYour organisation identity tokenSign data or digest, Bulk sign

Response format

Responses share the fields below. The result is in data. Always check status: some failures, such as invalid credentials, return HTTP 200 with status: false.

FieldTypeDescription
statusCodeNumberHTTP status code, e.g. 200, 400, 500
statusTextStringHTTP status text, e.g. OK, BAD_REQUEST
datetimeStringResponse time
statusBooleantrue or false. Always check this to see whether the request succeeded.
dataObjectThe result if the request succeeded; otherwise the reasons for failure, if available.
messageStringSummary of the response
pathStringRequest path (optional)

HTTP status codes

CodeMeaning
200Success
400Bad request
404Not found
500Internal server error

Get access token

POST/api/auth/signin

Authenticate your business app with its client credentials. Use the returned access token as a Bearer token in the other calls.

Headers

HeaderValue
Content-Typeapplication/json

Request body

FieldTypeDescription
usernameStringClient username
passwordStringClient password

Response

FieldTypeDescription
usernameStringAuthenticated username
emailStringAuthenticated user’s email
accessTokenStringAccess token, if authentication succeeded
tokenTypeStringToken type (Bearer)
rolesArrayRoles for this user

Example request

curl -X POST "https://staging-esign.bcc-ca.gov.bd:8443/api/auth/signin" \
  -H "Content-Type: application/json" \
  -d '{
  "username": "<client-username>",
  "password": "<client-password>"
}'

Example response · 200 Success

{
  "id": 17,
  "username": "<client-username>",
  "email": "client@example.com",
  "roles": [
    "ROLE_USER"
  ],
  "accessToken": "<access-token>",
  "tokenType": "Bearer"
}

Example response · 200 Invalid credentials

{
  "statusCode": 0,
  "statusText": null,
  "datetime": "2022-10-25 07:01:07 AM",
  "status": false,
  "data": null,
  "message": "Error: Username or password is invalid",
  "path": null
}

Get user certificate

POST/api/v1/user-certificate

Fetch the signer’s certificate. Use the certificate to build the digest, and pass key_alias as credId when you sign.

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer <access-token>

Request body

FieldTypeDescription
userIdStringThe user’s 11-digit mobile number, starting with 0 and without the country code, e.g. 0174519****.

Response data

FieldTypeDescription
user_idStringThe user’s mobile number
key_aliasStringCredential ID of the remote key and certificate
key_statusStringStatus of the key and certificate, e.g. ACTIVE
certificateStringBase64-encoded user certificate
certificate_chainStringBase64-encoded user certificate chain

Example request

curl -X POST "https://staging-esign.bcc-ca.gov.bd:8443/api/v1/user-certificate" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -d '{
  "userId": "01XXXXXXXXX"
}'

Example response · 200 Success

{
  "statusCode": 200,
  "statusText": "OK",
  "datetime": "2022-10-27 12:22:36 PM",
  "status": true,
  "data": {
    "user_id": "01XXXXXXXXX",
    "key_alias": "01XXXXXXXXX_<uuid>",
    "key_status": "ACTIVE",
    "certificate": "<base64-certificate>",
    "certificate_chain": "<base64-certificate-chain>"
  }
}

Example response · 400 User not found

{
  "statusCode": 400,
  "statusText": "BAD_REQUEST",
  "datetime": "2022-10-27 12:29:27 PM",
  "status": false,
  "data": null,
  "message": "UserId doesn't exist - 123456",
  "path": null
}

Sign data or digest

POST/api/v1/sign

Request a signature on a digest you calculated in your business app. The user must authorise the request in QuickPass before the signature is returned.

  • Calculate the digest of the PDF or XML document in your business app, using the user certificate.
  • Pass the key_alias from Get user certificate as credId.
  • The data type is always HASH, so there is no dataType parameter.

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer <access-token>
id-tokenYour organisation identity token

Request body

FieldTypeDescription
userIdStringThe user’s 11-digit mobile number, starting with 0 and without the country code, e.g. 0174519****.
tranIdStringA tracking ID defined by your business app
credIdStringThe key_alias value from Get user certificate
documentNameStringDocument name
inputDataStringBase64-encoded digest of the PDF or XML data

Response data

FieldTypeDescription
userIdStringThe user’s mobile number
tranIdStringYour tracking ID
signatureStringSignature value of the digest

Example request

curl -X POST "https://staging-esign.bcc-ca.gov.bd:8443/api/v1/sign" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -H "id-token: <id-token>" \
  -d '{
  "userId": "01XXXXXXXXX",
  "tranId": "123456",
  "credId": "<key_alias>",
  "documentName": "test name",
  "inputData": "MUswGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAvBgkqhkiG9w0BCQQxIgQgP5zPV3pkDnR3G4BPWUajE1gicNR1xOpVbODgUlHm7S8="
}'

Example response · 200 Success

{
  "statusCode": 200,
  "statusText": "OK",
  "datetime": "2023-08-11 01:48:48 AM",
  "status": true,
  "data": {
    "userId": "01XXXXXXXXX",
    "tranId": "123456",
    "signature": "<base64-signature>"
  },
  "message": "Signing is successful",
  "path": "/api/v1/sign"
}

Example response · 400 Invalid credential

{
  "statusCode": 400,
  "statusText": "BAD_REQUEST",
  "datetime": "2022-10-25 08:28:03 AM",
  "status": false,
  "data": null,
  "message": "Invalid CredId - <credId> Please try with a valid certificate",
  "path": null
}

Example response · 400 Invalid digest

{
  "statusCode": 400,
  "statusText": "BAD_REQUEST",
  "datetime": "2022-10-25 08:28:21 AM",
  "status": false,
  "data": null,
  "message": "Failed to process request - DTBS is an invalid base64 data",
  "path": null
}

Bulk sign

POST/api/v1/bulk/sign

Request signatures on several digests for the same user and credential in one call.

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer <access-token>
id-tokenYour organisation identity token

Request body

FieldTypeDescription
userIdStringThe user’s 11-digit mobile number, starting with 0 and without the country code, e.g. 0174519****.
credIdStringThe key_alias value from Get user certificate
tranIdStringA tracking ID defined by your business app
dataArrayThe documents to sign
data[].documentNameStringDocument name
data[].inputDataStringBase64-encoded digest of the PDF or XML data

Example request

curl -X POST "https://staging-esign.bcc-ca.gov.bd:8443/api/v1/bulk/sign" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -H "id-token: <id-token>" \
  -d '{
  "userId": "01XXXXXXXXX",
  "credId": "<key_alias>",
  "tranId": "123456",
  "data": [
    {
      "documentName": "test name",
      "inputData": "MUswGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAvBgkqhkiG9w0BCQQxIgQgP5zPV3pkDnR3G4BPWUajE1gicNR1xOpVbODgUlHm7S8="
    },
    {
      "documentName": "test name",
      "inputData": "MUswGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAvBgkqhkiG9w0BCQQxIgQgP5zPV3pkDnR3G4BPWUajE1gicNR1xOpVbODgUlHm7S8="
    }
  ]
}'

No example response is published for this endpoint.

Get user info (optional)

POST/api/v1/user/info

Look up a registered user’s details and status.

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer <access-token>

Request body

FieldTypeDescription
userIdStringThe user’s 11-digit mobile number, starting with 0 and without the country code, e.g. 0174519****.

Response data

FieldTypeDescription
user_idStringMobile number used as the user ID
user_nameStringThe user’s full name
user_emailStringRegistered email
statusStringCurrent status

Example request

curl -X POST "https://staging-esign.bcc-ca.gov.bd:8443/api/v1/user/info" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -d '{
  "userId": "01XXXXXXXXX"
}'

Example response · 200 Success

{
  "statusCode": 200,
  "statusText": "OK",
  "datetime": "2024-05-09 01:46:53.128 PM",
  "status": true,
  "data": {
    "user_id": "01XXXXXXXXX",
    "user_name": "FULL NAME",
    "app_name": "SigningHubApp",
    "user_email": "user@example.com",
    "user_mobile": "+8801XXXXXXXXX",
    "status": "ACTIVE",
    "created_at": "2024-01-11 11:55:48",
    "profile_id": "adss:sam:profile:004"
  },
  "message": "User info is found",
  "path": null
}

Example response · 400 User not found

{
  "statusCode": 400,
  "statusText": "BAD_REQUEST",
  "datetime": "2022-10-27 12:29:27 PM",
  "status": false,
  "data": null,
  "message": "UserId doesn't exist - 123456",
  "path": null
}

Changelog

11 August 2023

  • dataType was removed from Sign data or digest. HASH is the only data type.
  • Sign requests must pass the id-token header.
  • The response returns the tracking ID and user ID.
  • The data attribute changed from a string to an object.

27 February 2023

  • The endpoint changed from /sign-hash to /sign.
  • xmlData was renamed to inputData, and xmlType to dataType.