There is a way in the api to retrieve groups in a specific directory https://docs.atlassian.com/atlassian-crowd/4.0.0/REST/#admin/1.0/group-searchDirectoryGroups but there is nothing to add a group to a specific directory.
The customer is requesting an api to create groups in a specific directory.
This is only a potential workaround for a few directories. Large amounts would not really be feasible but you can create an individual Generic Application pointing to the Crowd base URL and only assign a single directory per application.
For example, if you had 3 user directories. You would need to create 3 new Generic Applications and assign a single unique directory to each application. That way when you authenticate the API call against Generic App01 it can only update Directory 1 that is assigned to it and no other.