Yes you can create environments via the API - there's info on how to do this here: https://docs.flagsmith.com/clients/rest/