Right now, there is no way to change project associations via the API, but it is part of our long-term plan. Currently, when a project is created through the API every person who has 'allprojects' set to true will be associated with the new project (admins have access to all projects automatically too).
If I was creating projects, and wanted to specify a particular team and needed a workaround for this, I would do the following:
Record what every person has as their "allprojects" setting.
For each project that I create, I would first set the people I wanted as team members for that project to have their "allprojects" flag set to true. All others I would set to false.
When I was finished making projects, I would revert the people's "allprojects" flags to the originals that I stored earlier.
However, for existing projects, I cannot think of any workaround.