Genesys Cloud - Developer Announcements!

 View Only

Sign Up

Javascript SDK - Support for Per-Request Custom Headers

  • 1.  Javascript SDK - Support for Per-Request Custom Headers

    Posted 10 hours ago

    Summary

    The Platform API SDK for Javascript/Typescript will provide the ability to set custom headers on a per-request basis.

    This enhancement is meant to provide more flexibility in the SDK, allowing to control custom HTTP Headers on a per-request basis. The ability to set custom headers was only provided at the ApiClient level, defining default headers applicable to all future API requests.

    Each of the SDK API method now includes an "opts" parameter (optional - object/map structure) - i.e. even the methods which didn't have an "opts" optional parameter.

    Within this structure, you can set a “customHeaders” property (also optional), which is a string map (Record<string, string>) - with the custom HTTP headers and values you want to send along with the API request.

    const usersApi = new platformClient.UsersApi();
    
    let opts = {
    
        'customHeaders': {  // Object.<string, string> | Request Custom Headers
    
            'X-My-Service': 'my-service',
    
            'X-MyRequest-ID': 'myreq-12345'
    
        }
    
    }
    
    let userId = 'xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx';
    
    return usersApi.getUser(userId, opts);

    This enhancement is introduced as a non-breaking change - even in typescript projects,as the opts parameter is optional and its customHeaders property is also optional.

    This change will apply to new versions of the Platform API SDK for JavaScript released on and after Wednesday, March 25, 2026.

    No impact. This is a non-breaking change.

    Effective Date

    Wednesday, March 25, 2026

    Issue References

    DEVTOOLING-1564

    Contacts

    @Jerome Saint-Marc  

    Please reply to this announcement with any questions. This helps the wider developer community benefit from the discussion. We encourage you to use this thread before contacting the designated person directly. Thank you for your understanding.