For guidance, check out the docs for Programmatic Provisioning.