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
- 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.
- Get an access token using your client username and password.
- Get the user’s certificate from your business app.
- Generate the digest of the PDF or XML data in your business app, using the user certificate.
- Send a sign request for the digest on the user’s behalf. The user authorises it in QuickPass.
- If authorisation succeeds, merge the returned signature into the document in your business app.
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.
| Field | Type | Description |
|---|
statusCode | Number | HTTP status code, e.g. 200, 400, 500 |
statusText | String | HTTP status text, e.g. OK, BAD_REQUEST |
datetime | String | Response time |
status | Boolean | true or false. Always check this to see whether the request succeeded. |
data | Object | The result if the request succeeded; otherwise the reasons for failure, if available. |
message | String | Summary of the response |
path | String | Request path (optional) |
HTTP status codes
| Code | Meaning |
|---|
200 | Success |
400 | Bad request |
404 | Not found |
500 | Internal 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
| Header | Value |
|---|
Content-Type | application/json |
Request body
| Field | Type | Description |
|---|
username | String | Client username |
password | String | Client password |
Response
| Field | Type | Description |
|---|
username | String | Authenticated username |
email | String | Authenticated user’s email |
accessToken | String | Access token, if authentication succeeded |
tokenType | String | Token type (Bearer) |
roles | Array | Roles 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
| Header | Value |
|---|
Content-Type | application/json |
Authorization | Bearer <access-token> |
Request body
| Field | Type | Description |
|---|
userId | String | The user’s 11-digit mobile number, starting with 0 and without the country code, e.g. 0174519****. |
Response data
| Field | Type | Description |
|---|
user_id | String | The user’s mobile number |
key_alias | String | Credential ID of the remote key and certificate |
key_status | String | Status of the key and certificate, e.g. ACTIVE |
certificate | String | Base64-encoded user certificate |
certificate_chain | String | Base64-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
| Header | Value |
|---|
Content-Type | application/json |
Authorization | Bearer <access-token> |
id-token | Your organisation identity token |
Request body
| Field | Type | Description |
|---|
userId | String | The user’s 11-digit mobile number, starting with 0 and without the country code, e.g. 0174519****. |
tranId | String | A tracking ID defined by your business app |
credId | String | The key_alias value from Get user certificate |
documentName | String | Document name |
inputData | String | Base64-encoded digest of the PDF or XML data |
Response data
| Field | Type | Description |
|---|
userId | String | The user’s mobile number |
tranId | String | Your tracking ID |
signature | String | Signature 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
| Header | Value |
|---|
Content-Type | application/json |
Authorization | Bearer <access-token> |
id-token | Your organisation identity token |
Request body
| Field | Type | Description |
|---|
userId | String | The user’s 11-digit mobile number, starting with 0 and without the country code, e.g. 0174519****. |
credId | String | The key_alias value from Get user certificate |
tranId | String | A tracking ID defined by your business app |
data | Array | The documents to sign |
data[].documentName | String | Document name |
data[].inputData | String | Base64-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
| Header | Value |
|---|
Content-Type | application/json |
Authorization | Bearer <access-token> |
Request body
| Field | Type | Description |
|---|
userId | String | The user’s 11-digit mobile number, starting with 0 and without the country code, e.g. 0174519****. |
Response data
| Field | Type | Description |
|---|
user_id | String | Mobile number used as the user ID |
user_name | String | The user’s full name |
user_email | String | Registered email |
status | String | Current 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.