Bulk add self-registered-users and issue passwordreset

I need to bulk add ~900 users to UCS as self registered users. I know their names, uids and email.
I do not want to set a password and instead let UCS send an invitation via email (which works when adding users by hand).

udm users/user create \
    --set position="cn=self registered users,$ldap_base" \
    --set lastname="Doe" --set username="jdoe" \
    --set password="_to_be_reset_"
    --set PasswordRecoveryEmail="john@doe.com"

can create normal users, but users created in this way can not see the selfservice portal. Instead they see “Keine Suchergebnisse” (german localization, prb “No search results” in EN).

How can I add these users so that they can use the selfservice portal and send an invitation email to each of them?

After spending a few more hours on this and finding out which http requests are sent by the self-service portal, this is a working solution (script in whatever way for the dataset you have):

  1. Add the user with udm (I was not able to find good documentation about how to do this with the python API, though that must certainly be possible as well):
# !/usr/bin/bash
eval $(ucr shell)
udm users/user create \
    --position="cn=self registered users,$ldap_base" \
    --set lastname="Doe" --set username="jdoe" \
    --set password="12345678" \
    --set overridePWHistory="1" \
    --set overridePWLength="1" \
    --set PasswordRecoveryEmail="john@doe.com"
  1. “Replay” the HTTP POST made by the self service portal when the user issues a password reset. I assume you run this on the domain master - update the FQDN/IP if required).
# !/usr/bin/python
import requests
r = requests.post(
    json={"options": {"username": "jdoe", "method": "email"}})

I wish we could do this easily within the python API, but I could not figure out how to do this.
Hope this helps someone out there.