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

# Execute MDL Script

  

This synchronous endpoint executes the given MDL script on a Vault. Note that some large operations require use of the [asynchronous endpoint](#Execute_MDL_Async).

<Endpoint path="/api/mdl/execute" 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.

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

In this example, we update our picklists using the RECREATE command. If a picklist exists with the name `color__c`, Vault updates it to conform to the definition provided. If not, Vault creates a new picklist with the definition provided.

## Request {#request}

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

```
</CodeExample>

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

<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>

## Example Body: RECREATE Java SDK Trigger {#example-body-recreate-java-sdk-trigger}

<CodeExample title="">
```
RECREATE Recordtrigger my_custom_trigger_name__c (
active (true),
source_code (<VeevaData>
...
</VeevaData>)
);

```
</CodeExample>

## Response : RECREATE Picklist {#response--recreate-picklist}

<CodeExample title="">
```
{
    "responseStatus": "SUCCESS",
    "script_execution": {
        "code": "GEN-S-0",
        "message": "OK",
        "warnings": 0,
        "failures": 0,
        "exceptions": 0,
        "components_affected": 1,
        "execution_time": 0.028
    },
    "statement_execution": [
        {
            "vault": "promo-vee.vaultdev.com",
            "statement": 1,
            "command": "RECREATE",
            "component": "Picklist.color__c",
            "message": "[SUCCESS] RECREATE Picklist color__c",
            "response": "SUCCESS"
        }
    ]
}

```
</CodeExample>

## Response Details {#response-details}

On SUCCESS, the response contains details of the execute.



---

**Previous:** [Metadata Definition Language (MDL)](/commercial/vault-api/api-reference/22.1/metadata-definition-language-mdl)  
**Next:** [Execute MDL Script Asynchronously](/commercial/vault-api/api-reference/22.1/metadata-definition-language-mdl/execute-mdl-script-asynchronously)