Management APITransformations

Transformations

Transformations define how events are modified, enriched, or filtered as they pass through the Pipeline Transformation Engine. Each transformation is a YAML or JSON configuration that specifies mapping rules, filters, and computed fields applied to events before delivery to a specific integration.

Transformation Object

{
  "id": "txn_abc123",
  "source_id": "src_abc123",
  "integration_id": "int_xyz789",
  "name": "GA4 Event Mapper",
  "enabled": true,
  "config": {
    "version": "1.0",
    "rules": [
      {
        "type": "map",
        "source": "properties.product_id",
        "target": "items[0].item_id"
      },
      {
        "type": "map",
        "source": "properties.name",
        "target": "items[0].item_name"
      },
      {
        "type": "filter",
        "condition": "event != 'Page Loaded'"
      },
      {
        "type": "set",
        "target": "currency_code",
        "value": "USD"
      }
    ]
  },
  "created_at": "2026-01-20T12:00:00Z",
  "updated_at": "2026-02-15T16:45:00Z"
}
FieldTypeDescription
idstringUnique transformation identifier
source_idstringSource this transformation applies to
integration_idstringIntegration this transformation targets
namestringDisplay name
enabledbooleanWhether this transformation is active
configobjectTransformation rules in YAML or JSON format
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last-updated timestamp

Rule Types

Transformation configs support the following rule types:

Rule TypeDescriptionExample
mapCopy a value from one field to anotherMap properties.price to value
setSet a field to a static valueSet currency_code to "USD"
filterDrop events matching a conditionDrop events where event == "internal_test"
renameRename a fieldRename properties.sku to properties.product_id
deleteRemove a field from the eventDelete properties.internal_flag
computeCompute a value from an expressionSet total to properties.price * properties.quantity

List Transformations

GET /v1/admin/transformations

Returns a paginated list of transformations.

Query parameters:

ParameterTypeDefaultDescription
source_idstringFilter by source ID
integration_idstringFilter by integration ID
cursorstringPagination cursor
limitinteger50Items per page (max 100)

Request:

curl -X GET "http://localhost:8084/v1/admin/transformations?source_id=src_abc123" \
  -H "Authorization: Bearer {access_token}"

Response:

{
  "data": [
    {
      "id": "txn_abc123",
      "source_id": "src_abc123",
      "integration_id": "int_xyz789",
      "name": "GA4 Event Mapper",
      "enabled": true,
      "created_at": "2026-01-20T12:00:00Z",
      "updated_at": "2026-02-15T16:45:00Z"
    }
  ],
  "next_cursor": null,
  "has_more": false
}

Required role: viewer or above.

Create Transformation

POST /v1/admin/transformations

Create a new transformation. The config can be provided as JSON or as a YAML string in the config_yaml field.

Request (JSON config):

{
  "source_id": "src_abc123",
  "integration_id": "int_xyz789",
  "name": "Meta CAPI Mapper",
  "enabled": true,
  "config": {
    "version": "1.0",
    "rules": [
      {
        "type": "map",
        "source": "properties.order_id",
        "target": "custom_data.order_id"
      },
      {
        "type": "map",
        "source": "properties.total",
        "target": "custom_data.value"
      },
      {
        "type": "set",
        "target": "custom_data.currency",
        "value": "USD"
      }
    ]
  }
}

Request (YAML config):

{
  "source_id": "src_abc123",
  "integration_id": "int_xyz789",
  "name": "Meta CAPI Mapper",
  "enabled": true,
  "config_yaml": "version: '1.0'\nrules:\n  - type: map\n    source: properties.order_id\n    target: custom_data.order_id\n  - type: map\n    source: properties.total\n    target: custom_data.value\n  - type: set\n    target: custom_data.currency\n    value: USD\n"
}

Response (201 Created): Full transformation object.

Required role: editor or above.

Update Transformation

PUT /v1/admin/transformations/{id}

Update an existing transformation’s name, config, or enabled state.

Request:

{
  "name": "Meta CAPI Mapper (v2)",
  "enabled": true,
  "config": {
    "version": "1.0",
    "rules": [
      {
        "type": "map",
        "source": "properties.order_id",
        "target": "custom_data.order_id"
      },
      {
        "type": "map",
        "source": "properties.total",
        "target": "custom_data.value"
      },
      {
        "type": "set",
        "target": "custom_data.currency",
        "value": "EUR"
      },
      {
        "type": "delete",
        "target": "properties.internal_ref"
      }
    ]
  }
}

Response: Updated transformation object.

Required role: editor or above.

Delete Transformation

DELETE /v1/admin/transformations/{id}

Delete a transformation. Events will pass through to the integration without this transformation applied.

Request:

curl -X DELETE http://localhost:8084/v1/admin/transformations/txn_abc123 \
  -H "Authorization: Bearer {access_token}"

Response: 204 No Content

Required role: editor or above.

Dry Run

POST /v1/admin/transformations/{id}/dry-run

Test a transformation against a sample event without affecting live data. The dry-run endpoint applies the transformation rules to the provided event and returns the transformed output.

Request:

{
  "event": {
    "type": "track",
    "event": "Order Completed",
    "properties": {
      "order_id": "ORD-1234",
      "total": 129.99,
      "currency": "USD",
      "products": [
        {
          "product_id": "SKU-001",
          "name": "Wireless Headphones",
          "price": 79.99,
          "quantity": 1
        },
        {
          "product_id": "SKU-002",
          "name": "Phone Case",
          "price": 24.99,
          "quantity": 2
        }
      ],
      "internal_ref": "INT-9999"
    },
    "userId": "user_98765",
    "timestamp": "2026-02-25T14:30:00.000Z"
  }
}

Response:

{
  "output": {
    "type": "track",
    "event": "Order Completed",
    "properties": {
      "order_id": "ORD-1234",
      "total": 129.99,
      "currency": "USD",
      "products": [
        {
          "product_id": "SKU-001",
          "name": "Wireless Headphones",
          "price": 79.99,
          "quantity": 1
        },
        {
          "product_id": "SKU-002",
          "name": "Phone Case",
          "price": 24.99,
          "quantity": 2
        }
      ]
    },
    "custom_data": {
      "order_id": "ORD-1234",
      "value": 129.99,
      "currency": "EUR"
    },
    "userId": "user_98765",
    "timestamp": "2026-02-25T14:30:00.000Z"
  },
  "rules_applied": 4,
  "rules_matched": 4,
  "warnings": []
}
FieldTypeDescription
outputobjectThe event after all transformation rules have been applied
rules_appliedintegerTotal number of rules in the transformation
rules_matchedintegerNumber of rules that matched and were executed
warningsstring[]Any warnings generated during transformation (e.g., missing source fields)

Required role: editor or above.

The dry-run endpoint is useful for testing transformation configs before enabling them in production. It does not persist any data or affect live event processing.

⚠️

Dry-run uses the saved transformation config, not the request body. To test changes before saving, update the transformation first (with enabled: false), then dry-run.