Green Score API Documentation
Endpoint: api/v1/green-score
This endpoint allows you to fetch the green score associated with a given PAN (Permanent Account Number).
Method: GET
Query Parameters:
pan
(string): The PAN for which the green score is requested. This parameter is required.
Response Structure:
Success Response:
- Status:
200 OK
- Content:
{ "pan": "ABCDE1234F", "greenScore": 85.7 }
Error Responses:
-
Status:
400 Bad Request
(Ifpan
is not provided){ "error": "PAN is required" }
-
Status:
404 Not Found
(If the providedpan
does not exist in the database){ "error": "Green score not found for the provided PAN" }
Example Usage:
Request:
GET /green-score?pan=ABCDE1234F HTTP/1.1
Host: example.com
Response:
{
"pan": "ABCDE1234F",
"greenScore": 85.7
}
Notes:
- The green score is fetched from a sample dataset. In production, replace this with a proper database or service call.
- Ensure that the
pan
parameter is URL-encoded if it contains special characters.