Skip to main content
POST
/
v1
/
agents
/
{agentId}
/
threads
Create a new thread for an agent
curl --request POST \
  --url https://api.devic.ai/v1/agents/{agentId}/threads \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {
      "role": "user",
      "content": "<string>",
      "name": "<string>",
      "tool_call_id": "<string>"
    }
  ],
  "metadata": {},
  "async": false
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "status": "RUNNING",
  "createdAt": "2023-11-07T05:31:56Z",
  "messages": [
    {
      "role": "user",
      "content": "<string>",
      "name": "<string>",
      "tool_call_id": "<string>"
    }
  ],
  "updatedAt": "2023-11-07T05:31:56Z",
  "metadata": {},
  "cost": 123
}

Authorizations

Authorization
string
header
required

Use JWT token for authentication

Path Parameters

agentId
string<uuid>
required

UUID of the agent for which to create the thread

Body

application/json

Payload to create a new thread

messages
object[]
required

Initial messages for the thread

metadata
object

Custom metadata to associate with the thread

async
boolean
default:false

Whether to execute the thread asynchronously

Response

Thread created successfully

id
string<uuid>
required

Unique identifier for the thread

agentId
string<uuid>
required

Unique identifier for the associated agent

status
enum<string>
required

Current status of the thread

Available options:
RUNNING,
PAUSED,
COMPLETED,
FAILED,
AWAITING_APPROVAL
createdAt
string<date-time>
required

Timestamp when the thread was created

messages
object[]
required

Messages exchanged in the thread

updatedAt
string<date-time>

Timestamp when the thread was last updated

metadata
object

Custom metadata associated with the thread

cost
number<float>

Total cost accumulated by this thread