---
schema_version: "1"
id: 3b2b1919023a4db23b3dfd3c610f13a9dcb468cc8b69ab3131cc4cfc64033d8e
title: endorseDraftInsurancePolicy(insurancePolicyDraftProcessInput, policyId)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsuranceBrokerageFamily_endorseDraftInsurancePolicy_1.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsuranceBrokerageFamily_endorseDraftInsurancePolicy_1.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3a69bf02d1876da87ba11b9b518d90c080d36109b9976c82264b3c879de24afd
description: Create an endorsement draft for a specific insurance policy by providing the draft input details and the policy ID.
---
# endorseDraftInsurancePolicy(insurancePolicyDraftProcessInput, policyId)

Create an endorsement draft for a specific insurance policy by providing the draft input details and the policy ID.

## API Version

67.0

## Requires Chatter

No

## Signature

public static ConnectApi.InsurancePolicyDraftOutputRepresentation endorseDraftInsurancePolicy(ConnectApi.InsurancePolicyDraftInputRepresentation insurancePolicyDraftProcessInput, String policyId)

## Parameters

**insurancePolicyDraftProcessInput**

- Type: [ConnectApi.InsurancePolicyDraft​InputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_input_insurance_policy_draft.htm "Input representation for the endorsement draft request. Includes a field value map that specifies the insurance policy fields to override in the draft.")
- Input representation containing the field value map of insurance policy fields to override in the endorsement draft.

**policyId**

- Type: String
- ID of the insurance policy for which to create an endorsement draft.

## Return Value

Type: [ConnectApi.InsurancePolicyDraftOutputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_insurance_policy_draft_output.htm "Output representation for the endorsement draft response. Contains the policy ID of the created draft and any errors that occurred during the process.")

## Usage

Use this method to create an endorsement draft for a specific insurance policy. Provide a field value map containing the policy fields to override and the ID of the policy. The response includes the policy ID of the created draft and any errors that occurred during the process.

## Example

The Apex example shows how to use the ConnectApi.InsuranceBrokerageFamily.endorseDraftInsurancePolicy() method to create an endorsement draft for a specific insurance policy.

**Class Definition**

This Apex example shows how to create an endorsement draft for an insurance policy.

global class DraftEndorseConnectDriver {

    global static void callDraftEndorseConnectAPI() {
        Map<String, Object\> input = new Map<String, Object\>();
        input.put('policyId', '0YTxx000000001dGAA');

        ConnectApi.InsurancePolicyDraftInputRepresentation draftInput = new ConnectApi.InsurancePolicyDraftInputRepresentation();
        Map<String, Object\> fields = new Map<String, Object\>();
        fields.put('Name', 'Test Apex Draft Endorse');
        fields.put('EffectiveDate', '2026-08-01');
        draftInput.fieldValueMap = fields;

        input.put('policyInput', draftInput);

        Map<String, Object\> output = new Map<String, Object\>();
        Map<String, Object\> args = new Map<String, Object\>();
        args.put('input', input);
        args.put('output', output);

        DraftEndorseTestConnectAPI callable = new DraftEndorseTestConnectAPI();
        Object result = callable.call('draftEndorse', args);

        ConnectApi.InsurancePolicyDraftOutputRepresentation policyData =
            (ConnectApi.InsurancePolicyDraftOutputRepresentation) result;
        System.debug('Draft Endorse Policy Data: ' + JSON.serializePretty(policyData));

        if (output.containsKey('error')) {
            System.debug('Error: ' + output.get('error'));
        }
    }
}

**Usage Example**

Use the DraftEndorseTestConnectAPI class to execute the draftEndorse action and process the result.

public class DraftEndorseTestConnectAPI implements System.Callable {

    public Object call(String action, Map<String, Object\> args) {
        Map<String, Object\> inputMap = (Map<String, Object\>) args.get('input');
        Map<String, Object\> outputMap = (Map<String, Object\>) args.get('output');

        if (action == 'draftEndorse') {
            ConnectApi.InsurancePolicyDraftInputRepresentation draftInput =
                (ConnectApi.InsurancePolicyDraftInputRepresentation) inputMap.get('policyInput');
            String policyId = (String) inputMap.get('policyId');
            System.debug('Start of Connect API call to draft endorse policy: ' + policyId);

            ConnectApi.InsurancePolicyDraftOutputRepresentation policyData;
            try {
                policyData = ConnectApi.InsuranceBrokerageFamily.endorseDraftInsurancePolicy(draftInput, policyId);
                System.debug('Draft endorsement created successfully: ' + policyData);
                outputMap.put('policyData', policyData);
            } catch (Exception e) {
                System.debug('Error while creating draft endorsement: ' + e.getMessage());
                outputMap.put('error', e.getMessage());
            }
            return policyData;
        }

        return null;
    }
}

// Execute
DraftEndorseConnectDriver.callDraftEndorseConnectAPI();