### API Request Headers Example Source: https://insly-ledger.redocly.app/guides/1_authentication This example demonstrates the essential request headers required for API interactions, including authentication and content type specification. The 'X-TENANT-ID' is specific to the Insly Ledger. ```HTTP Authorization: Bearer {identifier.access_token} Content-Type: application/json; charset=UTF-8 X-TENANT-ID: {tenant_tag} ``` -------------------------------- ### Retrieve Instalments and Totals Data Source: https://insly-ledger.redocly.app/guides/policies_endpoints Retrieves a list of invoices and instalment data associated with a specific policy. This includes detailed information such as invoice number, due date, premium, administrative fees, commissions, and payable amounts, essential for financial tracking and management. ```shell curl -X GET \ 'https://{api_host}/ledger/policy/{policy_id}/instalments' \ -H 'Content-Type: application/json; charset=UTF-8' \ -H 'X-TENANT-ID: {tenant_tag}' ``` -------------------------------- ### Async Request Status Response Example Source: https://insly-ledger.redocly.app/apis/ledger/bundled/async-request Example JSON response for an asynchronous request status. It includes the request ID, the current status ('pending', 'success', or 'failure'), and the data payload if the request is complete. ```json { "requestId": "a202dc2a-9e32-4bb8-8c74-18c73c235129", "status": "success", "data": { "policyId": 286532, "message": "Policy issued" } } ``` -------------------------------- ### Get Schema - cURL Example Source: https://insly-ledger.redocly.app/apis/ledger/bundled/schemes Retrieves a schema definition from the Insly Ledger API using cURL. Requires Authorization and X-TENANT-ID headers. The endpoint is used to fetch schema details based on type and name. ```curl curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/schemes/{type}/regular/{name}' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Allocate Payment using cURL Source: https://insly-ledger.redocly.app/apis/ledger/bundled/payments/insert-payment Provides an example of how to allocate a payment using a cURL request. This includes setting the Authorization and X-TENANT-ID headers. ```curl curl -i -X POST \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/brokerpayments/allocate \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Termination Return Premium Response (JSON) Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-termination/get-policy-termination-premiums Example JSON response for a policy termination return premium calculation. It includes the policy object with termination sum and return amount. ```json { "policy": { "terminationSum": -498.53, "returnAmount": -59.82 } } ``` -------------------------------- ### Allocate Payment using cURL Source: https://insly-ledger.redocly.app/apis/ledger/bundled/payments Provides an example of how to allocate a payment using a cURL request. This involves specifying the endpoint, authorization, and tenant ID. ```curl curl -i -X POST \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/brokerpayments/allocate \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Policy Termination Premium Response Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-termination/terminate-policy Example response for a policy termination premium calculation. It includes the calculated termination sum and the return amount. ```json { "policy": { "terminationSum": -498.53, "returnAmount": -59.82 } } ``` -------------------------------- ### GET /api/v1/ledger/documents/{id} Source: https://insly-ledger.redocly.app/apis/ledger/bundled Download document content. Retrieves the content of a specific document. ```HTTP GET /api/v1/ledger/documents/{id} ``` -------------------------------- ### Policy Termination Premium Response Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-termination Example response structure for a policy termination premium calculation, showing the calculated termination sum and return amount. ```json { "policy": { "terminationSum": -498.53, "returnAmount": -59.82 } } ``` -------------------------------- ### GET /api/v1/ledger/sales/policies/{policyId}/installments-schedule Source: https://insly-ledger.redocly.app/apis/ledger/bundled Get quote installments schedule. Retrieves the schedule for quote installments. ```HTTP GET /api/v1/ledger/sales/policies/{policyId}/installments-schedule ``` -------------------------------- ### Get Installment Schedule Source: https://insly-ledger.redocly.app/apis/ledger/bundled/quote-data Retrieves the installment schedule for a given policy. Requires policy ID and tenant ID. Returns an array of installment objects, each with a due date and premium amount. ```curl curl -i -X GET \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/sales/policies/123/installments-schedule \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` ```json { "instalments": [ { ... } ] } ``` -------------------------------- ### Generate Quote Documents Source: https://insly-ledger.redocly.app/guides/quote_endpoints This endpoint generates all system documents associated with a quote or policy synchronously. It returns the main document, typically an offer, in binary PDF format. Additional documents like terms and conditions or product information may be generated in the background. ```OpenAPI POST /documents/generate Response Body: - Binary PDF file (main document) ``` -------------------------------- ### Get Installment Schedule Source: https://insly-ledger.redocly.app/apis/ledger/bundled/quote-data/get-quote-actions Retrieves the installment schedule for a given policy. Requires policy ID and tenant ID. Returns an array of installment objects, each with a due date and premium amount. ```curl curl -i -X GET \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/sales/policies/123/installments-schedule \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` ```json { "instalments": [ { ... } ] } ``` -------------------------------- ### Get Policy Invoices Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data/get-policy-with-links Fetches a list of invoices associated with a specific policy. Each invoice includes its number, due date, and various commission and premium amounts. Requires policy ID and tenant ID. ```bash curl -i -X GET \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/123/invoices \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Installment Schedule Source: https://insly-ledger.redocly.app/apis/ledger/bundled/quote-data/get-quote-data Retrieves the installment schedule for a given policy. Requires policy ID and tenant ID. Returns an array of installment objects, each with a due date and premium amount. ```curl curl -i -X GET \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/sales/policies/123/installments-schedule \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` ```json { "instalments": [ { ... } ] } ``` -------------------------------- ### Generate Quote Documents Source: https://insly-ledger.redocly.app/apis/ledger/bundled/quote-documents/get-document Generates main quote documents in binary format. Requires JWT for authorization and X-TENANT-ID header. The response contains the generated document. ```curl curl -i -X POST \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/sales/policies/1/generated-documents \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Installment Schedule Source: https://insly-ledger.redocly.app/apis/ledger/bundled/quote-data/quote-get-installments-schedule Retrieves the installment schedule for a given policy. Requires policy ID and tenant ID. Returns an array of installment objects, each with a due date and premium amount. ```curl curl -i -X GET \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/sales/policies/123/installments-schedule \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` ```json { "instalments": [ { ... } ] } ``` -------------------------------- ### Get Policy Data with Links (Python) Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data Retrieves policy data including links using Python. Allows specifying a policy ID and optionally a date format for coverage. Requires tenant ID and language preference for authorization and context. ```python import requests policy_id = 123 tenant_id = "{$inputs.tenant}" token = "" accept_language = "string" force_coverage_date_format = False url = f"https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/{policy_id}/links?forceCoverageDateFormat={force_coverage_date_format}" headers = { 'Accept-Language': accept_language, 'Authorization': f'Bearer {token}', 'X-TENANT-ID': tenant_id } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Customer Policy Custom View Installments Source: https://insly-ledger.redocly.app/apis/ledger/bundled/customers-by-identity Retrieves custom view installments for a customer policy. Requires policy ID, code, document country, and tenant ID. Uses bearer token for authorization. ```curl curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/customers/policies/{policyId}/custom-view/installments?code=string&documentCountry=string' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### POST /api/v1/ledger/sales/policies/create Source: https://insly-ledger.redocly.app/apis/ledger/bundled Create a new quote by schema. This endpoint is used to initiate the quote creation process. The schema for the quote can be obtained from the Schemes section. ```HTTP POST /api/v1/ledger/sales/policies/create ``` -------------------------------- ### Get Customer Policy Custom View Installments Source: https://insly-ledger.redocly.app/apis/ledger/bundled Retrieves customer policy installments based on a custom view, requiring query parameters to match tenant feature customer_identity. This is used for specific customer data retrieval. ```REST GET /api/v1/ledger/customers/policies/{policyId}/custom-view/installments ``` -------------------------------- ### Insert Payment using cURL Source: https://insly-ledger.redocly.app/apis/ledger/bundled/payments Demonstrates how to insert a payment using a cURL request. It includes setting authorization headers, tenant ID, and the payment details in JSON format. ```curl curl -i -X POST \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/brokerpayments \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -H 'X-TENANT-ID: {$inputs.tenant}' \ -d '{ "data": { "broker": { "shortName": "string" }, "paymentSum": 0, "description": "string", "paymentDate": "2019-08-24", "paymentType": "string", "paymentCurrency": "string" } }' ``` -------------------------------- ### Get Customer Policy Custom View Installments (curl) Source: https://insly-ledger.redocly.app/apis/ledger/bundled/customers-by-identity/get-customer-policies-installments-by-identity Retrieves custom view installments for a customer's policy. Requires policy ID, code, document country, and tenant ID. The JWT token is used for authorization. ```curl curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/customers/policies/{policyId}/custom-view/installments?code=string&documentCountry=string' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Quote Financials Source: https://insly-ledger.redocly.app/apis/ledger/bundled/quote-calculation/quote-update-and-calculate Retrieves the financial details for a given quote ID. Requires the quote ID and tenant ID. The response includes premium information and optional installment data. ```curl curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/sales/policies/{id}/calculation' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Generate Quote Documents Source: https://insly-ledger.redocly.app/apis/ledger/bundled/quote-documents Generates main quote documents in binary format. Requires JWT for authorization and X-TENANT-ID header for tenant identification. The response contains the generated document. ```curl curl -i -X POST \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/sales/policies/1/generated-documents \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Policy Total Financials Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data Retrieves the total financial figures for a policy, optionally specifying a version. By default, it returns the latest installment totals. Requires policy ID and tenant ID. ```bash curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/{id}/period-totals' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Credit Invoice by Allocation Event ID (curl) Source: https://insly-ledger.redocly.app/apis/ledger/bundled/invoice/credit-invoice This snippet demonstrates how to credit an invoice using the allocation event ID via a POST request. It includes necessary headers like Authorization and X-TENANT-ID. The endpoint is for the mock server. ```curl curl -i -X POST \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/broker-payments/{eventId}/credit' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Policy Total Financials Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data/get-policy-with-links Retrieves the total financial figures for a policy, optionally specifying a version. By default, it returns the latest installment totals. Requires policy ID and tenant ID. ```bash curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/{id}/period-totals' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Policy Data with Links Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data Retrieves policy data including links. Allows specifying a policy ID and optionally a date format for coverage. Requires tenant ID and language preference for authorization and context. ```curl curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/123/links?forceCoverageDateFormat=false' \ -H 'Accept-Language: string' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Policy Total Financials Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data/get-policy-renewal-data Retrieves the total financial figures for a policy, optionally specifying a version. By default, it returns the latest installment totals. Requires policy ID and tenant ID. ```bash curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/{id}/period-totals' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Policy Total Financials Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data/get-policy-invoices Retrieves the total financial figures for a policy, optionally specifying a version. By default, it returns the latest installment totals. Requires policy ID and tenant ID. ```bash curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/{id}/period-totals' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Policy Data with Links (JavaScript) Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data Retrieves policy data including links using JavaScript. Allows specifying a policy ID and optionally a date format for coverage. Requires tenant ID and language preference for authorization and context. ```javascript const policyId = 123; const tenantId = "{$inputs.tenant}"; const token = ""; const acceptLanguage = "string"; const forceCoverageDateFormat = false; fetch(`https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/${policyId}/links?forceCoverageDateFormat=${forceCoverageDateFormat}`, { method: 'GET', headers: { 'Accept-Language': acceptLanguage, 'Authorization': `Bearer ${token}`, 'X-TENANT-ID': tenantId } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Get Policy Invoices Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data Fetches a list of invoices associated with a specific policy. Each invoice includes its number, due date, and various commission and premium amounts. Requires policy ID and tenant ID. ```bash curl -i -X GET \ https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/123/invoices \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Policy Total Financials Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data/get-policy-period-totals Retrieves the total financial figures for a policy, optionally specifying a version. By default, it returns the latest installment totals. Requires policy ID and tenant ID. ```bash curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/{id}/period-totals' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Policy Data with Links Source: https://insly-ledger.redocly.app/apis/ledger/bundled/policy-data/get-policy-invoices Retrieves policy data along with associated links. Supports an optional query parameter to format coverage dates. Requires policy ID, tenant ID, and language preference. ```curl curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/policies/123/links?forceCoverageDateFormat=false' \ -H 'Accept-Language: string' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Get Quote Financials Source: https://insly-ledger.redocly.app/apis/ledger/bundled/quote-calculation Retrieves financial details for a specific quote using its ID. Requires the quote ID and tenant information. The response includes premium data and an array of fields for UI display, along with optional installment information. ```curl curl -i -X GET \ 'https://insly-ledger.redocly.app/_mock/apis/ledger/bundled/api/v1/ledger/sales/policies/{id}/calculation' \ -H 'Authorization: Bearer ' \ -H 'X-TENANT-ID: {$inputs.tenant}' ``` -------------------------------- ### Policy Termination Endpoint Source: https://insly-ledger.redocly.app/guides/policy_intro This snippet details the `/terminate` endpoint, which allows for the cancellation of an active policy. This is part of the policy lifecycle management. ```Markdown 3. **Termination** - A policy can be cancelled early using the `/terminate` endpoint. ```