Skip to content

Add Global Profile API support - #101

Open
tholovina-sift wants to merge 2 commits into
masterfrom
atlas-382-global-profile-api
Open

Add Global Profile API support#101
tholovina-sift wants to merge 2 commits into
masterfrom
atlas-382-global-profile-api

Conversation

@tholovina-sift

@tholovina-sift tholovina-sift commented Aug 18, 2026

Copy link
Copy Markdown

Purpose:

  • Add client support for the new Global Profile API, which returns cross-tenant identity, decision, chargeback, order, transaction, and location signals for a user
  • Expose two new endpoints: GET /v3/accounts/{accountId}/global_profile/users/{userId} (lookup by Sift user ID) and POST /v3/accounts/{accountId}/global_profile/lookup (lookup by email and/or phone)

Technical overview:

  • Sift.global_profile_api_path and Sift.global_profile_lookup_api_path path helpers added to lib/sift.rb
  • get_global_profile(user_id, opts = {}) — GET endpoint; supports :global_only and :include_own_data optional query params; raises RuntimeError if user_id, api_key, or account_id is nil or empty
  • get_global_profile_by_attributes(params = {}, opts = {}) — POST endpoint with JSON body {email, phone}; raises RuntimeError if neither :email nor :phone is provided; strips whitespace before validation so blank strings are rejected
  • Both methods follow existing SDK conventions: HTTP Basic auth via api_client, Sift::Response wrapper, account_id / api_key / timeout overrides via opts

Testing plan:

  • This PR contains all required labels and reviewers as per our Change Management Procedure

  • Live tested against the Sift API with a real account: both GET and POST returned ok=true with identity_found=true, link_count=31, and fully populated location entries

Deployment plan:

  • Related documentation is updated

    • README.md: new "Global Profile API" section with usage examples
    • HISTORY: new 4.7.0 entry
    • lib/sift/version.rb: version bumped to 4.7.0
  • Merge when Global Profile API is publicly available

  • Merge before https://github.com/SiftScience/sift-docs/pull/92

Rollback plan:

  • Revert this PR; no schema changes, no breaking changes to existing methods, fully additive

Customer Impact Assessment:

tholovina-sift and others added 2 commits August 18, 2026 21:34
Co-Authored-By: Claude <noreply@anthropic.com>
- Add nil guard before account_id.empty? in both methods (P1)
- Add params ||= {} to fix nil crash in get_global_profile_by_attributes (P2)
- Strip whitespace from email/phone before empty check and before body assignment (P2)
- Fix RDoc exception class from ApiException to RuntimeError with network error note (P2)
- Convert global_only/include_own_data booleans to strings for consistency with track (P3)
- Content-Type on GET left as-is: PSP merchant GET also sets it (P2/finding 5)
- Add inline comment noting HTTP client host uncertainty (P0)
- Add tests for nil account_id and nil params raising RuntimeError

Co-Authored-By: Claude <noreply@anthropic.com>
@tholovina-sift
tholovina-sift marked this pull request as ready for review August 20, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant