# Batch Enroll API for Pre-Provisioning
source: https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/enroll_api_async_pre_provisioning/index.md

[Batch Enroll API](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/enroll_api_async_pre_provisioning/index.md#api-specification) allows Issuers to pre-provision single or multiple cardholders into Click to Pay in a single batch request. Upon successful pre-provisioning, the cardholder credentials are placed in a bulk pre-provisioning database.

### Pre-requisites {#pre-requisites}

1. Get onboarded with Mastercard Click to Pay. Refer to the [tutorial page](https://developer.mastercard.com/issuer-enrollment/documentation/tutorials-and-guides/index.md#tutorials) for [onboarding steps](https://developer.mastercard.com/issuer-enrollment/tutorial/issuer-onboarding-click2pay/index.md) and [key management](https://developer.mastercard.com/issuer-enrollment/tutorial/key-management-click2pay/index.md) for accessing APIs.
2. Update necessary Terms and Conditions to offer Click to pay as a default feature in your core banking product before going into production.  
3. [Encrypt](https://developer.mastercard.com/issuer-enrollment/tutorial/perform-encryption/step2/index.md) the `enrollmentData` object (containing card and consumer details) to be passed to Enroll API.

### Detailed steps {#detailed-steps}

1. Call the [Batch Enroll API](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/enroll_api_async_pre_provisioning/index.md#api-specification) to start the pre-provisioning.
   Ensure the following while using the API:

   * Generate and pass the `externalBatchID` along with the `srcClientId` and `serviceId` in the API request. Mastercard will respond with the `batchId` and `externalBatchId` on successful enablement.
   * Include the following data as part of the API request:
     * Email address.
     * Mobile number with country code.
     * Card details with Primary Account Number and expiry date.
     * Cardholder address.
     * First and last name of cardholder.
     * Locale with country and language.
     * `externalCardId` for each card in the batch.
     * `externalConsumerId` for each consumer in the batch.
     * Compliance settings (optional).
2. On successful enablement, you will receive a `batchId` in the API response that can be used to [fetch batch status](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/batch_status/index.md).

3. Once the cards are pre-provisioned, consumers can review and provision their cards in Click to Pay.

Diagram pre-provisioning-with-enroll-api Note:   
Once the eligible cards are pre-provisioned, it may take some time to display the cards as the pre-provisioning process is asynchronous.

For more details, refer to [FAQs](https://developer.mastercard.com/issuer-enrollment/documentation/support/index.md#related-to-auto-enablement).

### Checkout {#checkout}

Once the pre-provisioning is successfully completed, the cardholder can sign in to Click to Pay and provision their cards before performing the checkout.

![Pre-Provisioning UX Flow](https://static.developer.mastercard.com/content/issuer-enrollment/documentation/img/pre-provisioning-ux-flow.jpg "Pre-Provisioning UX Flow")

If any consumer data (such as billing address) is not provided during pre-provisioning by the Issuer, Mastercard will need to collect it during checkout. Mastercard will update the cardholder's profile with the user-provided information.

### API Specification {#api-specification}

* Sandbox
* Production

```Sandbox
https://sandbox.api.mastercard.com/src/api/digital/payments
```

```Production
https://api.mastercard.com/src/api/digital/payments
```

Note: Refer to [Card Encryption](https://developer.mastercard.com/issuer-enrollment/tutorial/perform-encryption/index.md) tutorial for details on how to encrypt a sample unencrypted **enrollmentData** object.
API Specification: `https://static.developer.mastercard.com/content/issuer-enrollment/swagger/prev-prov-batch-enrollment.yml`

