PeerPay

Documentation Overview

Introduction

Welcome to the PeerPay API Documentation. This documentation provides comprehensive information about all available APIs for integrating with PeerPay's services. This overview covers the fundamental concepts, authentication, request/response formats, and base endpoints that apply across all services.

API Basics

All PeerPay APIs follow consistent patterns for authentication, request formatting, and response handling. Understanding these basics will help you integrate with any PeerPay service.

Base API Endpoint URLs

Each service has its own base endpoint URL format. Replace {base_url} with your environment's base URL and {version_name} with the API version (e.g., v1).

ServiceBase Endpoint Format
P2P Credit Service{base_url}/api/{version_name}/p2p-credit
Loans Service{base_url}/api/{version_name}/loancollection
Central Identity Service{base_url}/api/{version_name}/cis

Current P2P Credit Base URL: http://52.208.185.172:8089. Replace {base_url} accordingly when calling P2P Credit endpoints.

Current Loans Service Base URL: http://52.208.185.172:8086. Use this host whenever referencing the Loan Recollection APIs.

Current Central Identity Service Base URL: http://52.208.185.172:8085. Use this host for CIS endpoints (e.g., authorization, token refresh).

Note: For all services, the current {version_name} is v1; update when a new version is released.

Headers

All API requests require specific headers to be included. The following headers are standard across all PeerPay APIs.

HeaderDescription
AuthorizationJWT Bearer Token. Format: Bearer YOUR_JWT_TOKEN
Content-Typeapplication/json - Required for all POST, PUT, and PATCH requests.

Example Request Headers

1{ 2 "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", 3 "Content-Type": "application/json" 4}

HTTP Methods

PeerPay APIs use standard HTTP methods to indicate the type of operation being performed.

MethodDescriptionCommon Use Cases
GETRetrieve dataFetching records, searching, viewing details
POSTCreate new resourcesCreating records, submitting requests, authorization
PUTUpdate existing resourcesUpdating records, modifying data, password changes
DELETERemove resourcesDeleting records (if applicable)

Authorization

Most PeerPay API endpoints require authentication using a JWT Bearer token. To obtain a token, you must first authenticate using the Central Identity Service authorization endpoint.

POST{cis_auth_endpoint_url}/authorization

Request Payload

ParameterTypeRequiredDescription
emailStringYesLogin email address.
passwordStringYesPlain-text password (securely transmitted over TLS).
applicationIdStringYesThe UUID for the application from which login is requested.

Sample Request

1const axios = require('axios'); 2 3const authorize = async () => { 4 try { 5 const response = await axios.post( 6 '{cis_auth_endpoint_url}/authorization', 7 { 8 email: 'emmanuel@gtbank.com', 9 password: 'AdminPeer1234@', 10 applicationId: 'ce58dda3-e800-4205-9e7e-98c756622451' 11 }, 12 { 13 headers: { 14 'Content-Type': 'application/json', 15 'Authorization': '{{apiKey}}' 16 } 17 } 18 ); 19 20 console.log(response.data); 21 } catch (error) { 22 console.error('Error:', error.response?.data || error.message); 23 } 24}; 25 26authorize();

Success Response – HTTP 200:

1{ 2 "status": true, 3 "statusCode": "99", 4 "statusMessage": "Login Successful", 5 "data": { 6 "tokenExpiry": "1751360309", 7 "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obiBEb2UiLCJ1c2VyVHlwZSI6IkFkbWluIiwiZW1haWwiOiJqb2huQGRvZS5jb20iLCJ0b2tlbkV4cGlyeSI6IjE3NTEzNjAzMDkiLCJyb2xlcyI6W3sibmFtZSI6Ik1ha2VyIiwiaWQiOiJkY2M5NTlmMy05MjA2LTRmYTctOTI2Yi1kNDMzMjYxNTJkN2UifSx7Im5hbWUiOiJBZG1pbiIsImlkIjoiZGRmMDc0ODQtYjdlNC00NWQwLWI0MWYtZjc4ZWIzZDBkYWY0In1dLCJVc2VyRGV0YWlscyI6eyJ1c2VyVHlwZSI6IkJhbmsiLCJpZCI6ImRjYzk1OWYzLTkyMDYtNGZhNy05MjZiLWQ0MzMyNjE1MmQ3ZSJ9fQ.BFnAJSQ79GmUxXdOl5ioarhzQSH89BYFKm5X8ZKs9b0" 8 } 9}

Note: Use the returned token in the Authorization header for subsequent API requests as: Bearer YOUR_TOKEN

Requests and Responses

All PeerPay APIs use a consistent request and response format. This section outlines the standard formats you'll encounter.

Request Format

All requests must be sent as JSON with the Content-Type: application/json header. Request bodies vary by endpoint and are documented in each service's specific documentation.

Response Format

All API responses follow a consistent structure with the following fields:

ParameterTypeDescription
statusBooleanOverall status of the request – success (true) or failed (false).
statusCodeStringThe status code for the response.
statusMessageStringThe status message for the response code.
dataObject/ArrayAny extra data that should be sent with the response.

Default Response Payload

Standard successful response format:

1{ 2 "status": false, 3 "statusCode": "21", 4 "statusMessage": "Response Message", 5 "data": {} 6}

Default Error Response Payload – HTTP 401, 403

1{ 2 "status": false, 3 "statusCode": "30", 4 "statusMessage": "UNAUTHORIZED ACCESS REQUEST", 5 "data": {} 6}

Default Error Response Payload – HTTP 400, 500

1{ 2 "status": false, 3 "statusCode": "20", 4 "statusMessage": "Error while performing action", 5 "data": {} 6}

Error Handling

The API uses standard HTTP response codes to indicate success or failure. Always check the status field in the response to determine if the request was successful.

CodeMeaningDescription
200OKThe request was successful.
400Bad RequestInvalid parameters were supplied. The response will contain a descriptive error message.
401UnauthorizedAuthentication failed (invalid or missing token). Returns statusCode "30".
403ForbiddenAccess denied. Returns statusCode "30".
404Not FoundThe requested resource does not exist.
500Server ErrorAn error occurred on the PeerPay server. Returns statusCode "20".