Encrypt and Upload the Batch File {#batch-uploading-rest-api-task}
==================================================================

This topic provides general instructions for how to encrypt your batch file and upload it to `Cybersource` for offline processing. PGP encryption ensures secure transmission of the sensitive payment data that you upload to the `Business Center` using the REST API. Encryption is performed using a PGP public key that your TAM emails to you.

1. To encrypt and upload a batch file using the REST API:

2. Write Java code that encrypts and uploads the batch file to `Cybersource` for offline processing.

   #### ADDITIONAL INFORMATION

   If you base your Java code on a sample from the [Cybersource Java Sample Code Repository (on GitHub)](https://github.com/CyberSource/cybersource-rest-samples-java/tree/master/src/main/java/samples/BatchUploadAPI ""), be sure to use values for your own environment in the commands below the inline comments.

3. Execute the code. Use the sample code for execution with application.

   #### ADDITIONAL INFORMATION

   The `PROD` environment corresponds to a POST to this endpoint:

   ```
   secure-batch.cybersource.com/pts/v1/transaction-batch-upload
   ```

   The `TEST` environment corresponds to a POST to this endpoint:

   ```
   secure-batch-test.cybersource.com/pts/v1/transaction-batch-upload
   ```
4. Verify the response messages to make sure that the request was successful.

   #### ADDITIONAL INFORMATION

   A 201-level HTTP response code indicates success. See the [Transaction Response Codes](https://developer.cybersource.com/api/reference/response-codes.md "").

5. Proceed to [Check the Validation and Processing Results](/docs/cybs/en-us/batch/user/all/rest/batch-upload/batch-uploading-rest-api/batch-uploading-rest-api-results.md "").

