There is an internal flag that is set when you click “Make public to…” in the UI. However, the API does not (and will not) expose what this flag is set to or let apps set it themselves. Visibility and access control is a complicated piece of our product, and exposing the wrong kind of information can be extremely misleading.
For example, if you see a task in the API that says the task has not been made public, and you are the only follower, you might assume that the task is private to you, but that’s not always correct. The task could have a parent task that you cannot see, and anyone who can see the parent task can see your task. The task could also have been multi-homed into a private project, and so all members of that project can see your task. This misinformation is a larger security risk than no information at all, which is why we do not expose this in the API.
If you want your app to create tasks that are visible to a particular team or workspace, I would recommend creating a public project in Asana, and then adding your tasks to that project so they inherit the project’s public visibility.