openapi: 3.1.0
info:
  title: Upsurge server-side Smart Search and Recommendations API
  version: '1.0.0'
  description: |
    Call Smart Search and Recommendations from your own server with a secret API key, and report
    the clicks, touches and orders that credit them. Read the guide at /docs/api/server-side-search-and-recommendations.

    Search and recommendations calls need a merchant that Upsurge has enabled for server access.
    A refusal carries one of the reason codes listed in `x-reason-codes`.
servers:
  - url: https://api.upsur.ge/api/v1
security:
  - SecretKey: []
x-reason-codes:
  - server_api_not_enabled
  - merchant_inactive
  - recommendations_disabled
  - unknown_external_product_id
  - ambiguous_external_product_id
  - search_monthly_allowance_exceeded
paths:
  /storefront/search:
    post:
      operationId: searchProducts
      summary: Run a Smart Search query
      description: |
        Needs the `search:read` permission. Responses are `no-store`.
        A search is recorded as a `search` event only when `consent.analytics` is `true`,
        `subject.session_id` is sent and the query is not blank. `subject.merchant_user_id` is ignored
        unless `consent.personalization` is `true`: results are not personalized and the event does not carry it.
      tags: [Search]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
            examples:
              recorded_search:
                summary: Search recorded for analytics
                value:
                  q: running shoes
                  surface: headless
                  page: 1
                  per_page: 12
                  locale: en
                  sort: relevance
                  consent:
                    personalization: false
                    analytics: true
                  subject:
                    session_id: sess_2f9c1a7d4b
                    device_id: dev_8c13e0aa
              filtered_search:
                summary: Filtered search for a signed-in shopper
                value:
                  q: trail
                  per_page: 24
                  sort: price_asc
                  filters:
                    brands: [Acme]
                    price_max: 150
                    in_stock: true
                  consent:
                    personalization: true
                    analytics: true
                  subject:
                    merchant_user_id: cust_1042
                    session_id: sess_2f9c1a7d4b
      responses:
        '200':
          description: |
            Search results in `data`. Each product carries `product_id`, the Upsurge ID to send in click
            events, and `external_id`, your own product ID, when the product has one.
          headers:
            Cache-Control:
              schema: { type: string, const: no-store }
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400': { $ref: '#/components/responses/ValidationError' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Refused' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /storefront/collections/{slug}:
    get:
      operationId: getCollection
      summary: Read a Smart Collection's public metadata
      tags: [Search]
      parameters:
        - $ref: '#/components/parameters/CollectionSlug'
      responses:
        '200':
          description: Public metadata of an active collection on the key's site.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionResponse'
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Refused' }
        '404': { $ref: '#/components/responses/CollectionNotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /storefront/collections/{slug}/query:
    post:
      operationId: queryCollection
      summary: Query a Smart Collection
      description: |
        Takes the same body as search. Recorded as a `search` event and a `smart_collection_impression`
        under the same consent and session rules.
      tags: [Search]
      parameters:
        - $ref: '#/components/parameters/CollectionSlug'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
            examples:
              collection_page:
                summary: First page of a collection
                value:
                  page: 1
                  per_page: 12
                  consent:
                    personalization: false
                    analytics: true
                  subject:
                    session_id: sess_2f9c1a7d4b
      responses:
        '200':
          description: |
            The collection in `data.collection` and its results in `data.result`, which has the same
            shape as `data` of a search response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionQueryResponse'
        '400': { $ref: '#/components/responses/ValidationError' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Refused' }
        '404': { $ref: '#/components/responses/CollectionNotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /recommendations:
    get:
      operationId: getRecommendations
      summary: Get product recommendations
      description: |
        Needs the `recommendations:read` permission (a missing permission is `403`).
        Identify products by Upsurge ID (`product_id`, `product_ids`) or by your own ID
        (`external_product_id`, `external_product_ids`), never both. The serve is recorded as a
        `recommendation_impression` only when `analytics_consent=true` and `session_id` are both sent.
        A serve with no recommendations records nothing, except in a running experiment.
        `merchant_user_id` and `device_id` are used to look up the shopper's profile and history with no
        consent check: send them only for shoppers who allowed personalization.
      tags: [Recommendations]
      x-query-examples:
        product_page:
          context: product_page
          external_product_id: SKU-1042
          limit: 6
          session_id: sess_2f9c1a7d4b
          analytics_consent: 'true'
        cart_page:
          context: cart_page
          external_product_ids: [SKU-1042, SKU-2210]
          limit: 4
          session_id: sess_2f9c1a7d4b
          analytics_consent: 'true'
          merchant_user_id: cust_1042
      parameters:
        - name: context
          in: query
          required: true
          schema:
            type: string
            enum: [product_page, cart_page, checkout, homepage, category_page, search_results]
        - name: product_id
          in: query
          schema: { type: string }
        - name: product_ids
          in: query
          description: Repeated or comma-separated, at most 50.
          schema: { type: array, items: { type: string }, maxItems: 50 }
        - name: external_product_id
          in: query
          description: Your own product ID, one, for `product_page`.
          schema: { type: string, minLength: 1, maxLength: 255 }
        - name: external_product_ids
          in: query
          description: Your own product IDs, repeated or comma-separated, at most 50, for `cart_page` and `checkout`.
          schema: { type: array, items: { type: string, minLength: 1, maxLength: 255 }, maxItems: 50 }
        - name: category
          in: query
          schema: { type: string }
        - name: search_query
          in: query
          schema: { type: string, maxLength: 200 }
        - name: limit
          in: query
          schema: { type: integer, minimum: 1, maximum: 20, default: 6 }
        - name: campaign_id
          in: query
          schema: { type: string }
        - name: device_id
          in: query
          schema: { type: string }
        - name: merchant_user_id
          in: query
          description: The signed-in customer, named directly by your server.
          schema: { type: string }
        - name: session_id
          in: query
          description: The shopper's visit. Required, with `analytics_consent=true`, to record the impression.
          schema: { type: string, minLength: 1, maxLength: 160 }
        - name: analytics_consent
          in: query
          description: Only the literal `true` or `false` is accepted.
          schema: { type: string, enum: ['true', 'false'] }
      responses:
        '200':
          description: |
            Recommendations in `data.recommendations`, and the IDs you send back with clicks and touches
            in `data.meta`. Items carry `external_id` and `sku` when the product has them.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecommendationsResponse'
        '400':
          description: Invalid request, or an unknown or ambiguous external product ID (`details.reason`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Refused' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /events/track:
    post:
      operationId: trackEvent
      summary: Report a click or an order
      description: |
        Needs the `events:track` permission. Send `search_result_click`, `recommendation_click`
        and `purchase` here. A secret-key `purchase` or `checkout_complete` may carry
        `properties.external_product_ids` (at most 50). Send these purchases here, not to `/events/batch`.
        A secret-key event is recorded without a consent check and goes through full processing
        (profiles, workflows, connected destinations): send events only for shoppers who allowed
        analytics, with `context.analytics_consent: true`.
      tags: [Reporting]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrackEvent'
            examples:
              search_result_click:
                value:
                  event_type: search_result_click
                  session_id: sess_2f9c1a7d4b
                  device_id: dev_8c13e0aa
                  properties:
                    search_id: srch_01JEXAMPLE
                    query: running shoes
                    product_id: prod_7f3a
                    position: 2
                  context:
                    page_url: https://shop.example.com/search?q=running+shoes
                    user_agent: ExampleStorefront/1.0
                    analytics_consent: true
              recommendation_click:
                value:
                  event_type: recommendation_click
                  session_id: sess_2f9c1a7d4b
                  device_id: dev_8c13e0aa
                  properties:
                    recommendation_id: rec_01JEXAMPLE
                    campaign_id: camp_01JEXAMPLE
                    product_id: prod_91bc
                  context:
                    page_url: https://shop.example.com/products/trail-shoe
                    user_agent: ExampleStorefront/1.0
                    analytics_consent: true
              purchase:
                value:
                  event_type: purchase
                  session_id: sess_2f9c1a7d4b
                  device_id: dev_8c13e0aa
                  properties:
                    transaction_id: order_10045
                    total_amount: 129.9
                    currency: EUR
                    external_product_ids: [SKU-1042, SKU-2210]
                  context:
                    page_url: https://shop.example.com/checkout/thank-you
                    user_agent: ExampleStorefront/1.0
                    analytics_consent: true
      responses:
        '200': { $ref: '#/components/responses/Accepted' }
        '201': { $ref: '#/components/responses/Accepted' }
        '400': { $ref: '#/components/responses/ValidationError' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '429': { $ref: '#/components/responses/RateLimited' }
  /attribution/touchpoints:
    post:
      operationId: recordTouchpoint
      summary: Report a recommendation click as an attribution touch
      description: |
        Needs the `attribution:touch` permission. A secret-key call needs no `Origin` or `Referer`.
        Keep one stable `session_id` of 8-128 characters per shopper visit, and use it in every call.
        Keep the `journey_token` from the response with the shopper's session and send it with the next touch and with the purchase.
      tags: [Reporting]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TouchpointIngestion'
            examples:
              recommendation_click:
                value:
                  schema_version: 1
                  consent:
                    analytics: true
                    advertising: false
                  touchpoints:
                    - schema_version: 1
                      touchpoint_id: tp_01JEXAMPLE0001
                      session_id: sess_2f9c1a7d4b
                      occurred_at: '2026-11-21T10:15:00Z'
                      kind: product
                      state: recommendation
                      channel: recommendation
                      campaign_id: camp_01JEXAMPLE
                      campaign_type: recommendation
                      product_interaction: recommendation_click
                      delivery_token: replace_with_meta_attribution_delivery_token
      responses:
        '200': { $ref: '#/components/responses/TouchRecorded' }
        '201': { $ref: '#/components/responses/TouchRecorded' }
        '400': { $ref: '#/components/responses/ValidationError' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '409':
          description: A touchpoint ID was replayed with a different payload.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '429': { $ref: '#/components/responses/RateLimited' }
  /commerce/conversions:
    post:
      operationId: recordConversion
      summary: Report the authoritative order
      description: |
        Needs the `commerce:convert` permission. Send the `journey_token` from the touchpoint response
        to credit the recommendation campaign with revenue. Amounts are in minor units.
      tags: [Reporting]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Purchase'
            examples:
              purchase:
                value:
                  schema_version: 1
                  event_type: purchase
                  idempotency_key: order_10045_purchase
                  website_id: site_01JEXAMPLE
                  order_id: order_10045
                  occurred_at: '2026-11-21T10:22:00Z'
                  source: trusted_server
                  currency: EUR
                  revenue_minor: 12990
                  journey_token: replace_with_the_journey_token_from_the_touchpoint_response
      responses:
        '200':
          description: The same idempotency key was already recorded.
          content:
            application/json:
              schema: { type: object, additionalProperties: true }
        '201':
          description: Recorded.
          content:
            application/json:
              schema: { type: object, additionalProperties: true }
        '400': { $ref: '#/components/responses/ValidationError' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '429': { $ref: '#/components/responses/RateLimited' }
components:
  securitySchemes:
    SecretKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: A site-scoped secret key, for example `upsurge_sk_test_replace_me`. Keep it on your server.
  parameters:
    CollectionSlug:
      name: slug
      in: path
      required: true
      schema: { type: string }
  responses:
    ValidationError:
      description: The request failed validation.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    Unauthorized:
      description: The key is missing or invalid.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    Forbidden:
      description: The key lacks the permission this call needs.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    Refused:
      description: |
        The key lacks the permission, or the call was refused with `error.details.reason` set to one of
        `server_api_not_enabled`, `merchant_inactive` or `recommendations_disabled`.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    RateLimited:
      description: |
        The hourly rate limit is used up: it is counted per account over a sliding hour and shared by
        every secret-key call to these routes, and Upsurge sets the key's limit when it enables server
        access. Wait until `X-RateLimit-Reset`, then retry with jitter. For search and collection queries,
        `details.reason` `search_monthly_allowance_exceeded` instead means the monthly search allowance is
        used up; that response has no `X-RateLimit-Reset` and retrying does not help until the next month (UTC).
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    CollectionNotFound:
      description: No active Smart Collection has this slug on the key's site.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    Unavailable:
      description: A dependency is temporarily unavailable. Retry with backoff.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    Accepted:
      description: The event was accepted.
      content:
        application/json:
          schema: { type: object, additionalProperties: true }
    TouchRecorded:
      description: Recorded. `data.journey_token` is the token to keep for the visit.
      content:
        application/json:
          schema:
            type: object
            properties:
              success: { type: boolean }
              data:
                type: object
                properties:
                  journey_token: { type: string }
                additionalProperties: true
            additionalProperties: true
  schemas:
    Error:
      type: object
      properties:
        success: { type: boolean, const: false }
        error:
          type: object
          properties:
            code: { type: string }
            message: { type: string }
            details:
              type: object
              properties:
                reason:
                  type: string
                  enum:
                    - server_api_not_enabled
                    - merchant_inactive
                    - recommendations_disabled
                    - unknown_external_product_id
                    - ambiguous_external_product_id
                    - search_monthly_allowance_exceeded
              additionalProperties: true
        meta:
          type: object
          properties:
            request_id: { type: string }
          additionalProperties: true
    SearchRequest:
      type: object
      additionalProperties: false
      properties:
        q: { type: string, maxLength: 200, default: '' }
        surface: { type: string, enum: [autocomplete, results, headless] }
        page: { type: integer, minimum: 1, default: 1 }
        per_page: { type: integer, minimum: 1, maximum: 24, default: 12 }
        locale: { type: string, minLength: 2, maxLength: 35 }
        sort:
          type: string
          enum: [relevance, price_asc, price_desc, newest, popularity]
          default: relevance
        facets: { type: array, items: { type: string }, maxItems: 56 }
        filters:
          type: object
          properties:
            brands: { type: array, items: { type: string }, maxItems: 25 }
            categories: { type: array, items: { type: string }, maxItems: 50 }
            price_min: { type: number, minimum: 0 }
            price_max: { type: number, minimum: 0 }
            in_stock: { type: boolean }
            metafields: { type: object, additionalProperties: true }
            attributes:
              type: object
              additionalProperties: { type: array, items: { type: string }, minItems: 1, maxItems: 25 }
        consent:
          type: object
          additionalProperties: false
          required: [personalization]
          properties:
            personalization: { type: boolean }
            analytics: { type: boolean }
        intent:
          type: object
          additionalProperties: false
          properties:
            preferred_categories: { type: array, items: { type: string }, maxItems: 10 }
            preferred_brands: { type: array, items: { type: string }, maxItems: 10 }
            recent_product_ids: { type: array, items: { type: string }, maxItems: 20 }
        subject:
          type: object
          additionalProperties: false
          properties:
            merchant_user_id: { type: string, maxLength: 160 }
            upsurge_person_id: { type: string, maxLength: 160 }
            hashed_email: { type: string, pattern: '^[a-fA-F0-9]{64}$' }
            device_id: { type: string, maxLength: 160 }
            session_id: { type: string, maxLength: 160 }
    ResponseMeta:
      type: object
      description: |
        The envelope's own metadata. Recommendation tracking IDs are in `data.meta`, not here.
      required: [timestamp, request_id]
      properties:
        timestamp: { type: string, format: date-time }
        request_id: { type: string }
      additionalProperties: true
    SearchProduct:
      type: object
      required: [product_id, title, sku]
      properties:
        product_id: { type: string, description: Upsurge product ID. Send it in click events. }
        external_id: { type: string, description: Your own product ID, when the product has one. }
        sku: { type: string }
        title: { type: string }
      additionalProperties: true
    SearchResult:
      type: object
      required: [search_id, query, found, page, per_page, total_pages, products, zero_results]
      properties:
        search_id: { type: string, description: Send it back with search result clicks. }
        query: { type: string }
        found: { type: integer }
        page: { type: integer }
        per_page: { type: integer }
        total_pages: { type: integer }
        products:
          type: array
          items: { $ref: '#/components/schemas/SearchProduct' }
        zero_results: { type: boolean }
      additionalProperties: true
    SearchResponse:
      type: object
      required: [success, data, meta]
      properties:
        success: { type: boolean, const: true }
        data: { $ref: '#/components/schemas/SearchResult' }
        meta: { $ref: '#/components/schemas/ResponseMeta' }
      additionalProperties: true
    Collection:
      type: object
      description: Public collection metadata. `description` is present when the collection has one.
      required: [collection_id, slug, name, default_sort]
      properties:
        collection_id: { type: string }
        slug: { type: string }
        name: { type: string }
        default_sort: { type: string }
      additionalProperties: true
    CollectionResponse:
      type: object
      required: [success, data, meta]
      properties:
        success: { type: boolean, const: true }
        data:
          type: object
          required: [collection, config_version]
          properties:
            collection: { $ref: '#/components/schemas/Collection' }
            config_version: { type: integer }
          additionalProperties: true
        meta: { $ref: '#/components/schemas/ResponseMeta' }
      additionalProperties: true
    CollectionQueryResponse:
      type: object
      required: [success, data, meta]
      properties:
        success: { type: boolean, const: true }
        data:
          type: object
          required: [collection, result]
          properties:
            collection: { $ref: '#/components/schemas/Collection' }
            result: { $ref: '#/components/schemas/SearchResult' }
          additionalProperties: true
        meta: { $ref: '#/components/schemas/ResponseMeta' }
      additionalProperties: true
    RecommendationItem:
      type: object
      required: [product_id, name, price, position]
      properties:
        product_id: { type: string, description: Upsurge product ID. Send it in the click event. }
        external_id: { type: string, description: Your own product ID, when the product has one. }
        sku: { type: string, description: Present when the product has one. }
        name: { type: string }
        price: { type: number }
        position: { type: integer, minimum: 1 }
      additionalProperties: true
    RecommendationMeta:
      type: object
      required: [recommendation_id, campaign_id]
      properties:
        recommendation_id: { type: string, description: Send it with the shopper's `recommendation_click`. }
        campaign_id:
          type: string
          description: The campaign that served the response, or `default` when no campaign matched.
        attribution_delivery_token:
          type: string
          description: |
            Present only when a campaign matched (`campaign_id` is not `default`). Send it as the
            touch's `delivery_token`. Without a campaign there is no token and no recommendation revenue.
        experiment:
          type: object
          description: |
            Present when the campaign is in a running experiment. Copy it unchanged as
            `properties.experiment` onto the shopper's `recommendation_click` (with `properties.campaign_id`
            set to `campaign_id`) and onto their purchases after that click within
            `experiment.conversion_window_hours` hours of the serve; experiment results count only
            clicks and purchases that carry it.
          additionalProperties: true
        bundle:
          type: object
          description: Present for a manual bundle campaign.
          additionalProperties: true
      additionalProperties: true
    RecommendationsResponse:
      type: object
      required: [success, data, meta]
      properties:
        success: { type: boolean, const: true }
        data:
          type: object
          required: [recommendations, meta]
          properties:
            recommendations:
              type: array
              items: { $ref: '#/components/schemas/RecommendationItem' }
            meta: { $ref: '#/components/schemas/RecommendationMeta' }
          additionalProperties: true
        meta: { $ref: '#/components/schemas/ResponseMeta' }
      additionalProperties: true
    TrackEvent:
      type: object
      required: [event_type, session_id, context]
      properties:
        event_type:
          type: string
          description: This guide uses `search_result_click`, `recommendation_click`, `purchase` and `checkout_complete`.
        session_id: { type: string, minLength: 1 }
        device_id: { type: string }
        user_id: { type: string }
        client_event_id: { type: string }
        occurred_at: { type: string, format: date-time }
        properties:
          type: object
          properties:
            external_product_ids:
              type: array
              items: { type: string }
              maxItems: 50
            experiment:
              type: object
              description: |
                The recommendations response's `data.meta.experiment`, unchanged, on a `recommendation_click`
                or a purchase in the experiment's conversion window.
              additionalProperties: true
          additionalProperties: true
        context:
          type: object
          required: [page_url, user_agent]
          properties:
            page_url: { type: string, format: uri }
            user_agent: { type: string, minLength: 1 }
            analytics_consent:
              type: boolean
              description: Send `true`; send events only for shoppers who allowed analytics.
          additionalProperties: true
    TouchpointInput:
      type: object
      additionalProperties: false
      required: [schema_version, touchpoint_id, session_id, occurred_at, kind, state, channel]
      properties:
        schema_version: { type: integer, const: 1 }
        touchpoint_id: { type: string, minLength: 8, maxLength: 128 }
        session_id:
          type: string
          minLength: 8
          maxLength: 128
          description: One stable ID per shopper visit, 8-128 characters.
        occurred_at: { type: string, format: date-time }
        kind: { type: string, enum: [acquisition, product, partner] }
        state: { type: string, maxLength: 80 }
        channel: { type: string, maxLength: 80 }
        campaign_id: { type: string, maxLength: 200 }
        campaign_type: { type: string, enum: [overlay, recommendation, chatbot] }
        product_interaction: { type: string, enum: [overlay_clicked, recommendation_click, chatbot_message] }
        delivery_token: { type: string, minLength: 20, maxLength: 4096 }
    TouchpointIngestion:
      type: object
      additionalProperties: false
      required: [schema_version, touchpoints]
      properties:
        schema_version: { type: integer, const: 1 }
        journey_token: { type: string, minLength: 20, maxLength: 4096 }
        consent:
          type: object
          properties:
            analytics: { type: boolean }
            advertising: { type: boolean }
        subject:
          type: object
          properties:
            authenticated_user_hash: { type: string, pattern: '^[a-f0-9]{64}$' }
            anonymous_id: { type: string, minLength: 8, maxLength: 128 }
        touchpoints:
          type: array
          minItems: 1
          maxItems: 50
          items: { $ref: '#/components/schemas/TouchpointInput' }
    Purchase:
      type: object
      additionalProperties: false
      required: [schema_version, event_type, idempotency_key, website_id, order_id, occurred_at, source, currency, revenue_minor]
      properties:
        schema_version: { type: integer, const: 1 }
        event_type: { type: string, const: purchase }
        idempotency_key: { type: string, minLength: 8, maxLength: 255 }
        website_id: { type: string }
        order_id: { type: string }
        occurred_at: { type: string, format: date-time }
        source: { type: string, enum: [trusted_server] }
        currency: { type: string, pattern: '^[A-Z]{3}$' }
        revenue_minor: { type: integer, minimum: 0 }
        journey_token: { type: string, minLength: 20, maxLength: 4096 }
