Orchestra Internal API Mapping

Multiple Profile Management

Netflix-style multi-profile system with 3-layer architecture: API Gateway → Orchestration → Microservices

View Postman Documentation

3-Layer Architecture

API Gateway Public (Internet)
Customer Account Internal Orchestration
Customer User Service Core Microservices

SERVICE LAYERS

API Gateway Layer 1
Customer Account Layer 2
Customer User Service Layer 3
Caching Service Shared

Redis Key Format for Active Profile

user:{user_id}:device:{device_id}:active_profile

This key stores the currently selected profile_id for each user-device combination, enabling per-device profile isolation.

Create a New Profile

Creates a new profile under the user's account

POST
API Gateway Layer 1 - Public
POST /profiles
Customer Account Layer 2 - Orchestration
POST /profiles
Customer User Service Layer 3 - Core Microservices
POST /api/profiles

Get All Profiles

Retrieves all profiles associated with the user's account

GET
API Gateway Layer 1 - Public
GET /profiles
Customer Account Layer 2 - Orchestration
GET /profiles
Customer User Service Layer 3 - Core Microservices
GET /api/profiles

Get Profile by ID

Retrieves a specific profile by its unique identifier

GET
API Gateway Layer 1 - Public
GET /profiles/{{profile_id}}
Customer Account Layer 2 - Orchestration
GET /profiles/{{profile_id}}
Customer User Service Layer 3 - Core Microservices
GET /api/profiles/{{profile_id}}

Update Profile

Updates an existing profile's information

PUT
API Gateway Layer 1 - Public
PUT /profiles/{{profile_id}}
Customer Account Layer 2 - Orchestration
PUT /profiles/{{profile_id}}
Customer User Service Layer 3 - Core Microservices
PUT /api/profiles/{{profile_id}}

Delete Profile

Permanently removes a profile from the account

DELETE
API Gateway Layer 1 - Public
DELETE /profiles/{{profile_id}}
Customer Account Layer 2 - Orchestration
DELETE /profiles/{{profile_id}}
Customer User Service Layer 3 - Core Microservices
DELETE /api/profiles/{{profile_id}}

Set Default Profile

Sets a profile as the default for the account

GET
API Gateway Layer 1 - Public
GET /profiles/default
Customer Account Layer 2 - Orchestration
GET /profiles/default
Customer User Service Layer 3 - Core Microservices
PUT /api/profiles/{{profile_id}}

Updates the is_default flag on the profile

Select Profile for Session

Selects a profile to use for the current device session (uses Redis)

POST
API Gateway Layer 1 - Public
POST /profiles/select
Customer Account Layer 2 - Orchestration
POST /profiles/select
Caching Service Shared Services (Redis)
POST /api/caching/set
Redis Key:
user:{user_id}:device:{device_id}:active_profile
Value: {profile_id}

Get Current Active Profile

Retrieves the currently active profile for this device (uses Redis + DB)

GET
API Gateway Layer 1 - Public
GET /profiles/active
Customer Account Layer 2 - Orchestration
GET /profiles/active
Layer 3 - Sequential Service Calls
1 Caching Service
POST /api/caching/get
user:{user_id}:device:{device_id}:active_profile

Returns the stored profile_id from Redis

2 Customer User Service
GET /api/profiles/{{profile_id}}

Fetches full profile details using the cached profile_id

3-Layer Profile Selection Flow Diagram

┌─────────────────┐    ┌──────────────────┐    ┌──────────────────────┐    ┌─────────────────────────┐
│                 │    │                  │    │                      │    │                         │
│   Mobile App    │───▶│   API Gateway    │───▶│   Customer Account   │───▶│   Services (Layer 3)    │
│   / Web Client  │    │   (Layer 1)      │    │   (Layer 2)          │    │                         │
│                 │    │   PUBLIC         │    │   INTERNAL           │    │   INTERNAL              │
└─────────────────┘    └──────────────────┘    └──────────────────────┘    └─────────────────────────┘

═══════════════════════════════════════════════════════════════════════════════════════════════════════
                              SELECT PROFILE FLOW
═══════════════════════════════════════════════════════════════════════════════════════════════════════

        │  POST /profiles/select    │                        │                            │
        │  { profile_id: "xyz" }    │                        │                            │
        │  ─────────────────────────▶                        │                            │
        │                           │  POST /profiles/select │                            │
        │                           │  ──────────────────────▶                            │
        │                           │                        │  POST /api/caching/set     │
        │                           │                        │  Key: user:123:device:abc: │
        │                           │                        │       active_profile       │
        │                           │                        │  Value: "xyz"              │
        │                           │                        │  ────────────────────────────▶  [Caching Service]
        │                           │                        │                            │
        │  { success: true }        │  ◀───── Response ──────│                            │
        │  ◀────────────────────────│                        │                            │

═══════════════════════════════════════════════════════════════════════════════════════════════════════
                              GET ACTIVE PROFILE FLOW
═══════════════════════════════════════════════════════════════════════════════════════════════════════

        │  GET /profiles/active     │                        │                            │
        │  ─────────────────────────▶                        │                            │
        │                           │  GET /profiles/active  │                            │
        │                           │  ──────────────────────▶                            │
        │                           │                        │  1. POST /api/caching/get  │
        │                           │                        │     Key: user:123:device:  │
        │                           │                        │          abc:active_profile│
        │                           │                        │  ────────────────────────────▶  [Caching Service]
        │                           │                        │  ◀────── Returns: "xyz"    │
        │                           │                        │                            │
        │                           │                        │  2. GET /api/profiles/xyz  │
        │                           │                        │  ────────────────────────────▶  [Customer User Service]
        │                           │                        │  ◀────── Returns profile   │
        │                           │                        │                            │
        │  { profile: {...} }       │  ◀───── Response ──────│                            │
        │  ◀────────────────────────│                        │                            │
        

Per-Device Profile Isolation

How It Works

  • 1. Each user can have multiple profiles (like Netflix)
  • 2. Each device (identified by X-Device-Id header) can have a different active profile
  • 3. Profile selection is stored in Redis for fast access
  • 4. All subsequent requests use the active profile for personalization

Example Scenario

User "John" (user_id: 123) has 3 profiles:

  • - "John's Profile" (default)
  • - "Kids Profile"
  • - "Work Profile"

Active profiles by device:

iPhone: John's Profile
iPad: Kids Profile
Laptop: Work Profile

Architecture Summary

API Gateway

Public entry point for all profile requests. Handles routing and authentication.

Layer 1

Customer Account

Orchestrates profile operations and coordinates caching with DB operations.

Layer 2

Customer User Service

Handles profile CRUD operations and stores profile data in the database.

6 APIs

Caching Service

Redis-backed service for fast profile selection storage per user-device.

2 APIs

Orchestra Internal API Mapping - Multiple Profile Management Module

Last Updated: December 2025