This document describes an API endpoint for retrieving all the historical client data for specific services by providing the client ID and service as request parameters.

Base URL

https://score.cladfy.com/v1

API Endpoint:

GET /client_data/

Request Headers:

Content-Type: application/json
X-API-Key: Your unique API. Please email us at [email protected] for an API Key.

Request Parameters::

  • client_id (query parameter): The ID of the client for which data is requested.
  • service (query parameter): The service for which client data is requested i.e either;
    1. "deposit_score",
    2. "demographic_score", or
    3. "repayment_score"

Example Request Body:

api_key = "YourAPIKey" # Replace with the desired service
client_id = "YourClientID" # Replace with the desired client id
service = "demographic_score"  # Replace with the desired service

# Set headers with the API key
headers = {
    "X-API-Key": api_key
}

# Build query parameters dictionary
params = {
    "client_id": client_id,
    "service": service
}

Response:

On success, the API returns a JSON object containing an array of client data entries. Each entry includes:

  • client_data: The requested client data.
  • results: Results associated with the client data and service.
  • service: The service for which the data was requested.
  • date_time: The date and time the API request was made

Example Response

A request for the client ID number 12345 demographic_score data

Client Data: [
  {'client_data': {'client_id': '12345', 'location': 'city'
    }, 'date_time': '2024-01-21 09: 25: 53', 'results': {'client_id': '12345', 'demographic_score': {'extra_attributes': [
        ], 'max_score': integer, 'missing_attributes': ['age', 'customer_tier', 'marital_status',...
        ], 'score': integer
      }
    }, 'service': 'demographic_score'
  },
  {'client_data': {'client_id': '12345', 'customer_tier': 'tier_2'
    }, 'date_time': '2024-03-05 09: 25: 59', 'results': {'client_id': '12345', 'demographic_score': {'extra_attributes': [
        ], 'max_score': integer, 'missing_attributes': ['age', 'monthly_net_income', 'marital_status',...
        ], 'score': integer
      }
    }, 'service': 'demographic_score'
  },
  {'client_data': {'client_id': '12345', 'age': '30'
    }, 'date_time': '2024-4-10 09: 26: 34', 'results': {'client_id': '12345', 'demographic_score': {'extra_attributes': [
        ], 'max_score': integer, 'missing_attributes': ['monthly_net_income', 'customer_tier', 'marital_status',...
        ], 'score': integer
      }
    }, 'service': 'demographic_score'
  }
]

Error Handling:

401 Unauthorized: If the API key is invalid.
400 Bad Request: If the request body is not valid JSON or missing required fields.
500 Internal Server Error: If an internal server error occurs during score calculation. The response will include an error message.


Python Test Example:

The following Python code demonstrates how to make a test API call to retrieve client data: It sends a GET request with headers and query parameters.

import requests
import json

# Define the API endpoint URL
url = "https://score.cladfy.com/v1/client_data/"

api_key = "YourAPIKey" # Replace with the desired service
client_id = "YourClientID" # Replace with the desired client id
service = "demographic_score"  # Replace with the desired service

# Set headers with the API key
headers = {
    "X-API-Key": api_key
}

# Build query parameters dictionary
params = {
    "client_id": client_id,
    "service": service
}

# Send a GET request with headers and query parameters
response = requests.get(url, headers=headers, params=params)

# Check for successful response
if response.status_code == 200:
    # Parse the JSON response
    data = response.json()
    print("Client Data:", data)  # Access the retrieved data
else:
    print(f"Error: {response.status_code}")
    print(response.text)  # Might contain error details



cURL Test Example:

This curl command demonstrates sending a GET request to the API endpoint.

#curl -X GET https://score.cladfy.com/v1/client_data/ -H "X-API-Key: YourAPIKey" -G -d "client_id=client_id&service=service"

Important Note: https://score.cladfy.com/v1/client_data/ is the actual URL of your Client Data API and you should replace "YOUR_API_KEY" with your actual API key before running the script.