Programmatically define workflow in a repository

Is there a way to define a workflow programmatically on repository creation ?

We are using GitHub Enterprise Server 3.2.1. My aim is to standardize the steps required to set up a repository.

If all your repositories have the same starting files you could use a template repository Creating a template repository - GitHub Docs

Thanks for the reply. I am aware of template repository approach. But that would mean defining the workflow definition in two places. One in GitHub workflow templates repository and another in template repository.
We have different templates based on type of repository. So it is beneficial to have an API

Maybe try using reusable workflows Reusing workflows - GitHub Docs