# How to trigger a transformation via API

Instead of uploading files manually or waiting for a scheduled run, you can trigger a transformation programmatically — the moment your system is ready.

This is the core of an API-driven WeTransform workflow: your system controls when transformations run, WeTransform handles the processing, and a webhook delivers the result.

# 🔄 The typical flow

1. Your system has a new file ready to transform

2. You call the WeTransform API to **run the transformation**

3. WeTransform fetches the latest file from the connected source, applies all rules, and processes the output

4. A **webhook fires** the moment the output is ready — your system receives the download URL automatically

💡 **Prerequisites:** the transformation must already have a **dynamic source configured** (FTP, SFTP, URL, or API) and a **target format selected**. The API trigger refreshes the source and re-runs the transformation — it doesn't upload a new file directly.

# ⚡ The API endpoint

To trigger a transformation, call:

```
POST https://api.wetransform.com/transformation/automation/{transformationId}
```

With your Bearer token in the header:

```
Authorization: Bearer YOUR_API_TOKEN
```

WeTransform will refresh the source file and run the full transformation. You can then poll the status endpoint to know when it's done:

```
GET https://api.wetransform.com/transformation/automation/{automationId}
```

Or — more elegantly — just wait for the webhook to fire.

# 🔑 Getting your API token

Generate your API token in your WeTransform account settings. Tokens authenticate all API calls — keep them secret and never expose them in client-side code.

If you need to act on behalf of a specific customer (Sender API), add the `X-Customer` header:

```
X-Customer: customer@example.com
```

🔑 **Two API roles, two contexts:**

- **Receiver API** — for administrative tasks: managing templates, customers, settings

- **Sender API** — for transformation workflows: uploading files, running transformations, downloading results

Most automation workflows use the Sender API.

# 📚 Full API reference

The WeTransform API follows REST principles and returns JSON responses. For complete endpoint documentation, request/response schemas, and a live console to test calls:

👉 [api.wetransform.com/en/documentation/api](https://api.wetransform.com/en/documentation/api)

# 👉 What to do next

- 📤 [Receive your output automatically with webhooks](https://help.wetransform.com/en/articles/14324659-how-to-receive-your-output-automatically-with-webhooks)

- 📡 [Connect an automatic data source](https://help.wetransform.com/en/articles/14324645-how-to-connect-an-automatic-data-source)

- 🗓️ [Schedule a recurring transformation](https://help.wetransform.com/en/articles/14324649-how-to-schedule-a-recurring-transformation)