Threads
Threads represent collections of messages exchanged between various actors and agents.
Thread object
Attributes
id
StringA unique identifier for the thread, used to reference it across the system.
agent_id
StringThe unique identifier for the agent associated with the thread.
instance_id
StringThe unique identifier for the instance within which the thread exists.
timezone
ObjectThe timezone information for the thread, useful for contextualizing timestamps.
country
ObjectInformation about the country associated with the thread.
language
ObjectInformation about the language used in the thread.
metadata
ObjectAdditional metadata for the thread, which can be custom-defined.
participants
Array of ObjectsAn array of participants involved in the thread, including users, assistants, or tools.
created_at
DateThe timestamp when the thread was created.
updated_at
DateThe timestamp of the last update to the thread.
{"id": "thread_Rm4Mnheq2bfEPhBhP7SY","agent_id": "agent_Rm4Mnheq2bfEPhBhP7SY","instance_id": "instance_Rm4Mnheq2bfEPhBhP7SY","timezone": {"code": "America/New_York","utc": "-05:00","utc_offset_in_minutes": -300},"country": {"code": "US"},"language": {"code": "en"},"metadata": {},"participants": [{"id": "act_Rm4Mnheq2bfEPhBhP7SY","name": "John Doe","type": "user","metadata": {"email": "[email protected]","other": "Additional metadata can be included here."},"created_at": "2025-01-01T00:00:00.000Z","updated_at": "2025-01-01T00:00:00.000Z","role": "read_write","joined_at": "2025-01-01T00:00:00.000Z","thread_id": "thread_Rm4Mnheq2bfEPhBhP7SY"}],"created_at": "2025-01-01T00:00:00.000Z","updated_at": "2025-01-01T00:00:00.000Z"}
List threads
Retrieve a list of all threads in the system.
Query Parameters
id
ObjectOptionalFilter threads by their unique identifiers.
created_at
ObjectOptionalFilter threads by their creation date.
updated_at
ObjectOptionalFilter threads by their last update date.
curl -X GET https://api.metorial.com/threads \-H "Authorization: Bearer metorial_sk_..."
Get thread
Retrieve details of a specific thread by its unique ID.
URL Parameters
threadId
StringThe unique identifier for a thread.
curl -X GET "https://api.metorial.com/v1/threads/thread_Rm4Mnheq2bfEPhBhP7SY" \-H "Authorization: Bearer metorial_sk_..."
Create thread
Create a new thread and associate it with an agent.
Request Body
language
StringOptionalThe language of the messages within the thread.
country
StringOptionalThe country associated with the thread.
timezone
StringOptionalThe timezone for the thread.
metadata
ObjectOptionalCustom metadata for the thread.
actor_id
StringOptionalThe unique identifier of the actor initiating the thread.
agent_id
StringThe agent with which the thread is associated.
curl -X POST "https://api.metorial.com/v1/threads" \-H "Authorization: Bearer metorial_sk_..." \-d '{"agent_id": "agent_Rm4Mnheq2bfEPhBhP7SY","actor_id": "actor_q2bfShBRmEPnhehP74MY","language": "en","country": "US","timezone": "America/New_York"}'
Update thread
Update details of an existing thread by its unique ID.
URL Parameters
threadId
StringThe unique identifier for a thread.
Request Body
metadata
ObjectOptionalAdditional metadata to update for the thread.
curl -X PUT "https://api.metorial.com/v1/threads/thread_Rm4Mnheq2bfEPhBhP7SY" \-H "Authorization: Bearer metorial_sk_..." \-d '{"metadata": {"other": "Additional metadata"}}'
Delete thread
Delete a thread by its unique ID.
URL Parameters
threadId
StringThe unique identifier for a thread.
curl -X DELETE "https://api.metorial.com/v1/threads/thread_Rm4Mnheq2bfEPhBhP7SY" \-H "Authorization: Bearer $$SECRET"