# Using the Vault Loader Command Line Tool

The [Vault Loader](/en/lr/26597/) Command Line tool allows you to perform all bulk create, export, update, and delete actions from the terminal. You can also view and manage files and folders on your Vault's file staging.

The process has three basic steps:

  1. Open a command line console.
  2. Use the command line tool to authenticate with your Vault.
  3. Use the command line tool to load data via an input file or to export data from your Vault.

## Loading Basics

When you load content and data into Vault:

  * You must specify an input file in CSV format. The file extension can be CSV or TXT.
  * Input files must include all required fields and can include any additional editable fields that you wish to update.
  * Optional: Upload any document source files and renditions to file staging. If you don't add source files, documents will be created as placeholders.
  * Optional: You can use a mapping file to match fields in an existing data file with an input file.

### Using the Key Field in Mapping Files

When you use a mapping file to _Update, Upsert_, or _Delete_ object records, you can use the _KeyField_ column name in your CSV. When specified, Vault uses this field as the _idParam_ for lookup. If you specify both _IdParam_ and _Keyfield_, Vault uses _Keyfield_ for lookup.

## Extracting Basics

When retrieving information from Vault:

  * You must specify a filename for the output file using the `-csv` flag. All output files are plain text and CSV-formatted.
  * Optional: You can use a `""` command with specific field values to filter the items included in your extract.
  * Optional: You can specify a location for the output file. Otherwise, the file will be created in your current directory.
  * Optional: You can specify a column layout. Otherwise, the file will include all fields and their values.

Currently, the command line tool can export object records, document metadata, document types, users, and groups.

## Responses

After processing a command via the command line tool, Vault creates various response files in your current directory.

  * Success log: CSV file with fields and values for successfully loaded records.
  * Failure log: CSV file with error messages for each record that failed to load.
  * Output file: CSV file with exported data.

You can use the success, failure, and export files to edit and reload records as needed.

If you are performing an action using the `-async` flag, you can use the following commands to retrieve status information:

<table class="wbord">
  <tr>
    <td width="20%">
      <strong>Action</strong>
    </td>
    <td width="20%">
      <strong>Description</strong>
    </td>
  </tr>
  <tr>
    <td width="20%">
      -jobstatus
    </td>
    <td width="20%">
      Use this action to retrieve status information (job ID, progress, start time, end time, etc.) for all operations that you've run via the command line tool since generating the <em>VL-Config</em> file.
    </td>
  </tr>
  <tr>
    <td width="20%">
      -jobstatus [JOB_ID]
    </td>
    <td width="20%">
      Use this action to retrieve status information (progress, start time, end time, etc.) for a specific operation.
    </td>
  </tr>
  <tr>
    <td width="20%">
      -jobresults [JOB_ID]
    </td>
    <td width="20%">
      Use this action to create a success or failure log and a text file with the job details, including progress, start time, and end time.
    </td>
  </tr>
</table>

## Getting Started

The command line tool is distributed as a single JAR file (_VaultDataLoader.jar_) and does not require installation. Download the ZIP file, extract it, and run it from a command line console. You'll need [Vault Loader permissions](/en/lr/26597/#loader-permissions) to do this.

To get started with the command line tool:
  1. In your Vault, navigate to the **Loader** tab and download the command line tool from the left sidebar. When Vault releases new versions, you'll need to download the latest file.
  2. Extract (unzip) the downloaded file.
  3. Verify that you have installed <a class="external-link " href="https://www.oracle.com/java/technologies/downloads/?er=221886#java17" target="_blank" rel="noopener">JDK V17<i class="fa fa-external-link" aria-hidden="true"></i></a>.

We recommend creating a local directory for Vault Loader-related files. This can help you keep track of the following files:
  * Command line tool (_VaultDataLoader.jar_)
  * Vault DNS and authentication information (_vl-config.xml_)
  * CSV input files
  * CSV success and failure logs
  * CSV or TXT export files

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: To take advantage of functionality available in later versions, the command line tool uses Vault Loader v21.3 or later:</p>
<ul>
  <li>The command line tool downloaded from Vault version 21R3.0 or earlier uses Vault Loader v21.3, which passes v21.3 through to underlying APIs. For example, the 21R2.0 command line tool will use Vault Loader v21.3 and the v21.3 Vault Objects, Documents, and VQL APIs.</li>
  <li>The command line tool downloaded from Vault version 22R1.0 or later uses the equivalent version of Vault Loader, which passes the Vault version through to underlying APIs. For example, the 22R2.0 command line tool will use Vault Loader v22.2 and the v22.2 Vault Objects, Documents, and VQL APIs as specified.</li>
</ul>
    </div>
  </div>
</div>



## Command Line Arguments

A command line argument is a parameter passed to Vault Loader. When using Vault Loader, arguments include both commands that define what operation to perform, like `-createdocuments`, and modifiers for that operation, like `-all` to specify that a delete operation would affect all object records or `-csv filename.csv` to indicate that Vault Loader should create documents based on the information in the specified CSV file.

A full list of arguments is available via the command line tool using the argument `-h` or `-help`.

Learn more about Vault Loader command line arguments in the [Vault Loader Command Line Tool Reference](/en/lr/67332/).

To use command line arguments to view and manage files and folders on your Vault's file staging, see the [Vault Loader File Staging Command Line Tool Reference](/en/lr/67334/).

## Authentication & VL-Config Files

Before running any other commands, use your Vault username and password to authenticate with your Vault:

`java -jar VaultDataLoader.jar -username steve@veepharm.com -password p@$$w0Rd -dns https://veepharm.veevavault.com`

<a id="vlconfigfile"></a>The first time that you run this command, the command line tool creates the file _vl-config.xml_, which saves your DNS and username for future commands. If you work with multiple Vaults or multiple user accounts, you must delete this file and re-run the authentication command each time you switch Vaults or switch users.

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: To authenticate, you must have a security profile that grants these permissions:</p>

<ul>
  <li>Vault Owner Actions: Vault Loader</li>
  <li>API: All API</li>
</ul>

    </div>
  </div>
</div>



## Resolving DNS Errors

If you encounter the error message "Error making request to specified DNS" when using the command line, you are missing the Veeva certificate. Follow these steps to import the Veeva certificate:

1. Navigate to your Vault home page in a Google Chrome web browser.
2. Click the **View site information** icon (<img class="inline" src="https://platform.veevavault.help/assets/images/Chrome-site-information.png" alt="Chrome Site Information" style=" width: 30px;" />) in the address bar.
3. Select **Connection is secure** > **Certificate is valid** > **Details** tab > **Export**.
4. Name the file "veeva.cer".
5. Select **Base64encoded ASCII, single certificate** as the **Format**.
6. Click **Save**.
7. In your command line, run the following command: `where java`. This command returns the location of your java.exe file. This path is referred to as` java home`.
8. Run the following command in your command line: `keytool -v -list -alias veeva -keystore "[java_home]\jre\lib\security\cacerts"`.
9.  You will be prompted to enter a password. Enter `changeit` and press **Enter** on your keyboard.
10. Restart your command line.

The Veeva certificate is now imported to your command line and you should not encounter the DNS server error.