transformations

Embed
Preview of the card
<a href="https://lucidace.com/docs/ref-transformations"><img src="https://lucidace.com/docs/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/da916cd3-c0fc-4b63-b971-b3c13623daf3/pages/2f7ff431-19a8-403b-b509-5d9a50011a8e/social-card.svg?v=3e7ae33eec8b" alt="transformations" width="600" height="315"></a>
GEThttps://lucidace.com/v1/projects/{project_id}/js_rules/metricsScope settings:read

Parameters

project_idstringpathrequired
hoursintegerquery

Code samples

cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/js_rules/metrics"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Page of RuleMetrics (transformation_id is the JS rule id): totals and an hourly series per rule that ran in the window (one page)
Example
{
  "data": [
    {
      "series": [
        {
          "dropped": 0,
          "errors": 0,
          "hour": "2024-01-01T00:00:00Z",
          "modified": 0,
          "processed": 0,
          "transformation_id": "string"
        }
      ],
      "totals": {
        "dropped": 0,
        "errors": 0,
        "modified": 0,
        "processed": 0
      },
      "transformation_id": "string"
    }
  ],
  "next_cursor": "string"
}
Schema
dataRuleMetrics[]required
Show child parameters
seriesMetricHour[]required
Hourly buckets with activity, oldest first.
Show child parameters
droppedintegerrequired
errorsintegerrequired
hourstringrequired
modifiedintegerrequired
processedintegerrequired
transformation_idstringrequired
totalsobjectrequired
Show child parameters
droppedintegerrequired
errorsintegerrequired
modifiedintegerrequired
processedintegerrequired
transformation_idstringrequired
next_cursorstring
404
POSThttps://lucidace.com/v1/projects/{project_id}/js_rules/testScope settings:read

Parameters

project_idstringpathrequired

Request body

application/json
eventobjectrequired
The event to run: {event, distinct_id, properties, ...}.
sourcestring
A draft rule to try; omit to run the project's saved enabled rules in order.
{
  "event": {},
  "source": "string"
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/js_rules/test" \
  -H "Content-Type: application/json" \
  -d '{"event":{},"source":"string"}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "dropped": true,
  "errors": [
    "string"
  ],
  "event": {},
  "kv_ops": [
    {}
  ],
  "logs": [
    "string"
  ]
}
Schema
droppedbooleanrequired
errorsstring[]required
Per-rule failures (the rule was skipped for this event).
eventobject
The event after the rules; null when a rule dropped it.
kv_opsobject[]required
Key-value writes the rules made (N-ANA-19); a test run never applies them.
logsstring[]required
console.log lines.
400
404
503 The lc-codebox sandbox is not installed or failed
DELETEhttps://lucidace.com/v1/projects/{project_id}/js_rules/{id}Scope settings:write

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X DELETE "https://lucidace.com/v1/projects/{project_id}/js_rules/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

204
403
404
PATCHhttps://lucidace.com/v1/projects/{project_id}/js_rules/{id}Scope settings:write

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
clear_quarantineboolean
true lifts an auto-quarantine immediately.
enabledboolean
namestring
positioninteger
sourcestring
{
  "clear_quarantine": true,
  "enabled": true,
  "name": "string",
  "position": 0,
  "source": "string"
}

Code samples

cURL
curl -X PATCH "https://lucidace.com/v1/projects/{project_id}/js_rules/{id}" \
  -H "Content-Type: application/json" \
  -d '{"clear_quarantine":true,"enabled":true,"name":"string","position":0,"source":"string"}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "created_at": "2024-01-01T00:00:00Z",
  "enabled": true,
  "id": "string",
  "name": "string",
  "position": 0,
  "quarantine_reason": "string",
  "quarantined_until": "2024-01-01T00:00:00Z",
  "source": "string",
  "updated_at": "2024-01-01T00:00:00Z"
}
Schema
created_atstringrequired
enabledbooleanrequired
idstringrequired
namestringrequired
positionintegerrequired
quarantine_reasonstring
quarantined_untilstring
Set while the worker has the rule paused after repeated errors; it re-enables at this time.
sourcestringrequired
updated_atstringrequired
400
403
404
GEThttps://lucidace.com/v1/projects/{project_id}/transformation-libraries

Parameters

project_idstringpathrequired
limitintegerquery
cursorstringquery

Code samples

cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/transformation-libraries"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Page of Library by name
Example
{
  "data": [
    {
      "created_at": "2024-01-01T00:00:00Z",
      "description": "string",
      "id": "string",
      "latest_version": 0,
      "name": "string",
      "source": "string",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ],
  "next_cursor": "string"
}
Schema
dataLibrary[]required
Show child parameters
created_atstringrequired
descriptionstringrequired
idstringrequired
latest_versionintegerrequired
namestringrequired
sourcestringrequired
updated_atstringrequired
next_cursorstring
404
POSThttps://lucidace.com/v1/projects/{project_id}/transformation-libraries

Parameters

project_idstringpathrequired

Request body

application/json
descriptionstring
namestringrequired
[a-z][a-z0-9_]{0,62}; rules call <name>.<proc>.
sourcestringrequired
def <proc> { statements } blocks (the code rule language, without inputs or secrets).
{
  "description": "string",
  "name": "string",
  "source": "string"
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/transformation-libraries" \
  -H "Content-Type: application/json" \
  -d '{"description":"string","name":"string","source":"string"}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

201
Example
{
  "created_at": "2024-01-01T00:00:00Z",
  "description": "string",
  "id": "string",
  "latest_version": 0,
  "name": "string",
  "source": "string",
  "updated_at": "2024-01-01T00:00:00Z"
}
Schema
created_atstringrequired
descriptionstringrequired
idstringrequired
latest_versionintegerrequired
namestringrequired
sourcestringrequired
updated_atstringrequired
400
403
404
409
GEThttps://lucidace.com/v1/projects/{project_id}/transformation-libraries/{id}

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/transformation-libraries/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "created_at": "2024-01-01T00:00:00Z",
  "description": "string",
  "id": "string",
  "latest_version": 0,
  "name": "string",
  "source": "string",
  "updated_at": "2024-01-01T00:00:00Z",
  "used_by": [
    {
      "id": "string",
      "name": "string"
    }
  ]
}
Schema
created_atstringrequired
descriptionstringrequired
idstringrequired
latest_versionintegerrequired
namestringrequired
sourcestringrequired
updated_atstringrequired
used_byDependent[]required
Show child parameters
idstringrequired
namestringrequired
404
DELETEhttps://lucidace.com/v1/projects/{project_id}/transformation-libraries/{id}

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X DELETE "https://lucidace.com/v1/projects/{project_id}/transformation-libraries/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

204
403
404
409 transformations still import the library
PATCHhttps://lucidace.com/v1/projects/{project_id}/transformation-libraries/{id}

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
descriptionstring
sourcestring
A changed source is saved as the next version.
{
  "description": "string",
  "source": "string"
}

Code samples

cURL
curl -X PATCH "https://lucidace.com/v1/projects/{project_id}/transformation-libraries/{id}" \
  -H "Content-Type: application/json" \
  -d '{"description":"string","source":"string"}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

400
403
404

Updated