To provide developers and administrators with more fine-grained control, the Google Apps Admin SDK now includes new domain management features. These new APIs let you programmatically manage domains for your Google Apps account, similar to other RESTful resources like Users, Groups, etc., providing a superset of the domain management capabilities available on the Domains page in the admin console today.
Change your primary domain
The Customers API gives enterprise developers and administrators the ability to swap the current primary domain with a selected secondary domain for a Google Apps installation. The “change primary” operation is essentially transparent to the user, but users moved to the secondary domain will be subject to certain restrictions (refer to Help Center article for details). Customers who want to rebrand their business with a new primary domain can follow this up by renaming users from the old (now secondary) to the new (now primary) domain using the Users API.
Add and remove domains & aliases
The Domains API lets developers create tools for administrators to add and remove domains, similar to the functionality available on the Domains page in the admin console. In addition, the API lets you programmatically add aliases for any domain, primary or secondary, but aliases for secondary domain can only be added via the API.