Please see this article for information about setting tags from the server side:
Setting tags from the server side.