Register Information via API in SmartCheck
Generate digital proofs from any system without accessing the platform.
SmartCheck is a Code Contract feature that allows you to generate unique, secure, and immutable digital evidence in seconds and at an affordable cost.
Below, we detail how you can perform these registrations:
Step 1: Obtain the Authentication Token
First, you must authenticate with the SmartCheck API by sending a POST request to obtain a JWT token. This token will be used in subsequent requests.
Authentication Request (HTTP Request)
POST /login HTTP/1.1
Host: api.codecontract.io
Content-Type: application/json
{
"email": "your_email_address",
"password": "your_password"
}
Expected Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}
The token value must be stored and included in every subsequent request as a Bearer Token in the Authorization header.
Step 2: Certify Data with SmartCheck
Once authenticated, you can certify data using the corresponding endpoint.
Request to Create and Register Merkle Root
This endpoint allows you to create a Merkle tree with your data and register its root on the blockchain.
POST /smartcheck/createTreeAndRegisterMerkleRoot HTTP/1.1
Host: api.codecontract.io
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...
{
"data": [
"data1",
"data2",
"data3"
]
}
Expected Response
{
"merkleRoot": "abc123...",
"transactionId": "tx123...",
"status": "success"
}
This response includes the generated Merkle root, the blockchain transaction ID, and the operation status.
Step 3: Retrieve Proof Details
To verify or retrieve the details of a certification, use the following endpoint and provide the corresponding identifier.
Request to Retrieve Proof Details
GET /smartcheck/reportsProofDetail?reportId=your_report_id HTTP/1.1
Host: api.codecontract.io
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...
Expected Response
{
"reportId": "your_report_id",
"merkleRoot": "abc123...",
"data": [
"data1",
"data2",
"data3"
],
"status": "verified"
}
This response provides details about the certification, including the Merkle root, the certified data, and the verification status.
Summary
✔️ Step 1: Obtain the JWT token via authentication.
✔️ Step 2: Certify your data by creating and registering the Merkle root on the blockchain.
✔️ Step 3: Retrieve certification details as needed.
For more information about the available methods and how to use them, please refer to the full SmartCheck API documentation at:
👉 https://api.codecontract.io/
Remember: all API requests must include the JWT token in the Authorization header using the format: Bearer {token}.
If you need further assistance or have specific questions, feel free to contact the Code Contract support team. 🚀
