Skip to main content

Event Create

Overview

The /webhooks/reshape/event endpoint provides a universal API for sending complete event data to DATA Reshape for tracking and analysis. This endpoint supports all approved event types with comprehensive data objects, enabling server-side tracking for e-commerce platforms, CRM systems, and enterprise applications.

Endpoint Configuration

Request Details

  • URL: /webhooks/reshape/event
  • Method: POST
  • Content-Type: application/json
  • Authentication: Required

Authentication Requirements

Headers

  • Content-Type (required) - Must be application/json
  • X-Dre-Access-Token (required) - Your secret access token

Query Parameters

  • id (required) - Your script ID provided by DATA Reshape Team

Request Structure

{
"event": { /* Event object with name, value, currency, id */ },
"context": { /* API context with environment, data source, user agent */ },
"products": [ /* Product array for e-commerce events */ ],
"shipping": [ /* Shipping methods array */ ],
"payments": [ /* Payment methods array */ ],
"coupons": [ /* Discount coupons array */ ],
"user": { /* Customer data object */ },
"cookies": { /* Platform cookies for attribution */ },
"consent": { /* Customer explicit consent */ }
}

Complete Reference

event object required

info

Core event object containing event identification, value, and properties. View complete Event Object documentation

name string required

info

Name of the event to be sent.

name: "event_name"

value number required

info

Event value in decimal format. Represent the final total order amount, including all costs and discounts.

value: 123.99

currency string required

info

Currency code that specifies the currency in which all monetary values from any object associated with this event are expressed.

Note: This value can be overridden in nested objects if they contain their own value key with a currency specified.

currency: "USD"

exchange_rate number

info

Custom exchange rate for multi-currency. Default has value 1.

Note: This value can be overridden in nested objects if they contain their own value key with a currency specified.

exchange_rate: 1

id string required-if-applicable

info

Event ID — required for transactions or any actions that require deduplication or uniqueness. Represents the unique identifier of a transaction, order, or lead. This can be the unique order, transaction, or action ID used in your system.

id: "UNIQUE_TRANSACTION_123"

properties object recommended

info

Custom Event Properties Examples

properties: {
cancel_reason: "returning",
}

context object required

info

API context object containing environment, data source, and preserved user interaction data. View complete Context API Object documentation

environment string required

info

Allowed values: prod, dev

environment: "prod"

data_source string required

info

Recommended values:

  • for website events: website
  • for admin manual added orders events: phone or admin
  • for app events: app
  • for marketplace events : marketplace. (You can replace "marketplace" word with real marketplace name.)
data_source: "website"

user_agent string recommended

info

User-Agent string from a browser when the event occurs

user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"

override_ip string recommended

info

Ip address. Support ipv4 or ipv6. Recommended ipv6 if exists.

override_ip: "123.123.123.99"

url string recommended

info

URL of the page where the event occurred

url:"https://shop.example.com/thankyou-page"

landing_url string recommended

info

URL of the first page visited in the session where the event occurred

landing_url:"https://shop.example.com/landing-page?query=abc"

referrer_url string recommended

info

URL of the external referring site

referrer_url:"https://google.com"

products array required-if-applicable

info

Array of product objects for e-commerce events. Required for product-related events. View complete Product Object documentation

products[0] object required

id string required

info

Unique product identifier in your system.

id: "PRODUCT_ID"

parent_id string recommended

info

Parent product ID for variants or child products. Defaults to id if not provided.

parent_id: "PRODUCT_PARENT_ID"

name string required

info

Product name or title displayed to users.

name: "Professional Wireless Headphones"

parent_name string

info

Parent product name for variants or child products. Defaults to name if not provided.

parent_name: "Professional Headphones Collection"

price_base number required

info

Original or base price before discounts. Always equal to or greater than price.

price_base: 299.99

price number required

info

Current selling price after discounts. Always equal to or less than price_base.

price: 249.99

tax_included boolean required

info

Whether the price includes taxes. Defaults to true if not provided.

tax_included: true

tax_percent number required

info

Tax percentage applied to the product (0-50). If not provided, the site default tax rate will be used (generally the standard rate of the country).

tax_percent: 19

quantity number required

info

Quantity of this product in the context of the event. Defaults to 1 if not provided.

quantity: 2

category string recommended

info

Main product category name

category: "Electronics"

sku string

info

Product SKU (Stock Keeping Unit) for inventory tracking

sku: "SKU_HEADPHONES_PRO"

parent_sku string

info

Parent product SKU for variants or child products. Defaults to sku if not provided.

parent_sku: "SKU_HEADPHONES"

gtin string

info

Global Trade Item Number for product identification

gtin: "1234567890123"

mpn string

info

Manufacturer Part Number assigned by the manufacturer

mpn: "HP-PRO-2024"

ean string

info

European Article Number for product barcoding

ean: "1234567890123"

brand string

info

Product brand or manufacturer name

brand: "AudioTech"

type string

info

Product type. Free-form string (e.g. "simple", "variable", "bundle", "subscription").

type: "simple"

stock_status boolean recommended

info

Product availability (true = in stock, false = out of stock). Defaults to true if not provided.

stock_status: true

stock_location string

info

Physical location or warehouse where product is stored

stock_location: "Main Warehouse EU"

created_at number

info

Timestamp when product was added to inventory (milliseconds)

created_at: 1748505040077

url string

info

Direct URL to the product page

url: "https://shop.example.com/products/headphones-pro"

parent_url string

info

URL to the parent product page (for variants)

parent_url: "https://shop.example.com/products/headphones-collection"

image string

info

Main product image URL

image: "https://cdn.example.com/headphones-main.jpg"

images array

info

Array of additional product image URLs

images: [
"https://cdn.example.com/headphones-front.jpg",
"https://cdn.example.com/headphones-side.jpg"
]

categories array

info

Array of category objects with name and id properties

  • name (string, required) - Category name
  • id (string) - Category identifier
categories: [
{ name: "Electronics", id: "cat_electronics" },
{ name: "Audio", id: "cat_audio" }
]

coupons array

info

Array of product-level coupons applied to this product. View complete Coupon Object documentation

coupons[0] (object) - required

name string required

info

Coupon name or code.

name: "FREE SHIPPING"

value number recommended

info

Coupon discount value.

value: 123.99

tax_included boolean recommended

info

Whether coupon value includes taxes

tax_included: true

tax_percent number recommended

info

Tax percentage for the coupon

tax_percent: 21

id string

info

Coupon internal identifier.

id: "COUPON_INTERNAL_ID"

type string

info

Coupon type. Free-form string, use consistent naming (e.g. "LOYALTY", "SEASONAL", "FIRST_ORDER", "SHIPPING").

type: "SHIPPING"

currency string required-if-applicable

info

Currency code. Specifies the currency code when it differs from event.currency.

currency: "USD"

exchange_rate number

info

Custom exchange rate for multi-currency. Default has value 1. Specifies when it differs from event.exchange_rate.

exchange_rate: 1

properties object recommended

info

Custom product attributes for audience segmentation. Free-form key-value object. Use properties that match your product catalog and business needs.

Product Segmentation

Use the properties object to store custom product attributes, with property names defined by each business as needed, that enable advanced segmentation, personalization, and analytics across your marketing campaigns.

properties: {
color: "space_gray",
storage: "256GB",
memory: "16GB",
connectivity: ["wifi", "bluetooth"],
warranty: "2_years",
energy_rating: "A++",
brand_series: "pro_line"
}

currency string required-if-applicable

info

Currency code. Specifies the currency code when it differs from event.currency.

currency: "USD"

exchange_rate number

info

Custom exchange rate for multi-currency. Default has value 1. Specifies when it differs from event.exchange_rate.

exchange_rate: 1

shipping array required-if-applicable

info

Array of shipping methods for checkout and order events. View complete Shipping Object documentation

shipping[0] object required

name string required

info

Shipping method name

name: "Express Delivery"

value number required

info

Shipping cost value

value: 12.99

tax_included boolean recommended

info

Whether shipping cost includes taxes

tax_included: true

tax_percent number recommended

info

Tax percentage for shipping (0-50)

tax_percent: 19

id string

info

Shipping method identifier.

id: "SHIPPING_INTERNAL_ID"

type string

info

Shipping type. Free-form string, use consistent naming (e.g. "standard", "express", "next_day", "pickup", "free").

type: "standard"

currency string required-if-applicable

info

Currency code. Specifies the currency code when it differs from event.currency.

currency: "USD"

exchange_rate number

info

Custom exchange rate for multi-currency. Default has value 1. Specifies when it differs from event.exchange_rate.

exchange_rate: 1

payments array required-if-applicable

info

Array of payment methods for transaction events. View complete Payment Object documentation

payments[0] object required

name string required

info

Payment method name.

name: "Credit Card - Visa"

value number required

info

Amount paid with this payment method

value: 12.99

id string

info

Payment method internal identifier

id: "PAYMENT_INTERNAL_ID"

type string

info

Payment type. Free-form string, use consistent naming (e.g. "card", "paypal", "bank_transfer", "gift_card", "cash_on_delivery").

type: "card"

coupons array required-if-applicable

info

Array of discount coupons applied to the transaction. View complete Coupon Object documentation

coupons[0] object required

name string required

info

Coupon name or code.

name: "FREE SHIPPING"

value number recommended

info

Coupon discount value.

value: 123.99

tax_included boolean recommended

info

Whether coupon value includes taxes

tax_included: true

tax_percent number recommended

info

Tax percentage for the coupon

tax_percent: 21

id string

info

Coupon internal identifier.

id: "COUPON_INTERNAL_ID"

type string

info

Coupon type. Free-form string, use consistent naming (e.g. "LOYALTY", "SEASONAL", "FIRST_ORDER", "SHIPPING").

type: "SHIPPING"

currency string required-if-applicable

info

Currency code. Specifies the currency code when it differs from event.currency.

currency: "USD"

exchange_rate number

info

Custom exchange rate for multi-currency. Default has value 1. Specifies when it differs from event.exchange_rate.

exchange_rate: 1

user object recommended

info

Customer data object for user identification and analytics. View complete User Object documentation

id string recommended

info

Unique customer identifier in your system.

id: "CUSTOMER_INTERNAL_ID"

email string recommended

info

Customer email address(es) provided in plaintext or as SHA-256 hashed values.

email: "[email protected]" 
// or
email: "3e1ufd1rdnh8l1rfz6xlreyw2yryd4zrf8zsk1pxh2x8wbsp2mw1g93rs5nx68dq"

phone string recommended

info

Customer phone number(s) in E.164 format (plaintext) or as SHA-256 hashed values.

phone: "+40712345678"
// or
phone: "unw5r66oikql4n4tlg2c54bkd2npephsbwwhxuoxreu6ph8uv6k424y9x15opy9y"

first_name string recommended

info

Customer first name

first_name: "John"

last_name string recommended

info

Customer last name

last_name: "Doe"

country string

info

Country name or ISO country code

country: "Romania"

region string recommended

info

State, province, or region name

region: "Bucuresti"

city string recommended

info

City or locality name

city: "Bucuresti"

street string

info

Street address including number

street: "Strada Principala 1"

postal_code string

info

Postal code or ZIP code

postal_code: "700000"

orders_total_number number recommended

info

Cumulative number of orders placed by this user

orders_total_number: 5

orders_canceled_number number recommended

info

Cumulative number of orders placed and canceled by this user

orders_canceled_number: 0

orders_total_value number recommended

info

Cumulative lifetime user orders value (decimal format: 2500.50)

orders_total_value: 1234.99

orders_refunded_value number recommended

info

Cumulative lifetime user orders value canceled (decimal format: 2500.50)

orders_refunded_value: 250.99

predicted_value number

info

Predicted lifetime value of a customer for your business

predicted_value: 100.99

created_at number recommended

info

Timestamp in milliseconds since Unix epoch representing the first time the user was recorded

created_at: 1754926521690

properties object recommended

info

Custom Customer Properties Examples

User Segmentation

Use the properties object to store custom user attributes, with property names defined by each business as needed, that enable advanced segmentation, personalization, and analytics across your marketing campaigns.

properties: {
customer_type: "returning",
membership_level: "platinum",
preferred_category: ["electronics", "fashion"],
last_purchase_date: "2024-12-15",
average_order_value: "350.00",
payment_method_preference: "card",
registration_date: "2023-06-15"
}

consent object recommended

info

analytics boolean required

info

Indicates the user’s explicit consent regarding the collection and processing of data for analytical purposes, such as performance monitoring, usage statistics, and service optimization.

analytics: true

personalization boolean required

info

Indicates the user’s explicit consent regarding the collection and processing of data for personalization purposes, enabling tailored experiences and content customization.

personalization: true

marketing boolean required

info

Indicates the user’s explicit consent regarding the collection and processing of data for marketing purposes, such as targeted advertising, remarketing, and campaign measurement.

marketing: true

cookies object recommended

info

Flat key-value object with platform cookies for attribution and tracking. Each key represents the cookie name and the value represents the cookie value. Both keys and values must be strings. Only cookies mapped by DATA Reshape will be processed — unmapped cookies are accepted but silently ignored. View complete Cookies Object documentation

Event Examples

These examples demonstrate complete data object structures for key events. Each example includes both full implementation and minimal required fields.

Complete Example with All Possible Fields

{
"event": {
"name": "checkout_completed",
"value": 2399.96,
"currency": "USD",
"exchange_rate": 1,
"id": "ORDER_SUCCESS_789456",
"properties": {
"payment_method": "credit_card",
"shipping_method": "express",
"checkout_duration_seconds": 420,
"newsletter_subscription": true,
"gift_message_added": false
}
},
"context": {
"environment": "prod",
"data_source": "website",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"override_ip": "185.120.45.123",
"url": "https://shop.example.com/checkout/success",
"landing_url": "https://shop.example.com/electronics/professional?utm_source=google&utm_medium=cpc&utm_campaign=pro_cameras",
"referrer_url": "https://google.com/search?q=professional+cameras"
},
"products": [
{
"id": "DSLR_CAMERA_PRO_001",
"parent_id": "DSLR_CAMERA_PRO_SERIES",
"sku": "DSLR-PRO-24MP-001",
"parent_sku": "DSLR-PRO-24MP",
"gtin": "2468135790864",
"mpn": "DSLR-PRO-2024-001",
"ean": "2468135790864",
"name": "Professional DSLR Camera 24.2MP",
"parent_name": "Professional DSLR Camera Series",
"brand": "PhotoMaster",
"type": "simple",
"price_base": 1599.99,
"price": 1399.99,
"currency": "USD",
"exchange_rate": 1,
"tax_included": true,
"tax_percent": 8,
"quantity": 1,
"stock_status": true,
"stock_location": "Professional Equipment Warehouse",
"created_at": 1748505040077,
"url": "https://shop.example.com/dslr-camera-professional-24mp",
"parent_url": "https://shop.example.com/dslr-cameras-professional",
"image": "https://cdn.example.com/images/dslr-pro-001.jpg",
"images": [
"https://cdn.example.com/images/dslr-pro-001-front.jpg",
"https://cdn.example.com/images/dslr-pro-001-side.jpg"
],
"category": "Electronics > Cameras > DSLR",
"categories": [
{
"name": "Electronics",
"id": "cat_electronics"
},
{
"name": "Cameras",
"id": "cat_cameras"
},
{
"name": "DSLR",
"id": "cat_dslr"
}
],
"coupons": [
{
"name": "CAMERA_DEAL",
"value": 200.00,
"tax_included": true,
"tax_percent": 8,
"type": "SEASONAL"
}
],
"properties": {
"sensor_type": "APS-C",
"megapixels": 24.2,
"video_resolution": "4K",
"warranty_years": 2,
"model_year": 2024
}
},
{
"id": "LENS_ZOOM_75_300",
"sku": "LENS-ZOOM-75-300",
"name": "Telephoto Zoom Lens 75-300mm",
"brand": "PhotoMaster",
"type": "simple",
"price_base": 499.99,
"price": 449.99,
"currency": "USD",
"tax_included": true,
"tax_percent": 8,
"quantity": 1,
"category": "Electronics > Camera Accessories > Lenses"
}
],
"shipping": [
{
"name": "Express Delivery",
"value": 24.99,
"currency": "USD",
"exchange_rate": 1,
"tax_included": true,
"tax_percent": 8,
"id": "SHIP_EXPRESS_001",
"type": "express"
}
],
"payments": [
{
"name": "Credit Card - Visa",
"value": 2399.96,
"id": "PAY_VISA_001",
"type": "card"
}
],
"coupons": [
{
"name": "WELCOME25",
"value": 400.00,
"currency": "USD",
"exchange_rate": 1,
"tax_included": true,
"tax_percent": 8,
"id": "COUPON_WELCOME25",
"type": "WELCOME"
}
],
"user": {
"id": "CUST_12345",
"email": "[email protected]",
"phone": "+1555123456",
"first_name": "John",
"last_name": "Doe",
"country": "US",
"region": "California",
"city": "San Francisco",
"street": "123 Market Street, Apt 4B",
"postal_code": "94105",
"orders_total_number": 3,
"orders_canceled_number": 0,
"orders_total_value": 3567.89,
"orders_refunded_value": 0,
"predicted_value": 5000.00,
"created_at": 1640995200000,
"properties": {
"customer_segment": "loyal",
"acquisition_channel": "paid_search",
"preferred_categories": "electronics",
"loyalty_tier": "gold"
}
},
"consent": {
"analytics": true,
"personalization": true,
"marketing": true
},
"cookies": {
"_ga": "GA1.2.123456789.1640995200",
"_gid": "GA1.2.987654321.1640995200",
"_gcl_aw": "GCL.1640995200.CjwKCAiA",
"_fbp": "fb.1.1640995200.123456789"
}
}

Response Format

Success Response

{
"emitter": "DATA Reshape",
"detail": "Received. This has been processed.",
"level": 2,
"warnings": []
}

Success Response with Warnings

{
"emitter": "DATA Reshape",
"detail": "Received. This has been processed.",
"level": 2,
"warnings": [
"context.url is missing. Fallback to config host.",
"consent object does not match the required format and will be set to an object with all values set to true."
]
}

Error Response

{
"emitter": "DATA Reshape",
"detail": "event.id is missing or does not match the required format.",
"level": 2
}

Development Environment Response

When context.environment is set to dev or the endpoint ends with /test, the event is not processed but you receive the validated payload for debugging:

{
"emitter": "DATA Reshape",
"detail": "Received. This will NOT be processed.",
"level": 2,
"warnings": [],
"data_received": { }
}

Implementation

$scriptId = 'YOUR_SCRIPT_ID';
$accessToken = 'YOUR_ACCESS_TOKEN';
$endpoint = 'https://your-subdomain.datareshape.net/webhooks/reshape/event?id=' . $scriptId;

$payload = [
'event' => [
'name' => 'checkout_completed',
'value' => 299.99,
'currency' => 'RON',
'id' => $orderId
],
'context' => [
'environment' => 'prod',
'data_source' => 'website',
'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? '',
'url' => 'https://shop.example.com/checkout/success'
],
'products' => $products,
'shipping' => $shipping,
'payments' => $payments,
'user' => [
'email' => $customer['email'],
'first_name' => $customer['first_name'],
'last_name' => $customer['last_name']
],
'cookies' => [
'_ga' => $_COOKIE['_ga'] ?? null,
'_fbp' => $_COOKIE['_fbp'] ?? null
],
'consent' => [
'analytics' => true,
'personalization' => true,
'marketing' => true
]
];

$ch = curl_init($endpoint);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-Dre-Access-Token: ' . $accessToken
],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
$data = json_decode($response, true);
// Check warnings array for any issues
if (!empty($data['warnings'])) {
error_log('DATA Reshape warnings: ' . implode(', ', $data['warnings']));
}
} else {
error_log('DATA Reshape error (' . $httpCode . '): ' . $response);
}

Best Practices

  1. Event Validation — validate event data before sending to ensure required fields are present
  2. Unique IDs — use consistent, unique identifiers for events to prevent duplicate tracking
  3. Value Calculation — ensure event values accurately represent business metrics
  4. Properties Limit — keep custom properties focused and limit to 5 key properties for optimal performance
  5. Currency Consistency — use consistent currency codes across related events
  6. Environment Testing — use context.environment: "dev" or the /test endpoint suffix during integration to validate payloads without processing

Support

For technical support and integration assistance: