To assign threads you need an API key with the following permissions:
thread:assign
thread:read
Copy
Ask AI
import { PlainClient } from '@team-plain/typescript-sdk';const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });const res = await client.assignThread({ threadId: 'th_01H8H46YPB2S4MAJM382FG9423', userId: 'u_01FSVKMHFDHJ3H5XFM20EMCBQN', // You could instead assign to a machine user by doing: // machineUserId: 'XXX'});if (res.error) { console.error(res.error);} else { console.log(`Thread assigned (${res.data.id})`);}