User migration to mastodon

Is it possible to migrate user’s from postgres to mastodon using mastodon api or using some other strategy to register mass number of user’s on our mastodon instance?
We tried registering user manually from backend but unable to generate RSA keys for ActivityPub for those user’s due to which we are unable to follow user’s from other mastodon instances.