Can I call metamask to add custom RPC network by program?

Hi, I am a newbie developer and I am working with the help of Metamask Wallet.

I have tried using custom RPC network by adding it in Metamask → Setting → Network and It is working.
My question is how can I call Metamask to add a network through coding (window.etherum)? Seems I cannot find this information on Metamask Documentation.

Thanks for any help.

Hi @k9metamask thanks for reaching out.

I’d recommend referring to Introduction | MetaMask Docs in particular: Provider Migration Guide | MetaMask Docs please let us know if you have any questions and if you are still facing an issue.

Thanks,
Kind regards,