Add api for threads