# Changing the payload, headers or URL with transformations

> Run a JavaScript handler right before each delivery to change the payload, headers, URL or HTTP method, or to cancel the delivery.

Source: https://webhookadmin.com/en/docs/guide/transformations/

## Required role and plan

- **View**: Viewer or higher (variable values are shown to Developer or higher only)
- **Save, test, delete**: Developer or higher
- **Plan**: Pro and above

## Set up a transformation

1. Open the endpoint and choose the Transformation tab.
2. Write `handler(webhook)` in Code. You can start from Templates (add headers, reshape the payload, skip events, use variables).
3. Optionally add names and values under Variables. Read them in the handler from `webhook.env`.
4. Under Input, enter an Event type and Sample data (JSON), select Test, and check the Result and Logs tabs. Nothing is delivered during a test.
5. Turn on Apply transformation and save.

If you try to leave the tab or the page with unsaved changes, a confirmation dialog appears.

## What you can change on webhook

| Property | Description |
| --- | --- |
| `method` | HTTP method. Can be changed to POST, PUT or PATCH. |
| `url` | Endpoint URL. Only the path and query can be changed. |
| `payload` | The payload to deliver. Can be changed. |
| `headers` | Headers to add. |
| `cancel` | Set to `true` to cancel the delivery (not counted as a failure). |
| `eventType`, `env`, `transformationsParams` | Read only. |

The signature is computed on the changed payload.

## Limits

- Up to 51,200 characters of code. No network access.
- Each run has CPU and memory limits.
- Up to 50 variables, 4 KB in total.
- If the code fails, the message is neither delivered nor retried. Messages shows the kind of error.

## Turn off or remove

Turn off Apply transformation to deliver payloads unchanged. Remove deletes the code, and later deliveries are sent unchanged. Turning off and removing work on any plan.

## Related pages

- [Endpoints](https://webhookadmin.com/en/docs/guide/endpoints/)
- [Messages](https://webhookadmin.com/en/docs/guide/messages/)
- [Plans and billing](https://webhookadmin.com/en/docs/guide/billing/)
