**Source URL:** https://general.veevavault.dev/medical/vault-api/api-reference/26.1/managing-vault-java-sdk/add-or-replace-single-source-code-file.md

# Add or Replace Single Source Code File



<Aside>We do not recommend using the following endpoint to deploy code as you may introduce code which breaks existing deployed code. For best practices, use the [VPK Deploy method](/vault-sdk/deploying-code/).</Aside>
Add or replace a single `.java` file in the currently authenticated Vault. If the given file does not already exist in the Vault, it is added. If the file already exists in the Vault, the file is updated.

<Endpoint path="/api/{version}/code" method="PUT"></Endpoint>

## Headers {#headers}

<FieldTable>
| Name | Description |
| --- | --- |
| `Accept` | `application/json` (default) |
| `Content-Type` | `multipart/form-data` |
</FieldTable>

## Body Parameters {#body-parameters}

<FieldTable>
| Name | Description |
| --- | --- |
| `file` | The `.java` file you wish to add. Maximum allowed size is 1MB. |
</FieldTable>

## Request {#request}

<CodeExample title="">
```
curl -X PUT -H "Authorization: {SESSION_ID}" \
https://veepharm.veevavault.com/api/v18.3/code
-F "file=@C:\Vault\Extensions\com\veeva\vault\custom\actions\MyCustomAction.java" \

```
</CodeExample>

## Response {#response}

<CodeExample title="">
```
{
    "responseStatus": "SUCCESS",
    "responseMessage": "Modified file",
    "url": "/api/v18.3/code/com.veeva.vault.custom.actions.MyCustomAction"
}

```
</CodeExample>

---

**Previous:** [Disable Vault Extension](/medical/vault-api/api-reference/26.1/managing-vault-java-sdk/disable-vault-extension)  
**Next:** [Delete Single Source Code File](/medical/vault-api/api-reference/26.1/managing-vault-java-sdk/delete-single-source-code-file)