Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  dateLastLogin and dateWelcomeSent are absent

    Posted 10-21-2025 19:11
    Edited by Alec Grace 10-21-2025 19:13

    Has anyone else run into this issue?

    When I request user information from the Users API, all of the information is returned EXCEPT the dateLastLogin and dateWelcomeSent values. I am getting these requests both through the Python SDK and the API explorer with the same results. In the API documentation it clearly states that dateLastLogin and dateWelcomeSent should be returned.

    If I am requesting the information incorrectly or incompletely, would anyone be able to point me in the right direction?

    Documentation:

    Result through API explorer:


    #PlatformAPI
    #PlatformSDK

    ------------------------------
    Alec Grace
    ------------------------------

    *Edit - I should mention that I am able to see the missing data on the admin web portal but need it for reporting through the API



  • 2.  RE: dateLastLogin and dateWelcomeSent are absent
    Best Answer

    Posted 10-21-2025 20:40

    Hi Alec Grace,

    You could try using the expand parameter. It specifies which fields, if any, to expand.
    Note: Expand parameters are resolved with a best-effort approach and are not guaranteed to be returned. If the requested expanded information is absolutely required, it's recommended to use specific API requests instead. 

    Example: 

    In my test, I was able to get a successful response:

    GET /api/v2/users/{userId}?expand=dateLastLogin,dateWelcomeSent HTTP/1.1
    Host: api.mypurecloud.com
    Authorization: Bearer *******************
    Content-Type: application/json

    Response: 



    ------------------------------
    Luiz Rosa
    Full stack developer
    ------------------------------



  • 3.  RE: dateLastLogin and dateWelcomeSent are absent

    Posted 10-22-2025 10:55

    Hi @Luiz Rosa,

    Thank you for your quick reply! This is exactly what I was looking for, I knew I was missing something - this works. Thank you so much!



    ------------------------------
    Alec Grace
    ------------------------------



  • 4.  RE: dateLastLogin and dateWelcomeSent are absent

    Posted 10-22-2025 16:22

    Ah, unfortunately when I send the request from the Python SDK with the same expand groups as in the API Explorer request, it does not return the values. Judging from the wording of the documentation, it seems unlikely that I can rely on these parameters. 

    Would you happen to know if there exists a specific API request for last log in or date created or welcome sent?



    ------------------------------
    Alec Grace
    ------------------------------



  • 5.  RE: dateLastLogin and dateWelcomeSent are absent

    Posted 10-22-2025 18:22

    Alec,

    I ran across a similar issue using that API endpoint with the CLI.  Support recommended that I use the --expand feature with "lasttokenissued" instead of "dateLastLogin".  For us, it provides a close enough timestamp for the last login.  We don't use the welcome messages so I haven't investigated that.



    ------------------------------
    Chad Markle
    Senior Director of IT Unified Communications
    ------------------------------



  • 6.  RE: dateLastLogin and dateWelcomeSent are absent

    Posted 10-22-2025 19:02

    Hi @Alec Grace

    I have a suggestion for this case. You could try a direct HTTP call instead of the SDK. In my test, it returned dateLastLogin and dateWelcomeSent using expand. It might help confirm if the SDK is skipping those fields.

    Exemple: 

    # token
    auth = base64.b64encode(f"{CLIENT_ID}:{CLIENT_SECRET}".encode()).decode()
    tok = requests.post(
        f"{LOGIN}/oauth/token",
        headers={"Authorization": f"Basic {auth}", "Content-Type": "application/x-www-form-urlencoded"},
        data="grant_type=client_credentials"
    )
    tok.raise_for_status()
    token = tok.json()["access_token"]

    # expand
    url = f"{API}/api/v2/users/{USER_ID}?expand=dateLastLogin,dateWelcomeSent"
    r = requests.get(url, headers={"Authorization": f"Bearer {token}"})
    r.raise_for_status()
    print(json.dumps(r.json(), indent=2, ensure_ascii=False))
    Response: 
    I hope it's possible to use it. Good luck.


    ------------------------------
    Luiz Rosa
    Full stack developer
    ------------------------------



  • 7.  RE: dateLastLogin and dateWelcomeSent are absent

    Posted 10-23-2025 03:01

    Hello,

    I tried it with the Python SDK, using a recent version of the SDK, and it is working for me (for a user who has this info shown in API Explorer for the same request/expand). I used something like:

        api_client = PureCloudPlatformClientV2.api_client.ApiClient()
        api_client.get_client_credentials_token(CLIENT_ID, CLIENT_SECRET)
        print(f"Login Response")
    
        api_instance = PureCloudPlatformClientV2.UsersApi(api_client)
    
        user_id='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
        expand = ['dateLastLogin', 'dateWelcomeSent']
    
        api_response = api_instance.get_user(user_id, expand=expand)
    
        if api_response.date_last_login != None:
            print(f"Success - user last login date is { api_response.date_last_login }")
        else:
            print(f"Success - user last login date is unknown")
    
        if api_response.date_welcome_sent != None:
            print(f"Success - user welcome sent date is { api_response.date_welcome_sent }")
        else:
            print(f"Success - user welcome sent date is unknown")

    Regards,



    ------------------------------
    Jerome Saint-Marc
    Senior Development Support Engineer
    ------------------------------