# Check Batch Enrollment Status
source: https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/batch_status/index.md

After submitting a [batch enablement request](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/index.md#enroll-api-asynchronous), an issuer uses the Batch Status API to determine whether Mastercard successfully processed the batch. You can use the overall batch status and record-level results to identify successfully enabled consumers and credentials and resolve any failed records.

Provide the `batchId` returned by the Batch Enroll API in the Batch Status API request. Use the returned `externalConsumerId` and `externalCredentialId` to reconcile the results with the corresponding records in your system and take action on any failures.

### Before you begin {#before-you-begin}

Complete the following steps before checking the batch enrollment status:

1. Submit an asynchronous request to the [Batch Enroll API](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/index.md#batchCredentialsInDirectory).
2. Retain the `externalBatchId` value submitted in the enrollment request.
3. Retrieve the `batchId` from the **202 Accepted** response.

Note: A **202 Accepted** response from the Batch Enroll API confirms that Mastercard accepted the enrollment request for processing. It does not confirm that Mastercard successfully enabled the submitted consumers or credentials. Use the Batch Status API to retrieve the processing result.

## Check the Batch Status {#check-the-batch-status}

Along with other required paramaters, send the `batchId` in the Batch Status API request to retrieve the current batch status and the result for each processed enrollment record.
Diagram autoenrollapibatch

See the endpoint structure:


API Reference: `GET /client-directories/{directoryId}/credentials/batch/{batchId}`

<br />

The response identifies:

* The overall processing status of the batch.
* The processing result for each submitted consumer.
* The processing result for each credential associated with the consumer.
* The reason for any failed enrollment record.
* The programs enabled for each successfully enrolled credential, where applicable.   

Use the returned `externalConsumerId` and `externalCredentialId` values to correlate each result with the corresponding record in your system.

### Poll for the batch result {#poll-for-the-batch-result}

If Mastercard is still processing the batch, wait for the polling interval agreed with Mastercard before sending another Batch Status API request.

Continue polling while the API returns `SUBMITTED` or `PROCESSING`. Stop polling when the API returns a terminal status:

* `COMPLETED_SUCCESSFULLY`
* `COMPLETED_WITH_FAILURES`
* `FAILED`

Note: Follow the polling interval agreed with Mastercard during integration and testing. Do not send status requests more frequently than the agreed interval.

## Understand the Response {#understand-the-response}

The batch-level status describes the processing result for the complete batch. Review the individual enrollment records to determine the result for each submitted consumer and credential.

### Batch-level statuses {#batch-level-statuses}

|       Batch status        |                                  Meaning                                   |                                                       Next action                                                       |
|---------------------------|----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
| `SUBMITTED`               | Mastercard received the batch and has not completed processing it.         | Wait for the agreed polling interval, then check the status again.                                                      |
| `PROCESSING`              | Mastercard is processing the enrollment records.                           | Continue polling at the agreed interval.                                                                                |
| `COMPLETED_SUCCESSFULLY`  | Mastercard processed the batch successfully.                               | Stop polling and reconcile the returned consumer and credential results with your submitted records.                    |
| `COMPLETED_WITH_FAILURES` | Mastercard processed the batch, but one or more enrollment records failed. | Stop polling, identify the failed records, review their failure reasons, and resubmit corrected records in a new batch. |
| `FAILED`                  | Mastercard could not successfully process the batch.                       | Stop polling, review the returned errors, correct the request, and submit a new batch.                                  |

### Enrollment record results {#enrollment-record-results}

Each enrollment record reports the processing result for an individual consumer and the associated credentials.

Use the enrollment records to determine:

* Which consumers Mastercard processed successfully.
* Which credentials Mastercard enabled successfully.
* Which consumers or credentials failed enrollment.
* Why an enrollment record failed.
* Which records require correction or further action.   

A batch with a status of `COMPLETED_WITH_FAILURES` can contain both successful and failed enablement records. Do not resubmit records that Mastercard enabled successfully.

Retain the relationship between each `externalConsumerId`, `externalCredentialId`, and the corresponding entities in your system. Use these identifiers to reconcile the Batch Status API response with the original batch request.

## Handle Failed Enrollment Records {#handle-failed-enrollment-records}

If the response contains failed enrollment records:

1. Identify each failed consumer or credential by its `externalConsumerId` or `externalCredentialId`.
2. Review the failure reason returned for the enablement record.
3. Correct the data that caused the failure.
4. Submit the corrected records through the [Batch Enroll API](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/index.md#batchCredentialsInDirectory).
5. Retrieve the new `batchId` from the Batch Enroll API response.
6. Use the new `batchId` to check the processing result of the new batch.   

Do not include successfully enabled records when resubmitting failed records.

## Handle HTTP Errors {#handle-http-errors}

If the Batch Status API returns an HTTP error:

1. Review the HTTP status and error details in the response.
2. Confirm that the request contains the correct `directoryId` and `batchId`.
3. Correct any invalid request data before retrying the request.
4. Follow the retry guidance associated with the returned error.
5. Contact your Mastercard representative if the error persists or the response identifies a non-retryable condition.   

For complete HTTP status definitions and response details please visit our [codes and formats](https://developer.mastercard.com/issuer-enrollment/documentation/code-and-formats/index.md#http-status-codes) section.

## Next Steps {#next-steps}

Choose the appropriate next step based on the returned status:

* For SUBMITTED or PROCESSING, wait for the agreed polling interval and check the batch status again.
* For COMPLETED_SUCCESSFULLY, reconcile the returned results with your submitted records.
* For COMPLETED_WITH_FAILURES, correct the failed enrollment records and submit them in a new batch.
* For FAILED, review the returned errors, correct the request, and submit a new batch.
* To retrieve, update, or delete enabled consumer profiles and credentials, see [Manage Consumer Profiles and Credentials](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/life_cycle/index.md).
* To validate successful and unsuccessful batch-status responses, see the [Auto Enablement](https://developer.mastercard.com/issuer-enrollment/documentation/testing/auto-enrollment/index.md) testing page.
