**Source URL:** https://limited.veevavault.dev/sitevault/vault-api/api-reference/21.1/metadata-definition-language-mdl/execute-mdl-script-asynchronously.md

# Execute MDL Script Asynchronously

This asynchronous endpoint executes the given MDL script on a Vault.

While you can execute any MDL script asynchronously, this endpoint is required if you’re operating on 10,000+ high volume object records and executing one of the following operations:

* Enabling lifecycles

* Enabling object types

* Adding or removing a field

* Updating the max length of a text field

* Adding or removing an `Index`

* Changing the fields that compose an `Index`

<Endpoint path="/api/mdl/execute_async" method="POST"></Endpoint>

## Headers {#headers}

<FieldTable>
| Name | Description |
| --- | --- |
| `Content-Type` | `application/json` or `application/xml` |
| `Accept` | `application/json` (default) or `application/xml` |
</FieldTable>

## Body Parameters {#body-parameters}

The body of the request should contain the MDL script to execute. Enter the body as raw data. The body must start with one of the following values:

* `CREATE`

* `RECREATE`

* `RENAME`

* `ALTER`

* `DROP`

Learn more in the [MDL Commands](/mdl/documentation/mdl-commands) documentation.

## Request {#request}

<CodeExample title="">
```
curl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: application/json" \
--data-binary @"hvo.txt" \
https://myvault.veevavault.com/api/mdl/execute_async

```
</CodeExample>

## Example Body: RECREATE Picklist {#example-body-recreate-picklist}

<CodeExample title="">
```
RECREATE Picklist color__c (
   label('Color'),
   active(true),
   Picklistentry red__c(
      value('Red'),
      order(1),
      active(true)
   ),
   Picklistentry blue__c(
      value('Blue'),
      order(2),
      active(true)
   ),
   Picklistentry green__c(
      value('Green'),
      order(3),
      active(true)
   )
);

```
</CodeExample>

## Response {#response}

<CodeExample title="">
```
{
   "responseStatus": "SUCCESS",
   "script_execution": {
       "code": "GEN-S-0",
       "message": "OK",
       "warnings": 0,
       "failures": 0,
       "exceptions": 0,
       "components_affected": 1,
       "execution_time": 0.622
   },
   "job_id": 327103,
   "url": "/api/v20.3/services/jobs/327103"
}

```
</CodeExample>

## Response Details {#response-details}

On SUCCESS, the response includes the following information:

<FieldTable>
| Name | Description |
| --- | --- |
| `job_id` | The Job ID value to retrieve the status and results of this request |
| `url` | URL to retrieve the current job status of this request |
| `code` | The response code indicating the if the script passed or failed syntax validation |
| `message` | A descriptive message for any warnings, failures, or exceptions, otherwise `OK` |
| `warnings` | The number of warnings received while validating the script syntax |
| `failures` | The number of errors received while validating the script syntax |
| `exceptions` | The number of exceptions received while validating the script syntax |
| `components_affected` | The number of components affected by this script |
| `execution_time` | The length of time taken to validate this script syntax, in milliseconds |
</FieldTable>



---

**Previous:** [Execute MDL Script](/sitevault/vault-api/api-reference/21.1/metadata-definition-language-mdl/execute-mdl-script)  
**Next:** [Retrieve Component Type Metadata](/sitevault/vault-api/api-reference/21.1/metadata-definition-language-mdl/retrieve-component-type-metadata)