Gurinder Singh Greetings & Welcome to Microsoft Q&A forum!
I wanted to know is there any way to use import graph and export graph buttons of Azure digital twin explorer through API and programming?
I understand that, you are looking for suggestions to import Azure Digital Twins Graph using SDK or API.
This feedback has already been shared here and our team is working on this feature but no timeline for it.
Currently there is no built-in way to achieve this. Import is the only programmatic bulk operation available today. Please see az dt job import for more details.
You can use the Jobs API to upload multiple models, twins, and relationships to your instance in a single API call, effectively creating the graph all at once.
Also, see Azure Digital Twins APIs and SDKs for more details.
Do let me know if you have any further queries.