Skip to Content
API ReferenceTransformations

Transformations

Transformations are JavaScript functions that modify order or shipment data at specific trigger points in the processing pipeline. They allow you to normalize, enrich, or reshape data as it flows between bridges.

List Transformations

GET/api/transformations

List all transformations for the organization.

Requiredtransformations:read

Returns a paginated list of transformations with their trigger points and status.

Query Parameters

ParameterTypeDescription
pagenumberPage number (default: 1)
limitnumberItems per page (default: 20, max: 100)
trigger_pointstringFilter by trigger point
bridge_idstringFilter by associated bridge
curl -X GET "https://api.orderly.dev/api/transformations" \ -H "Authorization: Bearer ord_sk_..."

Response

{ "data": [ { "id": "uuid", "name": "Normalize Shopify Addresses", "trigger_point": "after_sync", "bridge_id": "uuid", "code": "function transform(order) { ... }", "enabled": true, "created_at": "2026-01-01T00:00:00Z" } ], "pagination": { "page": 1, "limit": 20, "total": 3, "totalPages": 1, "hasMore": false } }

Create Transformation

POST/api/transformations

Create a new transformation.

Requiredtransformations:write

Creates a new transformation. The code field should contain a JavaScript function that accepts and returns the data object.

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name
trigger_pointstringYesWhen to run: before_sync, after_sync, before_operation, after_operation
bridge_idstringNoLimit to a specific bridge
codestringYesJavaScript transformation function
enabledbooleanNoWhether the transformation is active (default: true)
curl -X POST "https://api.orderly.dev/api/transformations" \ -H "Authorization: Bearer ord_sk_..." \ -H "Content-Type: application/json" \ -d '{ "name": "Add shipping tier tag", "trigger_point": "after_sync", "code": "function transform(order) { if (order.total > 100) { order.tags.push(\"free-shipping\"); } return order; }", "enabled": true }'

Update Transformation

PATCH/api/transformations/:id

Update a transformation's code, trigger point, or status.

Requiredtransformations:write

Updates a transformation. Changes take effect immediately for subsequent data processing.

curl -X PATCH "https://api.orderly.dev/api/transformations/550e8400-e29b-41d4-a716-446655440000" \ -H "Authorization: Bearer ord_sk_..." \ -H "Content-Type: application/json" \ -d '{"enabled": false}'

Delete Transformation

DELETE/api/transformations/:id

Delete a transformation.

Requiredtransformations:write

Permanently deletes a transformation.

curl -X DELETE "https://api.orderly.dev/api/transformations/550e8400-e29b-41d4-a716-446655440000" \ -H "Authorization: Bearer ord_sk_..."

Test Transformation

POST/api/transformations/test

Test a transformation against sample data without saving.

Requiredtransformations:read

Runs a transformation function against sample input data and returns the result. Useful for developing and debugging transformations before deploying them.

Request Body

FieldTypeRequiredDescription
codestringYesJavaScript transformation function to test
inputobjectYesSample data to transform
curl -X POST "https://api.orderly.dev/api/transformations/test" \ -H "Authorization: Bearer ord_sk_..." \ -H "Content-Type: application/json" \ -d '{ "code": "function transform(order) { order.tags.push(\"tested\"); return order; }", "input": { "order_number": "1001", "total": 49.99, "tags": [] } }'

Response

{ "data": { "success": true, "output": { "order_number": "1001", "total": 49.99, "tags": ["tested"] }, "duration_ms": 3 } }