Spaces can open or they can be invite-only. When they are open, anyone who is a member of the organization employee network can join them. You can get a list of all open spaces in an org using Get available spaces.
Spaces that are invite-only are only visible to you if you are a member of them, and you can only become a member by getting invited by an existing member. That also goes for org admins.
If you can, you should make the spaces open - then you can easily let any user join them through the API using Join space. If not, I'm afraid you will have to ask users to add you - or a user specifically for you app - to the spaces when they create them.