There is no official API for uploading theme but to upload theme run HTTP POST request to the address https://server/ccm/_theming/save/test with putting theme file content as POST data.
Ralph Schoon selected this answer as the correct answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means.
Learn more here.