ConfigCreate a transformer

Create a transformer

Create an event transformer applied by the SDK to every captured event before it is sent. name, a valid type (map or code), and a complete config for that type are required (map needs from and as; code needs a non-empty code); priority defaults to 50 and enabled to true. Agency key (ak_) required. Rebuilds the edge config — check kv_sync.

curl -X POST "https://mythic-analytics.gulp.workers.dev/client/v1/config/transformers?location_id=example_string" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "name": "Add page title",
  "type": "map",
  "config": {
    "from": "document.title",
    "as": "page_title"
  },
  "priority": 42,
  "enabled": true
}'
{
  "success": true,
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "tenant_key": "loc_abc123",
    "name": "Normalize order value",
    "type": "map",
    "priority": 50,
    "enabled": true,
    "created_at": "2024-12-25T10:00:00Z",
    "updated_at": "2024-12-25T10:00:00Z",
    "config": {
      "from": "document.title",
      "as": "page_title"
    }
  },
  "kv_sync": "synced"
}
POST
/client/v1/config/transformers
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

Agency key (ak_) or location secret key (sk_). Writes require an agency key. Keys are server-side credentials — this surface serves no CORS headers on purpose. Scoped keys (mcp_) are accepted too and need the tags, snippets or transformers family the route belongs to. See Using an mcp_ key over HTTP.

Agency key (ak_) or location secret key (sk_). Writes require an agency key. Keys are server-side credentials — this surface serves no CORS headers on purpose. Scoped keys (mcp_) are accepted too and need the tags, snippets or transformers family the route belongs to. See Using an mcp_ key over HTTP.
query
location_idstring

Location to scope to. Required for ak_ keys (or send the X-Location-Id header); ignored for sk_.

Content-Typestring
Required

The media type of the request body

Options: application/json
typestring
Required

map evaluates config.from (a JavaScript expression) and stores the result at config.as in the event properties; code runs config.code with (data, mythic) — mutate data and return it, or return null to drop the event.

Options: map, code
configobject
Required

Type-specific transformer configuration.

priorityinteger

Lower runs first.

Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Agency key (ak_) or location secret key (sk_). Writes require an agency key. Keys are server-side credentials — this surface serves no CORS headers on purpose. Scoped keys (mcp_) are accepted too and need the tags, snippets or transformers family the route belongs to. See Using an mcp_ key over HTTP.

Query Parameters

location_idstring

Location to scope to. Required for ak_ keys (or send the X-Location-Id header); ignored for sk_.

Body

application/json
namestring
Required
Example:
Add page title
typestring
Required

map evaluates config.from (a JavaScript expression) and stores the result at config.as in the event properties; code runs config.code with (data, mythic) — mutate data and return it, or return null to drop the event.

Allowed values:mapcode
configobject
Required

Type-specific transformer configuration.

Example:
{"from":"document.title","as":"page_title"}
priorityinteger

Lower runs first.

Responses