Create Loan
POST /api/v1/loans
Description
Creates a new loan in the system, typically associated with trade or export financing. This endpoint is used to manage and record details about loans, including types, amounts, payment terms, and related documentation.
Headers:
tenantId(required): The tenant ID associated with the request. This should be included as a header.userId(required): The user ID of the individual initiating the loan request. This should also be included as a header.countryCode(required): The country code where the loan is being processed. This should be included as a header.
Request Body (application/json): Required. The body should include detailed information about the loan:
{
"loanType": "Export",
"loanAmount": 0,
"productUnitPurchasePrice": 0,
"paymentTenorInDays": 0,
"docLinks": [
{
"name": "Signed Document",
"link": "string"
}
],
"userId": "string",
"tenantId": "string",
"tradeId": "string",
"countryCode": "string"
}
Responses:
- 201 Created: Indicates that the loan has been successfully created. The response typically includes details of the newly created loan entry.
Example Request:
curl -X POST "http://[base_url]/api/v1/loans" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [access_token]" \
-H "tenantId: TEN123" \
-H "userId: USR456" \
-H "countryCode: US" \
-d '{
"loanType": "Export",
"loanAmount": 100000,
"productUnitPurchasePrice": 150,
"paymentTenorInDays": 180,
"docLinks": [
{
"name": "Signed Document",
"link": "http://example.com/signed-document.pdf"
}
],
"userId": "USR456",
"tenantId": "TEN123",
"tradeId": "TRD789",
"countryCode": "US"
}'
Example Response:
{
"message": "Loan created successfully.",
"loanId": "loan123"
}
Error Responses:
- 400 Bad Request: Incorrect or incomplete data for the loan creation.
- 403 Forbidden: The user does not have permission to create a loan entry.
LANGUAGE
CURL REQUEST
curl --request POST \
--url /api/v1/loans \
--header 'accept: application/json' \
--header 'content-type: application/json'
RESPONSE
Click Try It! to start a request and see the response here!