Agents
Create and manage AI agents within your workspace.
GET
/api/agentsJWTList Agents
Retrieve all agents in the current workspace.
Headers
| Header | Value |
|---|---|
| X-Workspace-ID | your-workspace-id |
Response
json
{
"data": [
{
"id": "uuid",
"name": "Support Bot",
"system_prompt": "You are a helpful...",
"model": "gpt-4o-mini",
"workspace_id": "uuid",
"created_at": "2024-01-01T00:00:00Z"
}
]
}POST
/api/agentsJWTCreate Agent
Create a new AI agent. Requires owner or admin role.
Headers
| Header | Value |
|---|---|
| X-Workspace-ID | your-workspace-id |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Agent name |
| system_prompt | string | Required | System prompt / instructions |
| model | string | Optional | AI model (default: gpt-4o-mini) |
| welcome_message | string | Optional | Initial greeting message |
Response
json
{
"data": {
"id": "uuid",
"name": "Support Bot",
"system_prompt": "You are a helpful...",
"model": "gpt-4o-mini"
},
"message": "Agent created successfully"
}GET
/api/agents/:idJWTGet Agent
Retrieve a single agent by ID.
Headers
| Header | Value |
|---|---|
| X-Workspace-ID | your-workspace-id |
URL Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Required | Agent ID (UUID) |
Response
json
{
"data": {
"id": "uuid",
"name": "Support Bot",
"system_prompt": "...",
"model": "gpt-4o-mini",
"welcome_message": "Hi! How can I help?",
"widget_color": "#6c5ce7",
"allowed_origins": ["https://example.com"],
"created_at": "2024-01-01T00:00:00Z"
}
}PUT
/api/agents/:idJWTUpdate Agent
Update an existing agent. Requires owner or admin role.
Headers
| Header | Value |
|---|---|
| X-Workspace-ID | your-workspace-id |
URL Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Required | Agent ID |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Optional | Agent name |
| system_prompt | string | Optional | System prompt |
| model | string | Optional | AI model |
Response
json
{
"data": { "id": "uuid", "name": "Updated Bot" },
"message": "Agent updated successfully"
}DELETE
/api/agents/:idJWTDelete Agent
Delete an agent and all its data. Requires owner or admin role.
Headers
| Header | Value |
|---|---|
| X-Workspace-ID | your-workspace-id |
URL Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Required | Agent ID |
Response
json
{
"message": "Agent deleted successfully"
}