Skip to main content
This page documents the OneView API for sending events. In most cases, you’ll use the OneView Server Tag template which handles all API details automatically.
This API reference is for advanced use cases. If you’re using Google Tag Manager Server-Side, use the OneView Server Tag template instead of making direct API calls.

Endpoint

POST https://earth.oneviewhub.cloud/v1/sgtm
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

Authentication

All requests must include an API key in the Authorization header.
Authorization
string
required
Bearer token containing your OneView API key. Format: Bearer YOUR_API_KEYYou can generate an API key from Settings > API Key in your OneView workspace.

Request Headers

Content-Type
string
required
Must be set to application/json
Idempotency-Key
string
Optional. A unique key to ensure idempotency. Multiple requests with the same idempotency key are treated as duplicates, and only the first occurrence is processed.Use a unique identifier for each event (e.g., transaction ID, event timestamp + user ID).

Request Body

The request body must be a JSON array containing one or more event objects.
[
  {
    "event_name": "purchase",
    "event_payload": {
      "transaction_id": "T12345",
      "value": 99.99,
      "currency": "USD",
      "items": [
        {
          "item_id": "SKU123",
          "item_name": "Product Name",
          "price": 99.99,
          "quantity": 1
        }
      ]
    },
    "event_metadata": {
      "consent": {
        "analytics_storage": true,
        "ad_storage": true,
        "ad_user_data": true,
        "ad_personalization": true
      },
      "identifiers": [
        {
          "alias_type": "client",
          "anonymous_client_id": "1234567890.1234567890"
        },
        {
          "alias_type": "user",
          "user_id": "user_12345"
        },
        {
          "alias_type": "email",
          "hashed_email": "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"
        }
      ]
    }
  }
]

Request Fields

Event Object

event_name
string
required
The name of the event (e.g., page_view, purchase, sign_up).
event_payload
object
required
All event data including transaction details, item information, page data, etc. This should contain all fields from your Common Event Data.
event_metadata
object
required
Metadata about the event including consent and identifiers.

Response

Success Response

{
  "status": "success"
}

Error Responses

{
  "error": "Invalid request format",
  "message": "event_name is required"
}
{
  "error": "Unauthorized",
  "message": "Invalid or missing API key"
}
{
  "error": "Rate limit exceeded",
  "message": "Too many requests. Please try again later."
}

PII Hashing

Personally identifiable information (PII) must be hashed using SHA-256 before being sent to OneView:
  • Email addresses: Lowercased, trimmed, then hashed
  • Phone numbers: Hashed in both E.164 format (with +) and numeric format (without +)
  • Names: Lowercased, trimmed, then hashed
The OneView Server Tag template handles all PII hashing automatically. If making direct API calls, you must hash PII yourself using SHA-256.

Idempotency

The API supports idempotency through the Idempotency-Key header. Multiple requests with the same idempotency key are treated as duplicates:
  • Only the first request is processed
  • Subsequent requests with the same key return success but are not processed
  • Idempotency keys should be unique per event
Use a combination of event timestamp and user ID, or a transaction ID, to generate unique idempotency keys.

Rate Limits

The API has rate limits to ensure fair usage. If you exceed the rate limit, you’ll receive a 429 Too Many Requests response.
Rate limits vary by workspace plan. Contact support if you need higher limits.

Timeout

The API has a timeout of 1500ms (1.5 seconds). Requests that exceed this timeout will fail.

Best Practices

Use the Server Tag template instead of making direct API calls. It handles all formatting, hashing, and error handling automatically.
Include multiple identifiers in each event to improve identity resolution accuracy.
Set appropriate consent values based on user consent preferences to ensure compliance.
Use idempotency keys for critical events like purchases to prevent duplicate processing.

Next Steps