Policy/Loan product Queries & Mutations
To Create a Policy
The policyCreate
mutation creates a new policy with the provided input parameters.
GraphQLJSONSample Response
mutation policyCreate($input: CreatePolicyInput!) {
policyCreate(input: $input){
recordId
record {
id
}
}
}
This sample response indicates that the policy creation was successful and provides the recordId
and id
of the newly created policy.
Policy By Id
Retrieves policy information based on the provided policy ID.
Input Variable:
policyByIdId
(required): The ID of the policy for which you want to retrieve information. It must be of typeID!
.
GraphQLInput VariableSample Response
query PolicyById($policyByIdId: ID!) {
policyById(id: $policyByIdId) {
id
}
}
Policies
Retrieve a list of policies based on the provided status
input variable.
Input Variables
status
(optional): Filter policies by their status. Can be one of ACTIVE, INACTIVE, or null to retrieve all policies regardless of status.
GraphQLInput VariableSample ResponseError Handling
query Policies {
viewer {
account {
policies {
totalCount
nodes {
description
id
loanType
name
}
}
}
}
}
Error Handling
If there is an issue with the request, the response will include an "errors" field containing relevant error information.
Get Loan Category Attributes
This query retrieves a list of loan category attributes along with their details.
Input Variable
This query does not require any input variables.
GraphQLSample Response
In the sample response, you can see an array of loan category attributes, each containing various details such as id
, name
, default
, options
, required
, type
, isOverwritable
, data
, category
, and label
. The response demonstrates three attributes belonging to different categories along with their respective values.
GetLoanCategories
getLoanCategories(where: CategoryWhereInput): GetLoanCategoriesResponse
Retrieves loan categories based on the specified criteria which is highlighted in the CategoryWhereInput
object.
Input Fields for CategoryWhereInput
Object
TheCategoryWhereInput
object containing the following fields:
id ID
Filters loan categories by a specific ID.
id_in [ID]
Filters loan categories by a list of IDs.
status LoanCategoryStatus
Filters loan categories by status. This field takes the type LoanCategoryStatus
The LoanCategoryStatus
is an enum type object that takes the following options as strings:
ACTIVE
DISABLED
status_in [LoanCategoryStatus]
Filters loan categories by multiple statuses included in the array.This field takes the type LoanCategoryStatus
The LoanCategoryStatus
is an enum type object that takes the following options as strings:
ACTIVE
DISABLED
status_not_in [LoanCategoryStatus]
Filters loan categories that do not have the status included in the array.This field takes the type LoanCategoryStatus
The LoanCategoryStatus
is an enum type object that takes the following options as strings:
ACTIVE
DISABLED
status_not LoanCategoryStatus
Filters loan categories by status that do not have the specified status.This field takes the type LoanCategoryStatus
The LoanCategoryStatus
is an enum type object that takes the following options as strings:
ACTIVE
DISABLED
Response Fields for getLoanCategories
Query
ThegetLoanCategories
query has the response of type GetLoanCategoriesResponse
The GetLoanCategoriesResponse
is an object that takes an input field of categories
which takes an array of type LoanCategory
i.e. categories: [LoanCategory]
Below are the fields in type LoanCategory
object:
id ID
Required
The ID of the loan category.
name String!
Required
The name of the loan category.
status String
The status of the loan category.
description String
The description of the loan category.
minAmount Float
The minimum loan amount of applications and loans that applies to this loan category.
maxAmount Float
The maximum loan amount of applications and loans that applies to this loan category.
minDuration Int
The minimum loan duration of applications and loans that applies to this loan category.
maxDuration Int
The maximum loan duration of applications and loans that applies to this loan category.
durationType PolicyDurationType
The duration type that applies to applications and loans under this loan category.
The DurationType
is an enum type object that takes the following options as strings:
DAILY
WEEKLY
MONTHLY
ANNUALLY
ONE_OFF
loanCategoryAttributes [LoanCategoryAttribute]
The attributes configured of the loan category. This field takes an array of object of typeLoanCategoryAttribute
.
type LoanCategoryAttribute implements Node { id: ID! loanCategory: LoanCategory! attribute: Attribute! value: String data: JSON createdAt: DateTime! updatedAt: DateTime! }
products [Policy!]
An array of loan products linked to this category.
createdAt DateTime!
The time this category was created.
updatedAt DateTime!
The time this category was last updated.
Sample Input & Sample Response
GraphQLInput VariableSample Response
Create Loan Category
Create a new loan category.
Input Variable
input
: An object containing the following fields:attributes
: An array of objects representing attributes related to the loan category.data
: The data associated with the attribute.id
: The unique identifier of the attribute.value
: The value of the attribute.
description
: A description of the loan category.durationType
: The type of duration for the loan category. Possible values:DAILY
,WEEKLY
,MONTHLY
,ANNUALLY
,ONE_OFF
.isActive
: A boolean indicating whether the loan category is active.maxAmount
: The maximum amount allowed for loans in this category (float).maxDuration
: The maximum duration (in units based ondurationType
) for loans in this category.minAmount
: The minimum amount allowed for loans in this category.minDuration
: The minimum duration (in units based on durationType) for loans in this category.name
: The name of the loan category.products
: The products associated with the loan category.
GraphQLInput VariableSample Response
Link Product To Loan Category
This mutation allows you to link a product to a loan category. It takes an input object containing the necessary information for linking a product to a loan category and returns a response indicating the success of the operation along with any comments.
Input Variables
The LinkProductToLoanCategoryInput
object contains the following fields:
loanCategoryId
(String!): The ID of the loan category to which the product will be linked.products
(String!): The ID of the product that will be linked to the loan category.
GraphQLInput VariableSample Response
In this sample response, the success
field indicates whether the operation was successful, and the comments
field provides additional information about the result of the operation. If success
is true
, the product has been successfully linked to the loan category, and the comments
field will contain a corresponding success message. If the success field is false
, an error occurred, and the comments
field will contain an error message explaining the issue.
Update Loan Category
The UpdateLoanCategory
mutation allows you to update a loan category with new information.
GraphQLInput VariableSample Response
Disable Loan Category
The DisableLoanCategory
mutation allows you to disable a specific loan category.
GraphQLInput VariableSample Response
In the sample response, if the mutation is successful, the success
field will be set to true
. If there is an error, the success
field will be set to false
, and additional error information might be provided in the response.
Enable Loan Category
This mutation allows you to enable a specific loan category by providing its ID.
GraphQLInput VariableSample Response
In the sample response, the success
field will indicate whether the loan category was successfully enabled (true
) or not (false
).
Policy Enable
The PolicyEnable
mutation enables a policy with the given policyEnableId
by changing its status. It returns the recordId
of the policy and its updated status
.
Input Variables
policyEnableId
(required): The ID of the policy that needs to be enabled.
GraphQLInput VariableSample Response
Sample Response
If the mutation is successful, it returns an object containing the following fields:
recordId
: The ID of the policy that was enabled.status
: The updated status of the policy after enabling.
To Disable a Policy
The policyDisable
mutation is used to disable a policy with the specified ID.
GraphQLJSONSample Response
Upon successful execution of the mutation, the API will return a response containing the recordId
and status
of the disabled policy
 To Change The End Date of a Policy
The policyChangeEndDate
mutation, which allows you to change the end date of a policy. This mutation takes an input variable of type ChangeEndDateInput
and returns a response containing the recordId
and the updated endDate
.
GraphQLJSONSample Response
In the sample response, the recordId
represents the unique identifier of the policy that was updated, and the endDate
represents the new end date in ISO 8601 format
.
To Set a Policy to Default
This mutation allows you to set a policy as the default policy.
GraphQLJSONSample Response
policyUpdate
The policyUpdate
mutation updates an existing loan product.
policyUpdate(where: PolicyWhereUniqueInput! data: UpdatePolicyInput!): CreatePolicyPayload
Input Fields for policyUpdate
Mutation
The input field takes two objects of types
PolicyWhereUniqueInput
which specifies the unique identifier of the policy to be updated.UpdatePolicyInput!
which contains the data you'd like to update the loan product with.
PolicyWhereUniqueInput
Required
The type PolicyWhereUniqueInput
containing the following fields:
id ID
Required
The ID of the loan product
UpdatePolicyInput
Required
The type UpdatePolicyInput
containing the following fields:
name String
The name of the loan product
description String
The description of the loan product
status PublicPolicyStatus
The status of the loan product.
The PublicPolicyStatus
is an enum type object that takes the following options as strings:
DRAFT
ACTIVE
DISABLED
interestRate CreateRateInput
The interest rate that applies to applications and loans under this loan product.
The CreateRateInput
is an input object that take the following fields:
name
String
: The name of the interest ratecalcBy
RateCalcBy!
Required : The type of calculating method to which the interest rate should be applied.value
Float!
Required : The value of the interest rate.
taxRate CreateRateInput
The tax rate that applies to applications and loans under this loan product.
The CreateRateInput
is an input object that take the following fields:
name
String
: The name of the tax ratecalcBy
RateCalcBy!
Required : The type of calculating method to which the tax rate should be applied.value
Float!
Required : The value of the tax rate.
processingFee CreateRateInput
The processing fee that applies to applications and loans under this loan product.
The CreateRateInput
is an input object that take the following fields:
name
String
: The name of the processing fee.calcBy
RateCalcBy!
Required : The type of calculating method to which the processing fee should be applied.value
Float!
Required : The value of the processing fee.
minLoanAmount Float
The minimum loan amount that applies to applications and loans under this loan product.
maxLoanAmount Float
The maximum loan amount that applies to applications and loans under this loan product.
minLoanDuration Int
The minimum loan duration that applies to applications and loans under this loan product.
maxLoanDuration Int
The maximum loan duration that applies to applications and loans under this loan product.
durationType DurationType
The duration type that applies to applications and loans under this loan product.
The DurationType
is an enum type object that takes the following options as strings:
DAILY
WEEKLY
MONTHLY
ANNUALLY
ONE_OFF
repaymentType RepaymentType
The repayment type that applies to applications and loans under this loan product.
The RepaymentType
is an enum type object that takes the following options as strings:
DAILY
WEEKLY
MONTHLY
ANNUALLY
ONE_OFF
latePaymentWarningDue Int
The number of days that serve as a grace period before late fees start applying to overdue loans under this loan product.
maxLateFeeDuration Int
The maximum number of days late fees accumulate on overdue loans under this loan product.
endDate DateTime
The end date of the loan product.
startDate DateTime
The start date of the loan product.
onAssignedAction PolicyAssignedAction
The approval status that applies to loans under this loan product.
The PolicyAssignedAction
is an enum type object that takes the following options as strings:
APPROVED
UNDER_REVIEW
DENIED
approvalWorkflowId ID
The approval workflow ID assigned to this loan product.
ruleSetIds [ID!]
The IDs of the rule set templates assigned to this loan product.
loanType LoanType
The loan type that applies to applications and loans under this loan product.
The LoanType
is an enum type object that takes the following options as strings:
REGULAR
GRADUATED
graduatedLoanCycles [CreateGraduatedLoanCycle!]
The loan cycles that apply to loans that under this loan product of loan type graduated.
The [CreateGraduatedLoanCycle!]
is an input array of object that take the following fields:
amount
Float
Required: The loan amount of a cycle.interestRate
Float
Required: The interest rate of a cycle.maxLoanDuration
Int
Required: The maximum loan duration of a cycle.repaymentCount
Int
Required: The number of times the cycle should be repeated before proceeding to the next cycle.
lateFeeCalculation LateFeeCalculationInput
The late fees calculation method that apply to loans under this loan product.
The LateFeeCalculationInput
is an input object that take the following fields:
lateFeeChargeOn
LateFeeChargOn
Required : This specifies the figure on which fee is calculated. This field takes an input ofLateFeeChargOn
.
TheLateFeeChargOn
is an enum type object that takes the following options as strings:ON_PRINCIPAL_PORTION
ON_OUTSTANDING_PORTION
lateFeeFrequency
LateFeeFrequency
Required : This is the frequency at which fee is applied. This field takes an input of typeLateFeeFrequency
.
TheLateFeeFrequency
is an enum type object that takes the following options as strings:ONE_OFF
RECURRENT
penaltyDelay
Int
:This specifies the delay in days before penalty applies.rate
CreateRateInput
Required : This is the percentage/fixed fee value. This field takes an input ofCreateRateInput
.
The CreateRateInput
is an input object that take the following fields:
name
String
: The name of the processing fee.calcBy
RateCalcBy!
Required : The type of calculating method to which the processing fee should be applied.value
Float!
Required : The value of the processing fee.
interestCalculationMethod InterestCalclationType
The interest calculation method that apply to loans under this loan product.
The InterestCalclationType
is an enum type object that takes the following options as strings:
flat_interest_calculation
declining_balance_with_equal_installments
allowEarlyRepayment Boolean
This refers to whether you wanted to allow loans under this loan product to be repaid before the repayment due date.
offerLetterEnabled Boolean
This refers to whether you wanted to use the offer letter feature on your loan product.
validityInDays Int
This is the number of days the loan product is valid for.
applicationForm: JSON
This is the form builder application form that will be available to the customer linked to this loan product.
Sample Input & Response
GraphQLJSONSample Response
Sample Response Fields
policyUpdate (
PolicyUpdatePayload
): Contains the information about the updated policy.recordId (
ID!
): The ID of the updated policy.record (
Policy
): The updated policy object.id (
ID!
): The ID of the policy.
To Update The Priority of a policy
The policyUpdatePriority
mutation is used to update the priority of a policy record. This API allows you to modify the priority of a policy and retrieve information about the updated record.
Input Variable
The mutation requires an input variable of type UpdatePolicyPriorityInput
. This input should contain the following fields:
id
(String, required): The ID of the policy record you want to update.increment
(Boolean, required): A flag indicating whether to increment the priority (true
) or decrement it (false
).
GraphQLJSONSample Response
Sample Response Fields
The mutation returns an object with the following fields:
recordId
(String): The ID of the updated policy record.record
(Object): The updated policy record object with its fields.
To Delete a Policy
The policyDelete
mutation allows you to delete a policy by providing its unique identifier.
GraphQLJSONSample ResponseSample Error
Sample Errors
If the mutation encounters an error, it will return an error response. The response will contain an array of error objects, each having the following fields:
message: A human-readable error message describing the issue.
code: A machine-readable error code for easier debugging.
To List Policy Rule Types
The policyRuleTypes
query allows you to retrieve a list of policy rule types based on specified criteria.
GraphQLJSONSample Response
interestCalculationMethods
GraphQLJSONSample Response