MENU navbar-image
MENU navbar-image

PromptlyAgent Documentation

PromptlyAgent is an AI Workbench built for developers and end-users alike. It allows everyone to harness the power of multi-agent orchestration, RAG (Retrieval-Augmented Generation) and more at ease.


What is PromptlyAgent?

PromptlyAgent is a comprehensive Laravel-based AI Workbench that enables you to:

Built on the TALL stack (Tailwind, Alpine.js, Laravel, Livewire), PromptlyAgent provides both a web interface for users and a comprehensive REST API for developers.

Key Features

Multi-Agent System

Create and manage AI agents with different specializations:

Each agent can be equipped with tools (web search, calculators, file operations, etc.) and configured with specific AI models (OpenAI GPT, Anthropic Claude, AWS Bedrock). Agents can be created and configured via code, through the web interface or through a "Agent generation Agent" (yes, that's meta).

Agent tools

Core suite of over 30 tools that can extend AI capabilities.

Developers can easily extend the already broad set of core tools through integrations.

Workflow Orchestration

Execute complex multi-agent workflows with four execution strategies:

Utilizing Laravel's batch processing powerful agentic workflows can be created. This can happen through custom code such as our DailyDigestCommand or automatically through our "Deeply Agent" that will take a user's prompt and translate it into an agentic workflow utilizing multiple agents.

Knowledge Management (RAG)

Build intelligent knowledge bases with:

The built-in Knowledge management system is extendable and allows for semantic search and dynamic assignments of knowledge to specific agents through either the web interface or via code.

Real-Time Chat & Streaming

Interactive conversational AI with:

PWA (Progressive Web App) for mobile

Access core functionality through a PWA on iOS/Android.

Powerful APIs and integration abilities

Quick Start

1. Clone and navigate

git clone https://github.com/promptlyagentai/promptlyagent.git
cd promptlyagent

2. Configure environment

cp .env.example .env

Edit .env and set:

3. Install Composer dependencies (first-time setup)

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html:z" \
    -w /var/www/html \
    laravelsail/php84-composer:latest \
    composer install --ignore-platform-reqs --no-scripts

4. Start Docker containers

./vendor/bin/sail up -d

Note: Initial build takes 10-15 minutes. Subsequent starts are faster.

5. Complete Composer setup

./vendor/bin/sail composer install

6. Install npm dependencies

./vendor/bin/sail npm install

7. Initialize application

./vendor/bin/sail artisan key:generate
./vendor/bin/sail artisan migrate

8. Create admin user

./vendor/bin/sail artisan make:admin

9. Seed database (creates default agents)

./vendor/bin/sail artisan db:seed

10. Build frontend

./vendor/bin/sail npm run build

Alternative for development with hot reload:

./vendor/bin/sail npm run dev

11. Access the application

📚 Need help? See the Complete Installation Guide for troubleshooting, advanced configuration, and detailed explanations.

Architecture

Technology Stack: Laravel 12, PHP 8.4, Livewire 3, Volt, Flux UI (Free), Tailwind 4, Prism-PHP, Meilisearch, Horizon, Reverb

PromptlyAgent uses a modular architecture with multi-container Docker infrastructure, load-balanced services, and queue-based background processing.

📚 Learn More: See the Architecture Guide for detailed system design, component diagrams, and infrastructure details.

📚 For complete technology stack details: See the Introduction Guide

Use Cases

Research & Analysis

Knowledge Management

Content Creation

Integration & Automation

Getting Help

Interactive Support Widget

PromptlyAgent includes an AI-powered support widget with deep codebase integration:

Look for the support widget in the bottom-right corner of the application interface. It's designed to help you understand the codebase, troubleshoot issues, and get unstuck quickly.

Developer Documentation

Comprehensive guides for developing with PromptlyAgent:

📚 Learning Paths:

New User Path (Start Here):

  1. Getting Started - Installation and setup
  2. Introduction - Core concepts (agents, RAG, workflows)
  3. Development Guide - Day-to-day workflow

Package Developer Path:

  1. Getting Started - Installation
  2. Package Development - Build custom integrations
  3. Architecture - Understanding the system

Architect Path:

  1. Introduction - Core concepts
  2. Architecture - Deep dive into system design
  3. Workflows - Multi-agent orchestration

All Guides:

License

PromptlyAgent is available under a dual-licensing model:

Personal/non-commercial use includes hobby projects, academic research, and internal use within non-profit organizations that doesn't generate revenue.

Commercial use includes any for-profit entity, revenue-generating applications, production business operations, or services offered for a fee.

See the LICENSE file for complete terms and definitions. For commercial licensing inquiries, contact [email protected].

All third-party dependencies and their licenses, including containerized services (Pandoc, SearXNG, MarkItDown, MermaidJS), are documented in THIRD_PARTY_NOTICES.md.

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your API key from your dashboard at Settings > API Tokens.

Create artifact from chat interaction (API endpoint for PWA)

requires authentication

Example request:

Request   

POST api/v1/artifacts

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

chat_interaction_id   string     

The id of an existing record in the chat_interactions table. Example: est

chat_session_id   string     

The id of an existing record in the chat_sessions table. Example: dolor

content   string     

Example: provident

title   string     

Must not be greater than 255 characters. Example: trruxqcx

filetype   string     

Must not be greater than 50 characters. Example: evejejq

privacy_level   string     

Example: private

Must be one of:
  • private
  • public

Update artifact metadata and content

requires authentication

Example request:

Request   

PUT api/v1/artifacts/{id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The ID of the artifact. Example: 1

Body Parameters

title   string  optional    

Must not be greater than 255 characters. Example: podsedlfknpif

description   string  optional    

Example: Vitae enim natus consequuntur voluptatem vel fugit.

content   string  optional    

Example: non

privacy_level   string  optional    

Example: private

Must be one of:
  • private
  • public
filetype   string  optional    

Must not be greater than 50 characters. Example: juhdibbkcdkobdatbrpa

Queue async conversion of artifact (API endpoint)

requires authentication

Example request:

Request   

POST api/v1/artifacts/{artifact_id}/convert

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

artifact_id   integer     

The ID of the artifact. Example: 1

Body Parameters

output_format   string     

Example: latex

Must be one of:
  • pdf
  • docx
  • odt
  • latex
template   string  optional    

Example: academic

Must be one of:
  • eisvogel
  • elegant
  • academic

Show artifact details (API endpoint)

requires authentication

Example request:

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "success": false,
    "error": "UNAUTHENTICATED",
    "message": "Authentication required.",
    "timestamp": "2026-02-10T11:16:48+00:00"
}
 

Request   

GET api/v1/artifacts/{id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The ID of the artifact. Example: 1

Get conversions for an artifact (API endpoint for PWA)

requires authentication

Example request:

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "success": false,
    "error": "UNAUTHENTICATED",
    "message": "Authentication required.",
    "timestamp": "2026-02-10T11:16:48+00:00"
}
 

Request   

GET api/v1/artifacts/{artifact_id}/conversions

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

artifact_id   integer     

The ID of the artifact. Example: 1

Download conversion via API (uses signed URLs)

requires authentication

This endpoint uses signed URLs for secure, time-limited access. The 'signed' middleware validates the URL signature, ensuring the URL was generated by our server and hasn't expired.

Example request:

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 300
x-ratelimit-remaining: 298
vary: Origin
 

{
    "success": false,
    "error": "NOT_FOUND",
    "message": "The requested resource was not found.",
    "timestamp": "2026-02-10T11:16:48+00:00"
}
 

Request   

GET api/v1/artifacts/{artifact_id}/conversions/{conversion_id}/download

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

artifact_id   integer     

The ID of the artifact. Example: 1

conversion_id   integer     

The ID of the conversion. Example: 8

Get conversion status (for polling)

requires authentication

Example request:

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "success": false,
    "error": "UNAUTHENTICATED",
    "message": "Authentication required.",
    "timestamp": "2026-02-10T11:16:48+00:00"
}
 

Request   

GET api/v1/conversions/{conversion_id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

conversion_id   integer     

The ID of the conversion. Example: 16

Agents & Tools

API endpoints for managing and querying AI agents and their configurations. All endpoints require authentication and the agent:view token ability.

List available agents

requires authentication

Returns all agents available to the authenticated user, including public agents and user-created agents. Only active agents are returned.

Example Usage

Ulauncher Extension (github.com/promptlyagentai/ulauncher-promptlyagent) - Desktop AI integration:

Example request:

Example response (200, Success):


{
    "success": true,
    "agents": [
        {
            "id": 1,
            "name": "Direct Chat Agent",
            "description": "General purpose conversational agent",
            "agent_type": "chat",
            "ai_provider": "openai",
            "ai_model": "gpt-4",
            "is_active": true,
            "max_steps": 10,
            "tool_count": 5,
            "created_at": "2024-01-01T00:00:00.000000Z"
        }
    ]
}
 

Example response (403, Insufficient permissions):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the agent:view ability"
}
 

Request   

GET api/v1/agents

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Get agent details

requires authentication

Returns detailed information about a specific agent, including its configuration, system prompt, and enabled tools.

Example Usage

PWA (resources/js/pwa/agent-api.js) - Agent details with caching:

Example request:

Example response (200, Success):


{
    "success": true,
    "agent": {
        "id": 1,
        "name": "Direct Chat Agent",
        "description": "General purpose conversational agent",
        "agent_type": "chat",
        "ai_provider": "openai",
        "ai_model": "gpt-4",
        "is_active": true,
        "max_steps": 10,
        "system_prompt": "You are a helpful AI assistant...",
        "tools": [
            "web_search",
            "calculator",
            "file_read"
        ],
        "created_at": "2024-01-01T00:00:00.000000Z",
        "updated_at": "2024-01-01T00:00:00.000000Z"
    }
}
 

Example response (404, Agent not found):


{
    "success": false,
    "error": "Not Found",
    "message": "Agent not found"
}
 

Request   

GET api/v1/agents/{id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The agent ID. Example: 1

List tools enabled for a specific agent

requires authentication

Retrieve all tools currently assigned to a specific agent. Only tools that have been explicitly enabled for the agent are returned.

Example request:

Example response (200, Success):


{
    "success": true,
    "agent_id": 5,
    "agent_name": "Research Agent",
    "tools": [
        {
            "name": "web_search",
            "description": "Search the web using SearXNG meta-search engine",
            "category": "research",
            "enabled": true
        },
        {
            "name": "search_knowledge",
            "description": "Query the knowledge base with semantic search",
            "category": "research",
            "enabled": true
        }
    ],
    "total": 2
}
 

Example response (403, Missing tools:view ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the tools:view ability"
}
 

Example response (403, Missing agent:view ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the agent:view ability required to access agent tools"
}
 

Example response (404, Agent Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "Agent not found"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while retrieving agent tools"
}
 

Request   

GET api/v1/agents/{id}/tools

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The ID of the agent. Example: 1

agentId   integer     

The agent ID. Example: 5

Response

Response Fields

success   boolean     

Indicates if the request was successful

agent_id   integer     

The agent ID

agent_name   string     

The agent name

tools   string[]     

Array of tools enabled for this agent

name   string     

Tool identifier

description   string     

Tool description

category   string     

Tool category (research, file, calculation, integration, general)

enabled   boolean     

Always true for this endpoint (indicates tool is enabled for agent)

total   integer     

Number of tools enabled for this agent

List all available tools

requires authentication

Retrieve all tools registered in the ToolRegistry with their descriptions, categories, and authentication requirements. These are the tools that can be assigned to agents.

Example request:

Example response (200, Success):


{
    "success": true,
    "tools": [
        {
            "name": "web_search",
            "description": "Search the web using SearXNG meta-search engine",
            "category": "research",
            "requires_auth": false
        },
        {
            "name": "search_knowledge",
            "description": "Query the knowledge base with semantic search",
            "category": "research",
            "requires_auth": false
        },
        {
            "name": "calculator",
            "description": "Perform mathematical calculations",
            "category": "calculation",
            "requires_auth": false
        }
    ],
    "total": 15
}
 

Example response (403, Missing tools:view ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the tools:view ability"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while retrieving tools"
}
 

Request   

GET api/v1/tools

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Response

Response Fields

success   boolean     

Indicates if the request was successful

tools   string[]     

Array of available tools

name   string     

Tool identifier (used when assigning to agents)

description   string     

Human-readable description of tool functionality

category   string     

Tool category (research, file, calculation, integration, general)

requires_auth   boolean     

Whether tool requires user authentication to external services

total   integer     

Total number of available tools

Chat & Streaming

Direct chat API endpoints with real-time SSE streaming support. Integrate conversational AI into your applications without webhook triggers.

Features

Required Token Abilities

Rate Limiting

Stream a chat message with real-time SSE responses

requires authentication

Sends a message to an AI agent and streams the response in real-time using Server-Sent Events (SSE). Supports multi-turn conversations, file attachments, and automatic session management.

The stream returns various event types (message, tool_call, source, artifact, heartbeat, complete, error) with JSON-encoded data payloads. Connections are kept alive with periodic heartbeats and protected against timeouts.

Example Usage

Support Widget (github.com/promptlyagentai/support-widget) - AI-powered support chat:

Ulauncher Extension (github.com/promptlyagentai/ulauncher-promptlyagent) - Desktop AI assistant:

Example request:

Example response (200, SSE Stream):


event: message
data: {"type": "text", "content": "Here are the best practices for Laravel routing...", "delta": true}

event: tool_call
data: {"tool": "search_knowledge", "arguments": {"query": "routing best practices"}}

event: source
data: {"title": "Laravel Docs - Routing", "url": "https://laravel.com/docs/routing", "domain": "laravel.com"}

event: artifact
data: {"type": "code", "language": "php", "content": "Route::get('/user', [UserController::class, 'index']);"}

event: heartbeat
data: {"timestamp": 1704067200}

event: complete
data: {"status": "completed", "duration_seconds": 12}
 

Example response (400, Agent Inactive):


{
    "success": false,
    "error": "Agent Inactive",
    "message": "This agent is not currently active."
}
 

Example response (403, Missing chat:create ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the chat:create ability"
}
 

Example response (404, Resource Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "The specified resource was not found"
}
 

Example response (422, File Validation Failed):


{
    "success": false,
    "error": "File Validation Failed",
    "message": "File type not allowed: executable"
}
 

Example response (500, Agent Not Found):


{
    "success": false,
    "error": "Agent Not Found",
    "message": "Direct Chat Agent not found. Please run database seeder."
}
 

Request   

POST api/v1/chat/stream

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

message   string     

The chat message content. Maximum 10,000 characters. Example: What are Laravel best practices for routing and middleware?

session_id   integer  optional    

Optional session ID to continue an existing conversation. If not provided, creates a new session. Example: 123

agent_id   integer  optional    

Optional agent ID to use for this message. If not provided, uses the default Direct Chat Agent. Example: 5

attachments   file[]  optional    

Optional file attachments (requires agent:attach token ability). Maximum 10 files, 50MB each. Supported: documents, images, code files.

Response

Response Fields

event   string     

The SSE event type (message, tool_call, source, artifact, heartbeat, complete, error)

data   string     

JSON-encoded event data. Structure varies by event type.

Send a chat message (non-streaming)

requires authentication

Non-streaming chat endpoint for sending messages and receiving complete responses. Currently not implemented - use the /api/v1/chat/stream endpoint instead for all chat operations.

Example request:

Example response (501, Not Implemented):


{
    "success": false,
    "error": "Not Implemented",
    "message": "Non-streaming chat endpoint not yet implemented. Please use /api/v1/chat/stream instead."
}
 

Request   

POST api/v1/chat

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

message   string     

The chat message content. Maximum 10,000 characters. Example: Explain dependency injection in Laravel

session_id   integer  optional    

Optional session ID to continue an existing conversation. Example: 123

agent_id   integer  optional    

Optional agent ID to use for this message. Example: 5

attachments   file[]  optional    

Optional file attachments (requires agent:attach token ability).

Toggle keep flag on a session

requires authentication

Mark a session as "kept" to protect it from automatic deletion, or remove the keep flag. Kept sessions are excluded from cleanup routines and remain permanently until manually deleted.

Example Usage

PWA (resources/js/pwa/session-api.js) - Session management:

Example request:

Example response (200, Success):


{
    "success": true,
    "session": {
        "id": 123,
        "is_kept": true
    }
}
 

Example response (403, Missing chat:manage ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the chat:manage ability"
}
 

Example response (403, Not Session Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to modify this session"
}
 

Example response (404, Session Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "Chat session not found"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while updating the session"
}
 

Request   

POST api/v1/chat/sessions/{id}/keep

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The session ID. Example: 123

Response

Response Fields

success   boolean     

Indicates if the request was successful

session   object     

Updated session details

id   integer     

Session ID

is_kept   boolean     

New kept status (toggled)

Archive a chat session

requires authentication

Move a session to the archive. Archived sessions are hidden from the default session list and can be restored later. Cannot archive sessions marked as kept.

Example Usage

PWA (resources/js/pwa/session-api.js) - Session organization:

Example request:

Example response (200, Success):


{
    "success": true,
    "session": {
        "id": 123,
        "is_archived": true,
        "archived_at": "2024-01-01T12:00:00Z"
    }
}
 

Example response (403, Missing chat:manage ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the chat:manage ability"
}
 

Example response (403, Not Session Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to modify this session"
}
 

Example response (404, Session Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "Chat session not found"
}
 

Example response (422, Cannot Archive Kept Session):


{
    "success": false,
    "error": "Cannot Archive Kept Session",
    "message": "Cannot archive a session marked as kept. Remove the keep flag first."
}
 

Example response (422, Already Archived):


{
    "success": false,
    "error": "Already Archived",
    "message": "This session is already archived"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while archiving the session"
}
 

Request   

POST api/v1/chat/sessions/{id}/archive

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The session ID. Example: 123

Response

Response Fields

success   boolean     

Indicates if the request was successful

session   object     

Updated session details

id   integer     

Session ID

is_archived   boolean     

Archive status (true)

archived_at   string     

Archive timestamp (ISO 8601)

Unarchive a chat session

requires authentication

Restore an archived session back to the active session list.

Example request:

Example response (200, Success):


{
    "success": true,
    "session": {
        "id": 123,
        "is_archived": false,
        "archived_at": null
    }
}
 

Example response (403, Missing chat:manage ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the chat:manage ability"
}
 

Example response (403, Not Session Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to modify this session"
}
 

Example response (404, Session Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "Chat session not found"
}
 

Example response (422, Not Archived):


{
    "success": false,
    "error": "Not Archived",
    "message": "This session is not archived"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while unarchiving the session"
}
 

Request   

POST api/v1/chat/sessions/{id}/unarchive

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The session ID. Example: 123

Response

Response Fields

success   boolean     

Indicates if the request was successful

session   object     

Updated session details

id   integer     

Session ID

is_archived   boolean     

Archive status (false)

archived_at        

null Always null after unarchiving

Share a chat session publicly

requires authentication

Make a session publicly accessible via a unique URL. Optionally set an expiration period after which the public link will no longer work. Public sessions can be viewed by anyone with the link without authentication.

Example Usage

PWA (resources/js/pwa/session-api.js) - Public sharing:

Example request:

Example response (200, Success):


{
    "success": true,
    "session": {
        "id": 123,
        "uuid": "550e8400-e29b-41d4-a716-446655440000",
        "is_public": true,
        "public_url": "https://promptlyagent.com/share/550e8400-e29b-41d4-a716-446655440000",
        "public_shared_at": "2024-01-01T12:00:00Z",
        "public_expires_at": "2024-01-31T12:00:00Z"
    }
}
 

Example response (403, Missing chat:manage ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the chat:manage ability"
}
 

Example response (403, Not Session Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to modify this session"
}
 

Example response (404, Session Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "Chat session not found"
}
 

Example response (422, Already Public):


{
    "success": false,
    "error": "Already Public",
    "message": "This session is already publicly shared"
}
 

Example response (422, Invalid Expiration):


{
    "success": false,
    "error": "Validation Failed",
    "message": "Invalid request parameters",
    "errors": {
        "expires_in_days": [
            "The expires in days must be between 1 and 365."
        ]
    }
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while sharing the session"
}
 

Request   

POST api/v1/chat/sessions/{id}/share

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The session ID. Example: 123

Body Parameters

expires_in_days   integer  optional    

Optional expiration period in days (1-365). If not provided, link never expires. Example: 30

Response

Response Fields

success   boolean     

Indicates if the request was successful

session   object     

Updated session details

id   integer     

Session ID

uuid   string     

Unique session identifier used in public URL

is_public   boolean     

Public sharing status (true)

public_url   string     

Full public URL for viewing the session

public_shared_at   string     

Timestamp when session was made public (ISO 8601)

public_expires_at   string     

Expiration timestamp (ISO 8601) or null if no expiration

Unshare a chat session (make private)

requires authentication

Remove public access from a session. The public URL will no longer work and the session will only be accessible to the owner when authenticated.

Example request:

Example response (200, Success):


{
    "success": true,
    "session": {
        "id": 123,
        "is_public": false,
        "public_shared_at": null,
        "public_expires_at": null
    }
}
 

Example response (403, Missing chat:manage ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the chat:manage ability"
}
 

Example response (403, Not Session Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to modify this session"
}
 

Example response (404, Session Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "Chat session not found"
}
 

Example response (422, Not Public):


{
    "success": false,
    "error": "Not Public",
    "message": "This session is not publicly shared"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while unsharing the session"
}
 

Request   

POST api/v1/chat/sessions/{id}/unshare

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The session ID. Example: 123

Response

Response Fields

success   boolean     

Indicates if the request was successful

session   object     

Updated session details

id   integer     

Session ID

is_public   boolean     

Public sharing status (false)

public_shared_at        

null Always null after unsharing

public_expires_at        

null Always null after unsharing

Delete a chat session

requires authentication

Permanently delete a session and all associated interactions, attachments, and artifacts. This action cannot be undone. Only the session owner can delete their sessions.

Example Usage

PWA (resources/js/pwa/session-api.js) - Session deletion:

Example request:

Example response (200, Success):


{
    "success": true,
    "message": "Session deleted successfully"
}
 

Example response (403, Missing chat:delete ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the chat:delete ability"
}
 

Example response (403, Not Session Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to delete this session"
}
 

Example response (404, Session Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "Chat session not found"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while deleting the session"
}
 

Request   

DELETE api/v1/chat/sessions/{id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The session ID. Example: 123

Response

Response Fields

success   boolean     

Indicates if the request was successful

message   string     

Confirmation message

List all chat sessions

requires authentication

Retrieve all chat sessions for the authenticated user with optional filtering and search. Supports filtering by source type, archive status, kept status, and full-text search across session titles and interaction content.

Example Usage

PWA (resources/js/pwa/session-api.js) - Session history and management:

Example request:

Example response (200, Success):


{
    "success": true,
    "sessions": [
        {
            "id": 123,
            "name": "API Chat Session",
            "title": "Discussion about Laravel",
            "uuid": "550e8400-e29b-41d4-a716-446655440000",
            "is_public": false,
            "source_type": "api",
            "is_kept": false,
            "is_archived": false,
            "archived_at": null,
            "interactions_count": 5,
            "attachments_count": 2,
            "artifacts_count": 1,
            "sources_count": 3,
            "created_at": "2024-01-01T00:00:00Z",
            "updated_at": "2024-01-01T00:15:00Z"
        }
    ],
    "filters": {
        "source_type": "all",
        "include_archived": false,
        "kept_only": false,
        "limit": 50
    }
}
 

Example response (403, Missing chat:view ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the chat:view ability"
}
 

Example response (422, Invalid Parameters):


{
    "success": false,
    "error": "Validation Failed",
    "message": "Invalid query parameters",
    "errors": {
        "per_page": [
            "The per page must be between 1 and 50."
        ]
    }
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while retrieving sessions"
}
 

Request   

GET api/v1/chat/sessions

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

search   string  optional    

Optional search query for session titles and interaction content. Maximum 200 characters. Example: Laravel routing

source_type   string  optional    

Optional filter by session source. Options: web, api, webhook, slack, trigger, all. Defaults to all. Example: api

include_archived   boolean  optional    

Optional include archived sessions in results. Defaults to false. Example: false

kept_only   boolean  optional    

Optional show only sessions marked as kept. Defaults to false. Example: true

page   integer  optional    

Optional page number for pagination. Minimum 1. Example: 1

per_page   integer  optional    

Optional items per page (1-50). Defaults to 50. Example: 20

Response

Response Fields

success   boolean     

Indicates if the request was successful

sessions   string[]     

Array of chat sessions

id   integer     

Session ID

name   string     

Session name

title   string     

Session title (auto-generated)

uuid   string     

Unique session identifier

is_public   boolean     

Public sharing status

source_type   string     

Source type (web, api, webhook, slack, trigger)

is_kept   boolean     

Whether session is marked as kept (protected from auto-deletion)

is_archived   boolean     

Archive status

archived_at   string     

Archive timestamp (ISO 8601) or null

interactions_count   integer     

Number of interactions in session

attachments_count   integer     

Number of file attachments

artifacts_count   integer     

Number of generated artifacts (code, documents)

sources_count   integer     

Number of knowledge sources referenced

created_at   string     

Creation timestamp (ISO 8601)

updated_at   string     

Last update timestamp (ISO 8601)

filters   object     

Applied filters for this request

View a chat session

requires authentication

Retrieve a single chat session with all interactions, messages, and sources. Returns the complete conversation history with nested source attributions from the knowledge base.

Example Usage

Support Widget (github.com/promptlyagentai/support-widget) - Restore conversation history:

Trigger API Client (github.com/promptlyagentai/trigger-api-client) - Session validation:

Example request:

Example response (200, Success):


{
    "success": true,
    "session": {
        "id": 123,
        "name": "API Chat Session",
        "title": "Discussion about Laravel routing",
        "uuid": "550e8400-e29b-41d4-a716-446655440000",
        "is_public": false,
        "created_at": "2024-01-01T00:00:00Z",
        "updated_at": "2024-01-01T00:15:00Z"
    },
    "interactions": [
        {
            "id": 456,
            "question": "What are Laravel best practices?",
            "answer": "Here are the Laravel best practices...",
            "agent_name": "Direct Chat Agent",
            "sources": [
                {
                    "title": "Laravel Documentation",
                    "url": "https://laravel.com/docs",
                    "domain": "laravel.com"
                }
            ],
            "created_at": "2024-01-01T00:00:00Z"
        }
    ]
}
 

Example response (403, Missing chat:view ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the chat:view ability"
}
 

Example response (403, Not Session Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to access this session"
}
 

Example response (404, Session Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "Chat session not found"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while retrieving the session"
}
 

Request   

GET api/v1/chat/sessions/{id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The session ID. Example: 123

Response

Response Fields

success   boolean     

Indicates if the request was successful

session   object     

The chat session details

id   integer     

Session ID

name   string     

Session name

title   string     

Session title (auto-generated from first message)

uuid   string     

Unique session identifier for public sharing

is_public   boolean     

Whether the session is publicly shared

created_at   string     

Session creation timestamp (ISO 8601)

updated_at   string     

Last update timestamp (ISO 8601)

interactions   string[]     

Array of chat interactions in chronological order

id   integer     

Interaction ID

question   string     

User's question/message

answer   string     

Agent's response

agent_name   string     

Name of the agent that handled this interaction

sources   string[]     

Knowledge sources referenced in the response

title   string     

Source document title

url   string     

Source URL

domain   string     

Source domain name

created_at   string     

Interaction timestamp (ISO 8601)

Input Triggers

Input Triggers provide webhook-based automation for invoking AI agents. Execute triggers via REST API with Sanctum authentication and optional IP whitelisting.

Authentication & Authorization

Required token abilities:

Execution Modes

Rate Limiting

Execute trigger synchronously

requires authentication

Invoke an input trigger and wait for the complete response. Supports both synchronous and asynchronous execution modes. For real-time streaming responses, use the /stream endpoint instead.

The request format depends on the trigger's provider. Common providers include:

Example request:

Example response (200, Success (Sync)):


{
    "success": true,
    "result": {
        "answer": "Analysis complete. Here are the findings...",
        "sources": [],
        "artifacts": []
    },
    "execution_time": 5.2
}
 

Example response (200, Success (Async)):


{
    "success": true,
    "execution_id": 456,
    "status": "queued",
    "message": "Trigger execution started asynchronously"
}
 

Example response (403, Missing trigger:invoke ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the trigger:invoke ability"
}
 

Example response (403, Not Trigger Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to invoke this trigger"
}
 

Example response (403, Trigger Disabled):


{
    "success": false,
    "error": "Trigger Disabled",
    "message": "This trigger is currently disabled"
}
 

Example response (422, Validation Failed):


{
    "success": false,
    "error": "Validation Failed",
    "message": "Invalid input format",
    "errors": {
        "input": [
            "The input field is required"
        ]
    }
}
 

Example response (422, Invalid Input):


{
    "success": false,
    "error": "Invalid Input",
    "message": "Input exceeds maximum length"
}
 

Example response (500, Provider Not Found):


{
    "success": false,
    "error": "Provider Not Found",
    "message": "Provider 'custom_provider' is not registered"
}
 

Request   

POST api/v1/triggers/{trigger_id}/invoke

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

trigger_id   string     

The ID of the trigger. Example: soluta

trigger   integer     

The trigger ID. Example: 1

Body Parameters

input   string  optional    

Optional text input (provider-dependent). Maximum 50,000 characters. Example: Analyze this data

options   object  optional    

Optional execution options and metadata.

async   boolean  optional    

Optional execute asynchronously and return immediately. Defaults to false. Example: false

Response

Response Fields

success   boolean     

Indicates if the request was successful

result   object     

Execution result (synchronous mode only)

answer   string     

AI agent's response

sources   string[]     

Knowledge sources referenced

artifacts   string[]     

Generated artifacts (code, documents)

execution_time   number     

Execution duration in seconds

execution_id   integer     

Execution ID (async mode only)

status   string     

Execution status: queued, processing, completed, failed (async mode only)

Execute trigger with real-time SSE streaming

requires authentication

Invoke an input trigger and stream the AI response in real-time using Server-Sent Events (SSE). Supports file attachments, tool overrides, and session continuity.

The stream returns various event types (message, tool_call, source, artifact, heartbeat, complete, error) with JSON-encoded data payloads. Connections are kept alive with periodic heartbeats.

Example Usage

Trigger API Client (github.com/promptlyagentai/trigger-api-client) - Full-featured Python CLI:

Example request:

Example response (200, SSE Stream):


event: message
data: {"type": "text", "content": "Analysis complete. Here are the key findings...", "delta": true}

event: tool_call
data: {"tool": "search_knowledge", "arguments": {"query": "data analysis"}}

event: source
data: {"title": "Data Analysis Guide", "url": "https://example.com/guide", "domain": "example.com"}

event: heartbeat
data: {"timestamp": 1704067200}

event: complete
data: {"status": "completed", "duration_seconds": 8}
 

Example response (403, Missing trigger:invoke ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the trigger:invoke ability"
}
 

Example response (403, Missing trigger:attach for files):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the trigger:attach ability required for file uploads"
}
 

Example response (403, Missing trigger:tools for override):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the trigger:tools ability required for tool override"
}
 

Example response (403, Not Trigger Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to invoke this trigger"
}
 

Example response (403, Trigger Disabled):


{
    "success": false,
    "error": "Trigger Disabled",
    "message": "This trigger is currently disabled"
}
 

Example response (422, File Validation Failed):


{
    "success": false,
    "error": "File Validation Failed",
    "message": "File type not allowed: executable"
}
 

Example response (422, Invalid Tool Override):


{
    "success": false,
    "error": "Invalid Tool Override",
    "message": "Tool 'invalid_tool' not available for this agent",
    "details": []
}
 

Example response (422, Validation Failed):


{
    "success": false,
    "error": "Validation Failed",
    "message": "Invalid input format",
    "errors": {}
}
 

Example response (500, Provider Not Found):


{
    "success": false,
    "error": "Provider Not Found",
    "message": "Provider 'custom_provider' is not registered"
}
 

Request   

GET api/v1/triggers/{trigger_id}/stream

POST api/v1/triggers/{trigger_id}/stream

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

trigger_id   string     

The ID of the trigger. Example: repellat

trigger   integer     

The trigger ID. Example: 1

Body Parameters

input   string  optional    

Optional text input (provider-dependent). Maximum 50,000 characters. Example: Analyze this data

attachments   file[]  optional    

Optional file attachments (requires trigger:attach token ability). Maximum 10 files, 50MB each.

tools   string[]  optional    

Optional tool override (requires trigger:tools token ability). Array of tool names to enable.

options   object  optional    

Optional execution options and metadata.

Response

Response Fields

event   string     

The SSE event type (message, tool_call, source, artifact, heartbeat, complete, error)

data   string     

JSON-encoded event data. Structure varies by event type.

List all triggers

requires authentication

Retrieve all input triggers for the authenticated user with basic information and API URLs. Results are ordered by creation date (newest first).

Example request:

Example response (200, Success):


{
    "success": true,
    "triggers": [
        {
            "id": 1,
            "name": "Daily Report Generator",
            "description": "Generates daily analytics reports",
            "provider": "schedule",
            "is_active": true,
            "agent_name": "Report Agent",
            "usage_count": 42,
            "last_invoked_at": "2024-01-01T10:00:00Z",
            "api_url": "https://promptlyagent.com/api/input-triggers/1"
        }
    ]
}
 

Example response (403, Missing trigger:status ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the trigger:status ability"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while retrieving triggers"
}
 

Request   

GET api/v1/triggers

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Response

Response Fields

success   boolean     

Indicates if the request was successful

triggers   string[]     

Array of triggers

id   integer     

Trigger ID

name   string     

Trigger name

description   string     

Trigger description

provider   string     

Provider ID

is_active   boolean     

Whether trigger is active

agent_name   string     

Associated agent name

usage_count   integer     

Number of invocations

last_invoked_at   string     

Last invocation timestamp (ISO 8601) or null

api_url   string     

Full API URL for invoking this trigger

View a trigger's details

requires authentication

Retrieve comprehensive information about a specific input trigger including configuration, usage statistics, and provider metadata.

Example request:

Example response (200, Success):


{
    "success": true,
    "trigger": {
        "id": 1,
        "name": "Daily Report Generator",
        "description": "Generates daily analytics reports",
        "provider": "schedule",
        "is_active": true,
        "agent_id": 5,
        "agent_name": "Report Agent",
        "session_strategy": "continue_last",
        "usage_count": 42,
        "last_invoked_at": "2024-01-01T10:00:00Z",
        "rate_limits": {
            "max_per_minute": 10
        },
        "created_at": "2023-12-01T00:00:00Z"
    },
    "provider_info": {
        "name": "Schedule",
        "description": "Scheduled triggers",
        "icon": "⏰"
    }
}
 

Example response (403, Missing trigger:status ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the trigger:status ability"
}
 

Example response (403, Not Trigger Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to view this trigger"
}
 

Example response (404, Trigger Not Found):


{
    "success": false,
    "error": "Not Found",
    "message": "Trigger not found"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while retrieving trigger information"
}
 

Request   

GET api/v1/triggers/{id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   string     

The ID of the trigger. Example: dolor

trigger   integer     

The trigger ID. Example: 1

Response

Response Fields

success   boolean     

Indicates if the request was successful

trigger   object     

Trigger details

id   integer     

Trigger ID

name   string     

Trigger name

description   string     

Trigger description

provider   string     

Provider ID (schedule, direct_text, webhook, etc.)

is_active   boolean     

Whether trigger is currently active

agent_id   integer     

Associated agent ID

agent_name   string     

Associated agent name

session_strategy   string     

Session handling strategy (new_each, continue_last, specified)

usage_count   integer     

Number of times trigger has been invoked

last_invoked_at   string     

Last invocation timestamp (ISO 8601) or null

rate_limits   object     

Rate limiting configuration

created_at   string     

Creation timestamp (ISO 8601)

provider_info   object     

Provider metadata (name, description, icon)

Resolve session for a trigger

requires authentication

Determine which chat session would be used for a trigger execution based on its session strategy, without actually executing the trigger. Useful for understanding session continuity behavior or pre-loading session history in CLI tools.

Session strategies:

Example request:

Example response (200, Will Create New Session):


{
    "success": true,
    "session_id": null,
    "is_existing": false,
    "will_create": true,
    "session_name": "⏰ Daily Report Generator",
    "strategy": "new_each"
}
 

Example response (200, Will Continue Existing):


{
    "success": true,
    "session_id": 123,
    "session_name": "Daily Report Generator",
    "is_existing": true,
    "will_create": false,
    "strategy": "continue_last",
    "interactions_count": 15
}
 

Example response (403, Missing trigger:status ability):


{
    "success": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the trigger:status ability"
}
 

Example response (403, Not Trigger Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to access this trigger"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Server Error",
    "message": "An error occurred while resolving the session"
}
 

Request   

GET api/v1/triggers/{trigger_id}/session

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

trigger_id   string     

The ID of the trigger. Example: a

trigger   integer     

The trigger ID. Example: 1

Response

Response Fields

success   boolean     

Indicates if the request was successful

session_id   integer     

Existing session ID, or null if new session will be created

session_name   string     

Name of existing session or proposed name for new session

is_existing   boolean     

Whether an existing session was found

will_create   boolean     

Whether a new session will be created on execution

strategy   string     

Session strategy used (new_each, continue_last, specified)

interactions_count   integer     

Number of interactions in existing session (only if is_existing=true)

Validate or resolve session

requires authentication

Validate that a specific session ID is compatible with this trigger, or resolve which session would be used based on the trigger's session strategy.

Use cases:

Example request:

Example response (200, Session Valid):


{
    "success": true,
    "valid": true,
    "session": {
        "id": 123,
        "name": "Daily Report Generator",
        "url": "https://promptlyagent.com/dashboard/research-chat/123",
        "strategy_used": "validated"
    }
}
 

Example response (200, Session Resolved):


{
    "success": true,
    "valid": true,
    "session": {
        "id": 456,
        "name": "Report Session",
        "url": "https://promptlyagent.com/dashboard/research-chat/456",
        "strategy_used": "continue_last"
    }
}
 

Example response (200, No Session Available):


{
    "success": true,
    "valid": true,
    "session": null,
    "message": "No existing session available",
    "strategy": "new_each",
    "url_pattern": "https://promptlyagent.com/dashboard/research-chat/<id>"
}
 

Example response (403, Missing trigger:status ability):


{
    "success": false,
    "valid": false,
    "error": "Unauthorized",
    "message": "Your API token does not have the trigger:status ability"
}
 

Example response (403, Not Trigger Owner):


{
    "success": false,
    "valid": false,
    "error": "Forbidden",
    "message": "You do not have permission to access this trigger"
}
 

Example response (404, Session Not Found):


{
    "success": false,
    "valid": false,
    "session": null,
    "message": "Session not found"
}
 

Example response (404, Session Not Owned):


{
    "success": false,
    "valid": false,
    "session": null,
    "message": "Session does not belong to you"
}
 

Example response (404, Session Wrong Trigger):


{
    "success": false,
    "valid": false,
    "session": null,
    "message": "Session does not belong to this trigger"
}
 

Example response (500, Server Error):


{
    "success": false,
    "valid": false,
    "error": "Internal Server Error",
    "message": "Failed to validate session"
}
 

Request   

GET api/v1/triggers/{trigger_id}/validate-session

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

trigger_id   string     

The ID of the trigger. Example: labore

trigger   integer     

The trigger ID. Example: 1

Query Parameters

session_id   integer  optional    

Optional session ID to validate. Example: 123

Response

Response Fields

success   boolean     

Indicates if the request was successful

valid   boolean     

Whether the session is valid for this trigger

session   object     

Session details (null if no session available)

id   integer     

Session ID

name   string     

Session name

url   string     

Full URL to view session in dashboard

strategy_used   string     

Strategy that resolved this session (validated, continue_last, specified)

message   string     

Informational message (when session is null)

strategy   string     

Trigger's session strategy (when session is null)

url_pattern   string     

URL pattern for accessing sessions (when session is null)

List webhook trigger configurations

requires authentication

Retrieve webhook trigger configurations for UI integration. Returns trigger metadata including webhook URLs and secrets needed for external webhook setup.

Note: This endpoint is primarily for UI consumption. For API integration, use the v1 API endpoints instead.

Example request:

Example response (200, Success):


{
    "triggers": [
        {
            "id": 1,
            "name": "GitHub Push Webhook",
            "config": {
                "provider": "webhook",
                "description": "Trigger on push events"
            },
            "webhook_url": "https://example.com/webhooks/triggers/1",
            "webhook_secret": "whs_abc123xyz456"
        }
    ]
}
 

Example response (401, Unauthenticated):


{
    "message": "Unauthenticated."
}
 

Request   

GET api/input-triggers

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

provider   string  optional    

Optional filter triggers by provider (webhook, schedule, etc.). Example: webhook

Response

Response Fields

triggers   string[]     

List of trigger configurations

id   integer     

Trigger ID

name   string     

Trigger name

config   object     

Trigger configuration

webhook_url   string     

Full webhook URL for external services

webhook_secret   string     

HMAC secret key for signature validation (null if not webhook trigger)

Get webhook trigger configuration

requires authentication

Retrieve webhook configuration for a specific trigger. Returns webhook URL and secret needed for external webhook setup.

Note: This endpoint is primarily for UI consumption. For API integration, use the v1 API endpoints instead.

Example request:

Example response (200, Success):


{
    "id": 1,
    "name": "GitHub Push Webhook",
    "config": {
        "provider": "webhook",
        "description": "Trigger on push events"
    },
    "webhook_url": "https://example.com/webhooks/triggers/1",
    "webhook_secret": "whs_abc123xyz456"
}
 

Example response (401, Unauthenticated):


{
    "message": "Unauthenticated."
}
 

Example response (404, Not Found):


{
    "message": "Not found"
}
 

Request   

GET api/input-triggers/{trigger}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

trigger   integer     

The trigger ID. Example: 1

Response

Response Fields

id   integer     

Trigger ID

name   string     

Trigger name

config   object     

Trigger configuration

webhook_url   string     

Full webhook URL for external services

webhook_secret   string     

HMAC secret key for signature validation (null if not webhook trigger)

Knowledge Management

Comprehensive API for managing knowledge documents, files, and RAG (Retrieval-Augmented Generation) operations.

Document Types

Features

Rate Limiting

Security

All file uploads are validated with magic byte verification, executable detection, and path traversal protection.

Create a new knowledge document

requires authentication

Create a knowledge document from text content, file upload, or external URL. Supports automatic content extraction, embedding generation, and TTL-based expiration.

Example Usage

Chrome Extension (github.com/promptlyagentai/chrome-extension) - Save web page content to knowledge base:

Example request:

Example response (201, Success):


{
    "success": true,
    "data": {
        "id": 1,
        "title": "Laravel Best Practices",
        "content_type": "text",
        "privacy_level": "private",
        "processing_status": "completed",
        "created_at": "2024-01-01T00:00:00Z"
    },
    "message": "Knowledge document created successfully"
}
 

Example response (422, File Validation Failed):


{
    "success": false,
    "error": "FILE_VALIDATION_FAILED",
    "message": "File type not allowed: executable"
}
 

Example response (500, Creation Failed):


{
    "success": false,
    "error": "CREATION_FAILED",
    "message": "Failed to create document"
}
 

Request   

POST api/v1/knowledge

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

title   string     

Document title. Maximum 500 characters. Example: Laravel Best Practices

description   string  optional    

Optional document description. Example: Comprehensive guide to Laravel development patterns

content_type   string     

Type of content. Options: text, file, external. Example: text

content   string  optional    

Required for text documents. The text content. Maximum 500,000 characters. Example: Laravel follows the MVC pattern...

file   file  optional    

Required for file documents. The file to upload (PDF, Word, text, code files). Maximum 50MB.

external_source   string  optional    

Required for external documents. The URL to fetch content from. Example: https://laravel.com/docs

async   boolean  optional    

Process document asynchronously (recommended for large files). Returns immediately with document ID. Example: false

external_source_identifier   string  optional    

Optional external source URL (for tracking duplicates). Example: https://example.com/article

author   string  optional    

Optional author name. Example: Taylor Otwell

thumbnail_url   string  optional    

Optional thumbnail image URL. Example: https://example.com/thumb.jpg

favicon_url   string  optional    

Optional favicon URL. Example: https://example.com/favicon.ico

notes   string  optional    

Optional internal notes about the document. Example: Added for Q1 training materials

screenshot   string  optional    

Optional base64-encoded screenshot.

auto_refresh_enabled   boolean  optional    

Optional enable automatic refresh for external documents. Example: false

refresh_interval_minutes   integer  optional    

Optional refresh interval in minutes (requires auto_refresh_enabled). Example: 1440

tags   string[]  optional    

Optional array of tag names.

privacy_level   string  optional    

Optional privacy level. Options: private, public. Defaults to private. Example: private

ttl_hours   integer  optional    

Optional time-to-live in hours. Document expires after this period. Example: 168

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

The created knowledge document

id   integer     

Document ID

title   string     

Document title

content_type   string     

Content type (text, file, external)

privacy_level   string     

Privacy level

processing_status   string     

Current processing status

created_at   string     

Creation timestamp (ISO 8601)

message   string     

Success message

Extract content from a URL

requires authentication

Extract and parse content from a URL without creating a document. Returns extracted text, title, description, and metadata. Useful for previewing content before saving.

Includes SSRF protection to block access to private networks and metadata services.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "content": "Laravel is a web application framework...",
        "title": "Laravel Documentation",
        "description": "The PHP framework for web artisans",
        "tags": [
            "framework",
            "php"
        ],
        "metadata": {
            "author": "Laravel",
            "published_at": "2024-01-01"
        }
    }
}
 

Example response (403, SSRF Blocked):


{
    "success": false,
    "error": "SSRF_BLOCKED",
    "message": "Access to this URL is not allowed for security reasons"
}
 

Example response (422, Validation Failed):


{
    "success": false,
    "error": "VALIDATION_ERROR",
    "message": "URL parameter is required"
}
 

Example response (422, Invalid URL):


{
    "success": false,
    "error": "VALIDATION_ERROR",
    "message": "Invalid URL format"
}
 

Example response (500, Extraction Failed):


{
    "success": false,
    "error": "Failed to extract content from URL: Connection timeout"
}
 

Request   

POST api/v1/knowledge/extract-url

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

url   string     

The URL to extract content from. Example: https://laravel.com/docs

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Extracted content and metadata

content   string     

Extracted text content

title   string     

Page title

description   string     

Page description/summary

tags   string[]     

Auto-extracted tags

metadata   object     

Additional metadata (author, published date, etc.)

Query knowledge base for RAG context

requires authentication

Retrieve relevant knowledge documents for a given query, formatted as RAG context. Returns concatenated document excerpts with source attribution, ready for AI injection.

Results are automatically filtered by privacy (public + user-owned) and TTL expiration. Optionally filter to agent-specific documents.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "context": "[Source: Laravel Queues Guide]\nLaravel queues provide a unified API for background job processing...\n\n[Source: Redis Configuration]\nTo use Redis as your queue driver, set QUEUE_CONNECTION=redis...",
        "query": "How do I configure Laravel queues?",
        "total_sources": 2,
        "sources": [
            {
                "id": 1,
                "title": "Laravel Queues Guide",
                "relevance_score": 0.8,
                "document_type": "text"
            },
            {
                "id": 5,
                "title": "Redis Configuration",
                "relevance_score": 0.8,
                "document_type": "file"
            }
        ]
    }
}
 

Example response (200, No Sources Found):


{
    "success": true,
    "data": {
        "context": "",
        "query": "obscure query with no matches",
        "total_sources": 0,
        "sources": []
    }
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "RAG query failed"
}
 

Request   

POST api/v1/knowledge/rag/query

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

query   string     

The search query to find relevant knowledge. Example: How do I configure Laravel queues?

agent_id   integer  optional    

Optional filter documents assigned to specific agent. Example: 5

limit   integer  optional    

Optional number of documents to retrieve. Defaults to 5. Maximum 25. Example: 10

context_length   integer  optional    

Optional maximum context length in characters. Defaults to 4000. Example: 8000

include_sources   boolean  optional    

Optional include source document metadata in response. Defaults to true. Example: true

include_expired   boolean  optional    

Optional include expired documents. Defaults to false. Example: false

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

RAG context data

context   string     

Formatted RAG context with source attribution (ready for AI injection)

query   string     

The original search query

total_sources   integer     

Number of source documents included

sources   string[]     

Source document metadata (if include_sources=true)

id   integer     

Document ID

title   string     

Document title

relevance_score   number     

Search relevance score (0-1)

document_type   string     

Document content type (text, file, external)

Get RAG context (alias)

requires authentication

Alternative endpoint for retrieving RAG context. Functionally identical to the query endpoint. Provided for semantic clarity in workflows where "context" terminology is preferred.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "context": "[Source: Laravel Queues Guide]\nLaravel queues provide a unified API...",
        "query": "How do I configure Laravel queues?",
        "total_sources": 2,
        "sources": [
            {
                "id": 1,
                "title": "Laravel Queues Guide",
                "relevance_score": 0.8,
                "document_type": "text"
            }
        ]
    }
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "RAG query failed"
}
 

Request   

POST api/v1/knowledge/rag/context

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

query   string     

The search query to find relevant knowledge. Example: How do I configure Laravel queues?

agent_id   integer  optional    

Optional filter documents assigned to specific agent. Example: 5

limit   integer  optional    

Optional number of documents to retrieve. Defaults to 5. Maximum 25. Example: 10

context_length   integer  optional    

Optional maximum context length in characters. Defaults to 4000. Example: 8000

include_sources   boolean  optional    

Optional include source document metadata in response. Defaults to true. Example: true

include_expired   boolean  optional    

Optional include expired documents. Defaults to false. Example: false

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

RAG context data

context   string     

Formatted RAG context with source attribution

query   string     

The original search query

total_sources   integer     

Number of source documents included

sources   string[]     

Source document metadata (if include_sources=true)

Stream RAG context with real-time SSE

requires authentication

Retrieve relevant knowledge with Server-Sent Events (SSE) streaming. Returns context progressively as sources are found and processed, enabling real-time UI updates.

Ideal for building responsive interfaces where users see sources appearing in real-time rather than waiting for the complete result.

Connection Requirements:

Event Sequence:

  1. context_retrieved - Initial event with source count
  2. source - One event per source document (progressive)
  3. context - Final formatted RAG context
  4. done - Completion signal
  5. error - Only on failure
Example request:

Example response (200, SSE Stream):


event: message
data: {"type": "context_retrieved", "sources_found": 3}

data: {"type": "source", "data": {"id": 1, "title": "Laravel Queues Guide", "score": 0.8}}

data: {"type": "source", "data": {"id": 5, "title": "Redis Configuration", "score": 0.8}}

data: {"type": "context", "data": "[Source: Laravel Queues Guide]\nLaravel queues provide..."}

data: {"type": "done"}
 

Example response (200, SSE Error):


event: message
data: {"type": "error", "message": "RAG streaming failed"}
 

Example response (403, Missing Ability):


{
    "error": "Unauthorized",
    "message": "Your API token does not have the knowledge:rag ability"
}
 

Request   

POST api/v1/knowledge/rag/stream

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

query   string     

The search query to find relevant knowledge. Example: How do I configure Laravel queues?

agent_id   integer  optional    

Optional agent ID to scope search to documents assigned to specific agent. Example: 3

limit   integer  optional    

Optional number of documents to retrieve. Defaults to 5. Maximum 25. Example: 10

context_length   integer  optional    

Optional maximum context length in characters. Defaults to 4000. Example: 8000

include_sources   boolean  optional    

Include full source document metadata in response. Example: false

include_expired   boolean  optional    

Optional include expired documents. Defaults to false. Example: false

Bulk delete documents

requires authentication

Delete multiple knowledge documents in a single operation. Each document is individually authorized - documents you don't have permission to delete will be skipped.

Returns a detailed summary including successful deletions and errors for failed operations.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "deleted_count": 3,
        "total_requested": 5,
        "errors": [
            "Document 2 not found",
            "Access denied for document 4"
        ]
    },
    "message": "Successfully deleted 3 documents"
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (500, Operation Failed):


{
    "success": false,
    "error": "Bulk delete failed"
}
 

Request   

POST api/v1/knowledge/bulk/delete

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

document_ids   integer[]     

Array of document IDs to delete.

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Bulk operation results

deleted_count   integer     

Number of documents successfully deleted

total_requested   integer     

Total number of documents requested for deletion

errors   string[]     

Array of error messages for documents that couldn't be deleted

message   string     

Summary message

Bulk assign tag to documents

requires authentication

Assign a tag to multiple knowledge documents in a single operation. If the tag doesn't exist, it will be created automatically. Each document is individually authorized - documents you don't have permission to update will be skipped.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "assigned_count": 4,
        "total_requested": 5,
        "tag": {
            "id": 1,
            "name": "important",
            "color": "zinc"
        },
        "errors": [
            "Access denied for document 3"
        ]
    },
    "message": "Successfully assigned tag 'important' to 4 documents"
}
 

Example response (500, Operation Failed):


{
    "success": false,
    "error": "Bulk assign tag failed"
}
 

Request   

POST api/v1/knowledge/bulk/assign-tag

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

document_ids   integer[]     

Array of document IDs to tag.

tag_name   string     

Name of the tag to assign. Will be created if it doesn't exist. Example: important

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Bulk operation results

assigned_count   integer     

Number of documents successfully tagged

total_requested   integer     

Total number of documents requested for tagging

tag   object     

The tag that was assigned (created if new)

id   integer     

Tag ID

name   string     

Tag name

color   string     

Tag color

errors   string[]     

Array of error messages for documents that couldn't be tagged

message   string     

Summary message

Regenerate missing embeddings in bulk

requires authentication

Process multiple documents that are missing embeddings and generate embeddings for them. Useful for batch processing after system updates or when embeddings fail.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "processed": 25,
        "successful": 23,
        "failed": 2,
        "failed_documents": [
            {
                "id": 10,
                "error": "Content too large"
            },
            {
                "id": 15,
                "error": "Invalid format"
            }
        ]
    },
    "message": "Processed 25 documents. Successful: 23, Failed: 2"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to regenerate embeddings"
}
 

Request   

POST api/v1/knowledge/embeddings/regenerate

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

document_ids   integer[]  optional    

The id of an existing record in the knowledge_documents table.

limit   integer  optional    

Optional maximum number of documents to process. Defaults to 25. Example: 50

force   boolean  optional    

Force regeneration even if embeddings already exist. Default: false. Example: false

batch_size   integer  optional    

Number of documents to process in each batch (1-50, default: 10). Must be at least 1. Must not be greater than 50. Example: 10

async   boolean  optional    

Process regeneration asynchronously in the background. Returns immediately with job ID. Default: true. Example: false

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Regeneration results

processed   integer     

Total documents processed

successful   integer     

Documents successfully embedded

failed   integer     

Documents that failed

failed_documents   string[]     

Details of failed documents with error messages

message   string     

Summary message

Regenerate embeddings for a document

requires authentication

Regenerate embeddings for a specific document. Deletes existing embeddings and generates new ones from the current document content.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "chunk_count": 150,
        "generated_at": "2024-01-01T12:00:00Z",
        "embedding_model": "text-embedding-ada-002"
    },
    "message": "Document embedding regenerated successfully"
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (403, No Permission):


{
    "success": false,
    "error": "You do not have permission to modify this document"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to regenerate embedding"
}
 

Request   

POST api/v1/knowledge/embeddings/{document_id}/regenerate

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 15

document   integer     

The document ID. Example: 1

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Embedding generation results

chunk_count   integer     

Number of chunks created

generated_at   string     

Generation timestamp (ISO 8601)

embedding_model   string     

Model used for embeddings

message   string     

Success message

Reprocess a knowledge document

requires authentication

Regenerate embeddings and reindex the document. Useful after system updates or when embeddings are corrupted.

Example request:

Example response (200, Success (Sync)):


{
    "success": true,
    "data": {
        "chunks_processed": 150,
        "embeddings_generated": 150
    },
    "message": "Document reprocessed successfully"
}
 

Example response (202, Success (Async)):


{
    "success": true,
    "status": "processing",
    "job_id": "job_abc123",
    "status_url": "/api/v1/knowledge/1"
}
 

Example response (403, Unauthorized):


{
    "success": false,
    "error": "You do not have permission to reprocess this document"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Failed to reprocess document"
}
 

Request   

POST api/v1/knowledge/{document_id}/reprocess

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 7

document   integer     

The document ID. Example: 1

Body Parameters

async   boolean  optional    

Optional execute reprocessing asynchronously. Defaults to false. Example: true

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Reprocessing results (sync mode)

status   string     

Processing status (async mode)

job_id   string     

Job identifier (async mode)

status_url   string     

URL to check processing status (async mode)

message   string     

Success message

Refresh external document content

requires authentication

Queue a job to re-fetch content from the external URL. Only available for documents created from external URLs (content_type: external).

Example request:

Example response (200, Success):


{
    "success": true,
    "data": null,
    "message": "Document refresh queued successfully"
}
 

Example response (403, Unauthorized):


{
    "success": false,
    "error": "You do not have permission to refresh this document"
}
 

Example response (422, Not Refreshable):


{
    "success": false,
    "error": "INVALID_DOCUMENT",
    "message": "Document is not refreshable"
}
 

Example response (422, No External URL):


{
    "success": false,
    "error": "INVALID_DOCUMENT",
    "message": "Document does not have an external source URL"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Failed to queue document refresh"
}
 

Request   

POST api/v1/knowledge/{document_id}/refresh

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 1

document   integer     

The document ID. Example: 1

Response

Response Fields

success   boolean     

Indicates if the request was successful

data        

null Always null

message   string     

Success message

requires authentication

Full-text search across all accessible knowledge documents using Meilisearch. Supports filtering by content type, tags, and expiration status.

Example Usage

PWA (resources/js/pwa/knowledge-api.js) - Knowledge search with offline support:

Example request:

Example response (200, Success):


{
    "success": true,
    "data": [
        {
            "id": 1,
            "title": "Laravel Routing Guide",
            "content": "Laravel routing allows you to...",
            "score": 1,
            "created_at": "2024-01-01T00:00:00Z"
        }
    ]
}
 

Example response (500, Search Failed):


{
    "success": false,
    "error": "Search failed"
}
 

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   string[]     

Array of search results ordered by relevance

id   integer     

Document ID

title   string     

Document title

content   string     

Content preview (first 200 characters)

score   number     

Relevance score (0-1)

created_at   string     

Creation timestamp (ISO 8601)

requires authentication

Search documents by semantic meaning using embeddings. Finds conceptually similar content even when exact keywords don't match.

Example Usage

PWA (resources/js/pwa/knowledge-api.js) - Semantic knowledge search:

Example request:

Example response (200, Success):


{
    "success": true,
    "data": [
        {
            "id": 1,
            "title": "Laravel HTTP Client",
            "content": "The Laravel HTTP client...",
            "score": 0.95,
            "created_at": "2024-01-01T00:00:00Z"
        }
    ]
}
 

Example response (500, Search Failed):


{
    "success": false,
    "error": "Search failed"
}
 

requires authentication

Combines full-text and semantic search for optimal results. Uses keyword matching for precision and semantic similarity for recall.

Example Usage

PWA (resources/js/pwa/knowledge-api.js) - Hybrid knowledge search (default):

Example request:

Example response (200, Success):


{
    "success": true,
    "data": [
        {
            "id": 1,
            "title": "Authentication Middleware",
            "content": "Laravel middleware...",
            "score": 0.98,
            "created_at": "2024-01-01T00:00:00Z"
        }
    ]
}
 

Example response (500, Search Failed):


{
    "success": false,
    "error": "Search failed"
}
 

Find similar documents

requires authentication

Find documents similar to a given document based on content type and other attributes. Useful for recommendations and related content discovery.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": [
        {
            "id": 2,
            "title": "Laravel Routing Advanced",
            "content": "Advanced routing techniques...",
            "score": 0.8
        }
    ]
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to find similar documents"
}
 

Request   

GET api/v1/knowledge/{document_id}/similar

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 16

document   integer     

The document ID to find similar documents for. Example: 1

Query Parameters

limit   integer  optional    

Optional maximum results to return (1-100). Defaults to 5. Example: 10

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   string[]     

Array of similar documents

id   integer     

Document ID

title   string     

Document title

content   string     

Content preview (first 200 characters)

score   number     

Similarity score (0-1)

Create a new knowledge tag

requires authentication

Create a new tag for organizing knowledge documents. If a tag with the same name already exists, returns the existing tag.

Example request:

Example response (201, Success):


{
    "success": true,
    "data": {
        "id": 1,
        "name": "laravel",
        "description": "Laravel framework documentation and guides",
        "color": "blue",
        "created_at": "2024-01-01T00:00:00Z"
    },
    "message": "Tag created successfully"
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (422, Validation Failed):


{
    "success": false,
    "error": "Validation failed",
    "errors": {
        "name": [
            "The name field is required."
        ]
    }
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to create tag"
}
 

Request   

POST api/v1/knowledge/tags

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

name   string     

Tag name. Must be unique. Example: laravel

description   string  optional    

Optional tag description. Example: Laravel framework documentation and guides

color   string  optional    

Optional color for UI display. Defaults to zinc. Example: blue

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

The created or existing tag

id   integer     

Tag ID

name   string     

Tag name

description   string     

Tag description

color   string     

Tag color

created_at   string     

Creation timestamp (ISO 8601)

message   string     

Success message

Add tags to a document

requires authentication

Add one or more tags to a knowledge document. Existing tags are preserved (does not replace).

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "id": 1,
        "title": "Laravel Guide",
        "tags": [
            {
                "id": 1,
                "name": "laravel"
            },
            {
                "id": 2,
                "name": "php"
            }
        ]
    },
    "message": "Tags added to document successfully"
}
 

Example response (403, No Permission):


{
    "success": false,
    "error": "You do not have permission to modify this document"
}
 

Example response (422, Validation Failed):


{
    "success": false,
    "error": "Validation failed",
    "errors": {
        "tag_ids": [
            "The tag ids field is required."
        ]
    }
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to add tags"
}
 

Request   

POST api/v1/knowledge/{document_id}/tags

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 11

document   integer     

The document ID. Example: 1

Body Parameters

tag_ids   integer[]     

Array of tag IDs to add.

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

The updated document with tags

id   integer     

Document ID

title   string     

Document title

tags   string[]     

All tags now attached to the document

message   string     

Success message

Assign document to agent

requires authentication

Make a knowledge document available to an agent for RAG context. The agent will be able to query this document's content during executions.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": null,
    "message": "Document assigned to agent successfully"
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (403, No Permission):


{
    "success": false,
    "error": "You do not have permission to modify this document"
}
 

Example response (422, Validation Failed):


{
    "success": false,
    "error": "Validation failed",
    "errors": {
        "agent_id": [
            "The agent id field is required."
        ]
    }
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to assign document to agent"
}
 

Request   

POST api/v1/knowledge/{document_id}/assign-agent

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 20

document   integer     

The document ID. Example: 1

Body Parameters

agent_id   integer     

The agent ID to assign the document to. Example: 5

config   object  optional    

Optional agent-specific configuration for this document.

Response

Response Fields

success   boolean     

Indicates if the request was successful

data        

null Always null for assignment operations

message   string     

Success message

Unassign document from agent

requires authentication

Remove a knowledge document from an agent's RAG context. The agent will no longer be able to query this document's content.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": null,
    "message": "Document unassigned from agent successfully"
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (403, No Permission):


{
    "success": false,
    "error": "You do not have permission to modify this document"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to unassign document from agent"
}
 

Request   

DELETE api/v1/knowledge/{document_id}/unassign-agent/{agent}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 18

agent   integer     

The agent ID. Example: 5

document   integer     

The document ID. Example: 1

Response

Response Fields

success   boolean     

Indicates if the request was successful

data        

null Always null for unassignment operations

message   string     

Success message

Update a knowledge document

requires authentication

Update document metadata including title, description, privacy level, tags, and TTL. Content cannot be modified - create a new document for content changes.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "id": 1,
        "title": "Updated Laravel Guide",
        "privacy_level": "public"
    },
    "message": "Knowledge document updated successfully"
}
 

Example response (403, Unauthorized):


{
    "success": false,
    "error": "You do not have permission to update this document"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Failed to update document"
}
 

Request   

PUT api/v1/knowledge/{document_id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 10

document   integer     

The document ID. Example: 1

Body Parameters

title   string  optional    

Optional new title. Maximum 500 characters. Example: Updated Laravel Guide

description   string  optional    

Optional new description. Example: Updated comprehensive guide

notes   string  optional    

Custom notes about the document (max 50,000 characters). Must not be greater than 50000 characters. Example: Updated with Laravel 12 changes

auto_refresh_enabled   boolean  optional    

Enable automatic refresh for external sources. Example: false

refresh_interval_minutes   integer  optional    

Refresh interval in minutes (required if auto_refresh_enabled is true). Min: 15 minutes, Max: 30 days (43,200 minutes). This field is required when auto_refresh_enabled is true. Must be at least 15. Must not be greater than 43200. Example: 1440

tags   string[]  optional    

Optional new tags (replaces existing).

privacy_level   string  optional    

Optional new privacy level. Options: private, public. Example: public

ttl_hours   integer  optional    

Optional new TTL in hours. Example: 720

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Updated document

message   string     

Success message

Delete a knowledge document

requires authentication

Permanently delete a document, its embeddings, and associated files. This action cannot be undone.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": null,
    "message": "Knowledge document deleted successfully"
}
 

Example response (403, Unauthorized):


{
    "success": false,
    "error": "You do not have permission to delete this document"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Failed to delete document"
}
 

Request   

DELETE api/v1/knowledge/{document_id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 8

document   integer     

The document ID. Example: 1

Response

Response Fields

success   boolean     

Indicates if the request was successful

data        

null Always null for delete operations

message   string     

Success message

List knowledge documents

requires authentication

Retrieve knowledge documents with filtering and pagination. Returns public documents and the authenticated user's private documents. Supports filtering by content type, privacy level, processing status, tags, and TTL expiration.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": [
        {
            "id": 1,
            "title": "Laravel Documentation",
            "description": "Comprehensive Laravel guide",
            "content_type": "external",
            "privacy_level": "public",
            "processing_status": "completed",
            "url": "https://laravel.com/docs",
            "domain": "laravel.com",
            "tags": [
                {
                    "id": 1,
                    "name": "laravel"
                }
            ],
            "created_at": "2024-01-01T00:00:00Z",
            "updated_at": "2024-01-01T00:00:00Z"
        }
    ],
    "meta": {
        "current_page": 1,
        "per_page": 50,
        "total": 100
    }
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Failed to retrieve documents"
}
 

Request   

GET api/v1/knowledge

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

only_my_documents   boolean  optional    

Optional show only documents created by you. Defaults to false (shows public + yours). Example: false

content_type   string  optional    

Optional filter by content type. Options: text, file, external. Example: text

privacy_level   string  optional    

Optional filter by privacy. Options: private, public. Example: private

status   string  optional    

Optional filter by processing status. Options: pending, processing, completed, failed. Example: completed

tags   string[]  optional    

Optional filter by tag names.

include_expired   boolean  optional    

Optional include expired documents (past TTL). Defaults to false. Example: false

per_page   integer  optional    

Optional results per page (1-100). Defaults to 50. Example: 20

Body Parameters

page   integer  optional    

Must be at least 1. Example: 63

per_page   integer  optional    

Must be at least 1. Must not be greater than 100. Example: 23

search   string  optional    

Must not be greater than 255 characters. Example: fmvussyedclhvcv

content_type   string  optional    

Example: text

Must be one of:
  • text
  • file
  • external
status   string  optional    

Example: failed

Must be one of:
  • pending
  • processing
  • completed
  • failed
include_expired   boolean  optional    

Example: false

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   string[]     

Array of knowledge documents

id   integer     

Document ID

title   string     

Document title

description   string     

Document description

content_type   string     

Content type (text, file, external)

privacy_level   string     

Privacy level (private, public)

processing_status   string     

Processing status (pending, processing, completed, failed)

url   string     

URL for external documents (null for others)

domain   string     

Domain name for external documents

tags   string[]     

Associated tags

created_at   string     

Creation timestamp (ISO 8601)

updated_at   string     

Last update timestamp (ISO 8601)

meta   object     

Pagination metadata

List recent knowledge documents

requires authentication

Retrieve recently created knowledge documents. Returns up to 100 most recent completed documents that are either public or owned by the authenticated user. Excludes expired documents.

Example Usage

PWA (resources/js/pwa/knowledge-api.js) - Recent documents with offline support:

Example request:

Example response (200, Success):


{
    "success": true,
    "data": [
        {
            "id": 1,
            "title": "Laravel Documentation",
            "content_type": "external",
            "created_at": "2024-01-01T00:00:00Z"
        }
    ]
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Failed to retrieve recent documents"
}
 

Request   

GET api/v1/knowledge/recent

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

limit   integer  optional    

Optional maximum number of documents to return (1-100). Defaults to 20. Example: 50

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   string[]     

Array of recent documents (ordered by creation date, newest first)

Check if URL already exists

requires authentication

Check if a URL has already been added to your knowledge base. Useful for preventing duplicate document creation when importing external content.

Example request:

Example response (200, URL Exists):


{
    "success": true,
    "exists": true,
    "document": {
        "id": 1,
        "title": "Laravel Documentation",
        "url": "https://laravel.com/docs"
    }
}
 

Example response (200, URL Not Found):


{
    "success": true,
    "exists": false,
    "document": null
}
 

Example response (422, Missing URL):


{
    "success": false,
    "error": "VALIDATION_ERROR",
    "message": "URL parameter is required"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Failed to check URL"
}
 

Request   

GET api/v1/knowledge/check-url

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

url   string     

The URL to check. Example: https://laravel.com/docs

Response

Response Fields

success   boolean     

Indicates if the request was successful

exists   boolean     

Whether the URL exists in your knowledge base

document   object     

The existing document (null if not found)

View a knowledge document

requires authentication

Retrieve complete details for a specific knowledge document including content, metadata, tags, and embedding status.

Example Usage

PWA (resources/js/pwa/knowledge-api.js) - Document viewer with offline support:

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "id": 1,
        "title": "Laravel Documentation",
        "description": "Comprehensive guide",
        "content": "Laravel is a web application framework...",
        "content_type": "external",
        "privacy_level": "public",
        "processing_status": "completed",
        "url": "https://laravel.com/docs",
        "embedding_status": {
            "has_embeddings": true,
            "chunk_count": 150,
            "last_embedded_at": "2024-01-01T00:00:00Z"
        },
        "tags": [
            {
                "id": 1,
                "name": "laravel"
            }
        ],
        "created_at": "2024-01-01T00:00:00Z"
    }
}
 

Example response (403, Unauthorized):


{
    "success": false,
    "error": "You do not have permission to view this document"
}
 

Example response (500, Server Error):


{
    "success": false,
    "error": "Failed to retrieve document"
}
 

Request   

GET api/v1/knowledge/{document_id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 13

document   integer     

The document ID. Example: 1

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Complete document details

embedding_status   object     

Embedding generation status

has_embeddings   boolean     

Whether embeddings exist

chunk_count   integer     

Number of text chunks with embeddings

last_embedded_at   string     

Last embedding generation timestamp

Download a knowledge document file

requires authentication

Download the original uploaded file for file-type documents. Only available for documents created from file uploads.

Example request:

Example response (200, Success):


(binary file download)
 

Example response (403, Unauthorized):


Forbidden
 

Example response (404, Not a File):


File not found
 

Example response (404, File Missing):


File not found
 

Request   

GET api/v1/knowledge/{document_id}/download

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 7

document   integer     

The document ID. Example: 1

Get system-wide embedding status

requires authentication

Retrieve overall embedding statistics and status for all documents in the system. Shows counts of documents with/without embeddings and processing status.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "statistics": {
            "total_documents": 1000,
            "documents_with_embeddings": 950,
            "documents_without_embeddings": 50,
            "total_chunks": 15000,
            "avg_chunks_per_document": 15.8
        },
        "documents": [
            {
                "id": 1,
                "title": "Laravel Guide",
                "has_embeddings": true,
                "chunk_count": 150
            }
        ]
    }
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to retrieve embedding status"
}
 

Request   

GET api/v1/knowledge/embeddings/status

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Embedding status data

statistics   object     

System-wide embedding statistics

total_documents   integer     

Total documents in system

documents_with_embeddings   integer     

Documents that have embeddings

documents_without_embeddings   integer     

Documents missing embeddings

total_chunks   integer     

Total text chunks with embeddings

avg_chunks_per_document   number     

Average chunks per document

documents   string[]     

Array of documents with their embedding status

Get document embedding status

requires authentication

Retrieve embedding status for a specific document including chunk count and last generation time.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "has_embeddings": true,
        "chunk_count": 150,
        "last_embedded_at": "2024-01-01T00:00:00Z",
        "embedding_model": "text-embedding-ada-002"
    }
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (403, No Permission):


{
    "success": false,
    "error": "You do not have permission to view this document"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to retrieve embedding status"
}
 

Request   

GET api/v1/knowledge/embeddings/{document_id}/status

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

document_id   integer     

The ID of the document. Example: 16

document   integer     

The document ID. Example: 1

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Document embedding status

has_embeddings   boolean     

Whether document has embeddings

chunk_count   integer     

Number of text chunks with embeddings

last_embedded_at   string     

Last embedding generation timestamp (ISO 8601)

embedding_model   string     

Model used for embeddings

List all knowledge tags

requires authentication

Retrieve all knowledge tags ordered alphabetically by name.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": [
        {
            "id": 1,
            "name": "laravel",
            "description": "Laravel framework documentation",
            "color": "blue",
            "created_at": "2024-01-01T00:00:00Z"
        }
    ]
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to retrieve tags"
}
 

Request   

GET api/v1/knowledge/tags

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   string[]     

Array of tags ordered alphabetically

id   integer     

Tag ID

name   string     

Tag name

description   string     

Tag description

color   string     

Tag color (for UI display)

created_at   string     

Creation timestamp (ISO 8601)

Get agent's available documents

requires authentication

Retrieve all knowledge documents available to an agent. Includes both directly assigned documents and documents tagged with tags assigned to the agent.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "agent_id": 5,
        "documents": [
            {
                "id": 1,
                "title": "Laravel Guide",
                "tags": [
                    {
                        "id": 1,
                        "name": "laravel"
                    }
                ]
            }
        ],
        "assigned_tags": [
            {
                "id": 1,
                "name": "laravel"
            }
        ],
        "total_documents": 1
    }
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to retrieve agent knowledge"
}
 

Request   

GET api/v1/knowledge/agents/{agent}/documents

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

agent   integer     

The agent ID. Example: 5

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Agent knowledge data

agent_id   integer     

The agent ID

documents   string[]     

All documents available to the agent (direct assignments + tag-based)

assigned_tags   string[]     

Tags assigned to the agent (documents with these tags are included)

total_documents   integer     

Total number of unique documents available

Get knowledge base overview statistics

requires authentication

Retrieve comprehensive statistics about your knowledge documents including totals, processing status, content type breakdowns, and recent activity.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "total_documents": 1000,
        "completed_documents": 950,
        "failed_documents": 10,
        "processing_rate": 95,
        "embedding_completion_rate": 92.5,
        "content_types": {
            "text": 400,
            "file": 350,
            "external": 250
        },
        "recent_activity": 45,
        "embedding_service_status": {
            "enabled": true,
            "provider": "openai",
            "model": "text-embedding-ada-002"
        }
    }
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to retrieve statistics"
}
 

Request   

GET api/v1/knowledge/stats/overview

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Statistics data

total_documents   integer     

Total documents owned by user

completed_documents   integer     

Documents successfully processed

failed_documents   integer     

Documents that failed processing

processing_rate   number     

Success rate percentage (0-100)

embedding_completion_rate   number     

Percentage of documents with embeddings

content_types   object     

Document count by content type (text, file, external)

recent_activity   integer     

Documents created in last 7 days

embedding_service_status   object     

Embedding service configuration

enabled   boolean     

Whether embedding service is enabled

provider   string     

Embedding provider (openai, cohere, etc.)

model   string     

Model name used for embeddings

Get embedding statistics

requires authentication

Retrieve detailed statistics about embedding coverage and service configuration.

Example request:

Example response (200, Success):


{
    "success": true,
    "data": {
        "total_documents": 1000,
        "documents_with_embeddings": 925,
        "documents_without_embeddings": 75,
        "completion_rate": 92.5,
        "total_chunks": 15000,
        "avg_chunks_per_document": 16.2,
        "embedding_service_enabled": true,
        "embedding_provider": "openai",
        "embedding_model": "text-embedding-ada-002"
    }
}
 

Example response (403, Missing Ability):


{
    "success": false,
    "error": "Unauthorized"
}
 

Example response (500, Failed):


{
    "success": false,
    "error": "Failed to retrieve embedding statistics"
}
 

Request   

GET api/v1/knowledge/stats/embeddings

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Response

Response Fields

success   boolean     

Indicates if the request was successful

data   object     

Embedding statistics

total_documents   integer     

Total documents in system

documents_with_embeddings   integer     

Documents that have embeddings

documents_without_embeddings   integer     

Documents missing embeddings

completion_rate   number     

Percentage with embeddings (0-100)

total_chunks   integer     

Total text chunks with embeddings

avg_chunks_per_document   number     

Average chunks per document

embedding_service_enabled   boolean     

Whether embedding service is enabled

embedding_provider   string     

Embedding provider name

embedding_model   string     

Model used for embeddings

Output Actions

View execution logs and audit trails for output actions. Output actions are automated webhooks triggered by agent executions.

Use Cases

Authentication

Required token abilities:

Log Retention

Logs are retained for up to 365 days and can be filtered by date range.

List execution logs for an output action

requires authentication

Retrieve paginated execution logs with filtering and statistics for a specific output action. Useful for debugging, compliance reporting, and monitoring webhook delivery success rates.

Example request:

Example response (200, Success with logs):


{
    "success": true,
    "action": {
        "id": 1,
        "name": "Slack Notification",
        "type": "webhook",
        "status": "active"
    },
    "stats": {
        "total_executions": 100,
        "successes": 95,
        "failures": 4,
        "timeouts": 1,
        "success_rate": 95,
        "avg_duration_ms": 245.3,
        "last_executed_at": "2024-01-01T12:00:00Z",
        "period_days": 30
    },
    "logs": {
        "data": [
            {
                "id": 123,
                "status": "success",
                "response_code": 200,
                "duration_ms": 234,
                "executed_at": "2024-01-01T12:00:00Z"
            }
        ],
        "current_page": 1,
        "per_page": 50,
        "total": 100
    }
}
 

Example response (403, Not Action Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to view this action"
}
 

Request   

GET api/v1/output-actions/{action_id}/logs

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

action_id   string     

The ID of the action. Example: adipisci

action   integer     

The output action ID. Example: 1

Query Parameters

status   string  optional    

Optional filter by execution status. Options: success, failed, timeout. Example: success

days   integer  optional    

Optional filter by recent days (1-365). Defaults to 30. Example: 7

per_page   integer  optional    

Optional results per page (1-100). Defaults to 50. Example: 20

Response

Response Fields

success   boolean     

Indicates if the request was successful

action   object     

Output action details

id   integer     

Action ID

name   string     

Action name

type   string     

Provider type (webhook, slack, email)

status   string     

Action status (active, inactive)

stats   object     

Execution statistics for the specified period

total_executions   integer     

Total executions in period

successes   integer     

Number of successful executions

failures   integer     

Number of failed executions

timeouts   integer     

Number of timeout executions

success_rate   number     

Success percentage (0-100)

avg_duration_ms   number     

Average execution duration in milliseconds

last_executed_at   string     

Last execution timestamp (ISO 8601) or null

period_days   integer     

Number of days included in statistics

logs   object     

Paginated execution logs

data   string[]     

Array of log entries

current_page   integer     

Current page number

per_page   integer     

Results per page

total   integer     

Total number of logs

List all execution logs across all actions

requires authentication

Retrieve execution logs across all output actions owned by the authenticated user. Supports filtering by action, status, and date range.

Example request:

Example response (200, Success):


{
    "success": true,
    "logs": {
        "data": [
            {
                "id": 123,
                "output_action": {
                    "id": 1,
                    "name": "Slack Notification"
                },
                "status": "success",
                "response_code": 200,
                "duration_ms": 234,
                "executed_at": "2024-01-01T12:00:00Z"
            }
        ],
        "current_page": 1,
        "per_page": 50,
        "total": 250
    }
}
 

Request   

GET api/v1/output-action-logs

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

action_id   integer  optional    

Optional filter by specific output action ID. Example: 1

status   string  optional    

Optional filter by execution status. Options: success, failed, timeout. Example: failed

days   integer  optional    

Optional filter by recent days (1-365). Defaults to 7. Example: 30

per_page   integer  optional    

Optional results per page (1-100). Defaults to 50. Example: 20

Response

Response Fields

success   boolean     

Indicates if the request was successful

logs   object     

Paginated execution logs across all actions

data   string[]     

Array of log entries with nested output_action, user, and triggerable details

current_page   integer     

Current page number

per_page   integer     

Results per page

total   integer     

Total number of logs matching filters

View a specific execution log

requires authentication

Retrieve complete details for a single output action execution log including request/response data, headers, timing information, and error details.

Example request:

Example response (200, Success):


{
    "success": true,
    "log": {
        "id": 123,
        "output_action": {
            "id": 1,
            "name": "Slack Notification",
            "type": "webhook"
        },
        "user": {
            "id": 10,
            "name": "John Doe"
        },
        "triggerable": {
            "type": "App\\Models\\AgentExecution",
            "id": 456
        },
        "url": "https://hooks.slack.com/services/...",
        "method": "POST",
        "headers": {
            "Content-Type": "application/json"
        },
        "body": {
            "text": "Agent completed successfully"
        },
        "status": "success",
        "response_code": 200,
        "response_body": {
            "ok": true
        },
        "error_message": null,
        "duration_ms": 234,
        "executed_at": "2024-01-01T12:00:00Z",
        "created_at": "2024-01-01T12:00:00Z"
    }
}
 

Example response (403, Not Log Owner):


{
    "success": false,
    "error": "Forbidden",
    "message": "You do not have permission to view this log"
}
 

Request   

GET api/v1/output-action-logs/{log_id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

log_id   integer     

The ID of the log. Example: 5

log   integer     

The log entry ID. Example: 123

Response

Response Fields

success   boolean     

Indicates if the request was successful

log   object     

Complete log entry details

id   integer     

Log entry ID

output_action   object     

Output action that was executed

id   integer     

Action ID

name   string     

Action name

type   string     

Provider type

user   object     

User who triggered the action (null for system triggers)

triggerable   object     

The model that triggered this action (agent execution, chat interaction, etc.)

type   string     

Model class name

id   integer     

Model ID

url   string     

Target URL that was called

method   string     

HTTP method used (POST, GET, etc.)

headers   object     

Request headers sent

body   object     

Request body sent

status   string     

Execution status (success, failed, timeout)

response_code   integer     

HTTP response code received (null on timeout)

response_body   object     

Response body received (null on failure/timeout)

error_message   string     

Error description (null on success)

duration_ms   integer     

Execution duration in milliseconds

executed_at   string     

Execution timestamp (ISO 8601)

created_at   string     

Log creation timestamp (ISO 8601)

Public Access

Read-only access to publicly shared chat sessions. No authentication required - accessible to anyone with a valid share link.

Retrieve public chat session by UUID

Retrieve a chat session that has been shared publicly via its UUID. Returns the full conversation history with all interactions, sources, and metadata.

Example request:

Example response (200, Success):


{
    "success": true,
    "session": {
        "uuid": "9d4e1c23-5f2b-4d3e-8a9c-0b1a2c3d4e5f",
        "title": "My Research Session",
        "shared_at": "2024-01-01T00:00:00.000000Z",
        "expires_at": "2024-02-01T00:00:00.000000Z",
        "interaction_count": 5,
        "created_at": "2024-01-01T00:00:00.000000Z"
    },
    "interactions": [
        {
            "id": 1,
            "question": "What is the capital of France?",
            "answer": "Paris is the capital of France...",
            "agent_name": "Research Agent",
            "sources": [],
            "created_at": "2024-01-01T00:00:00.000000Z"
        }
    ]
}
 

Example response (404, Not found or not public):


{
    "success": false,
    "error": "Not Found",
    "message": "This session is not publicly accessible or has expired"
}
 

Request   

GET api/public/sessions/{uuid}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

uuid   string     

The session's unique identifier (UUID). Example: 9d4e1c23-5f2b-4d3e-8a9c-0b1a2c3d4e5f

Utility

Utility endpoints for URL validation, metadata extraction, and link previews. Used internally by the UI but available for API integration.

Rate Limiting

requires authentication

Validate a URL and extract rich metadata including title, description, images, and Open Graph tags. Useful for generating link previews and validating external URLs before processing.

Security: URL validation includes checks for private IP ranges, localhost, and suspicious schemes to prevent SSRF attacks.

Example request:

Example response (200, Success):


{
    "valid": true,
    "url": "https://example.com/article",
    "title": "Example Article",
    "description": "An interesting article about...",
    "image": "https://example.com/og-image.jpg",
    "domain": "example.com",
    "metadata": {
        "og:title": "Example Article",
        "og:description": "An interesting article...",
        "og:image": "https://example.com/og-image.jpg",
        "twitter:card": "summary_large_image"
    }
}
 

Example response (200, Invalid URL):


{
    "valid": false,
    "error": "Invalid URL format",
    "url": "not-a-valid-url"
}
 

Example response (200, Unreachable URL):


{
    "valid": false,
    "error": "URL is not reachable",
    "url": "https://nonexistent-domain-12345.com"
}
 

Example response (422, Validation Failed):


{
    "message": "The url field is required.",
    "errors": {
        "url": [
            "The url field is required."
        ]
    }
}
 

Response

Response Fields

valid   boolean     

Whether the URL is valid and reachable

url   string     

The validated URL (normalized)

title   string     

Page title extracted from HTML or Open Graph tags

description   string     

Page description from meta tags or Open Graph

image   string     

Primary image URL (og:image, twitter:image, or first image)

domain   string     

Domain name extracted from URL

metadata   object     

Raw metadata extracted (Open Graph, Twitter Card, etc.)

error   string     

Error message if validation failed (only present when valid=false)

Webhooks

Invoke input triggers via webhooks using HMAC signature authentication. Webhooks provide an alternative to API tokens for automated trigger invocation from external systems.

Authentication

Webhooks use HMAC-SHA256 signature validation instead of Sanctum tokens:

Signature Generation:

payload = timestamp + ":" + nonce + ":" + request_body
signature = HMAC-SHA256(payload, secret_key)

Trigger Types

Rate Limiting

Use Cases

Invoke webhook trigger

Execute an input trigger via webhook invocation. The trigger processes the webhook payload asynchronously and returns immediately with a 202 Accepted response.

Agent Triggers: Webhook payload is passed as the chat input to the agent. Command Triggers: Webhook payload parameters are mapped to command arguments.

Security: All requests must include valid HMAC signature headers or will be rejected with 401 Unauthorized. Disabled triggers return 403 Forbidden.

Example request:

Example response (202, Agent Trigger Accepted):


{
    "success": true,
    "message": "Webhook received and processing",
    "invocation_id": "inv_abc123",
    "session_id": 1,
    "interaction_id": 5,
    "status": "dispatched",
    "status_url": "/api/status/inv_abc123",
    "chat_url": "/chat/1"
}
 

Example response (202, Command Trigger Accepted):


{
    "success": true,
    "message": "Command execution dispatched",
    "trigger_id": 1,
    "trigger_type": "command",
    "command_class": "App\\Console\\Commands\\ProcessData",
    "status": "dispatched",
    "queue": "research-coordinator"
}
 

Example response (400, Invalid Trigger Type):


{
    "success": false,
    "error": "Invalid Endpoint",
    "message": "This trigger does not accept webhook invocations"
}
 

Example response (401, Invalid Signature):


{
    "success": false,
    "error": "Validation Failed",
    "message": "HMAC signature verification failed"
}
 

Example response (403, Trigger Disabled):


{
    "success": false,
    "error": "Trigger Disabled",
    "message": "This webhook endpoint is currently disabled"
}
 

Example response (422, Invalid Input):


{
    "success": false,
    "error": "Invalid Input",
    "message": "Missing required parameter: repository"
}
 

Example response (500, Processing Failed):


{
    "success": false,
    "error": "Processing Failed",
    "message": "An error occurred while processing the webhook"
}
 

Request   

POST webhooks/triggers/{trigger_id}

Headers

X-Webhook-Signature        

Example: required HMAC-SHA256 signature of the request. Example: a1b2c3d4e5f6...

X-Webhook-Timestamp        

Example: required Unix timestamp when request was created. Example: 1704067200

X-Webhook-Nonce        

Example: required Unique identifier for this request (prevents replay). Example: uuid-1234-5678

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

trigger_id   string     

The ID of the trigger. Example: fugit

trigger   integer     

The trigger ID or slug. Example: 1

Body Parameters

*   mixed  optional    

Webhook payload (format depends on trigger type). Agent triggers accept any JSON. Command triggers expect specific parameters defined by the command. Example: {"repository": "owner/repo", "event": "push", "branch": "main"}

Response

Response Fields

success   boolean     

Indicates if the webhook was accepted

message   string     

Human-readable status message

invocation_id   string     

Unique invocation identifier (agent triggers only)

session_id   integer     

Chat session ID (agent triggers only)

interaction_id   integer     

Chat interaction ID (agent triggers only)

status   string     

Processing status (dispatched, queued)

status_url   string     

URL to check execution status (agent triggers only)

chat_url   string     

URL to view chat session (agent triggers only)

trigger_id   integer     

Trigger ID (command triggers only)

trigger_type   string     

Trigger type (command triggers only)

command_class   string     

Command class name (command triggers only)

queue   string     

Queue name where job was dispatched (command triggers only)

Test webhook connectivity

Ping endpoint to verify webhook configuration and accessibility. Use this to test webhook URLs, verify trigger status, and confirm HMAC signature validation works.

Unlike the main webhook endpoint, ping does not execute the trigger or require HMAC signature validation, making it safe for testing and health checks.

Example request:

Example response (200, Success):


{
    "success": true,
    "message": "Webhook endpoint is reachable",
    "trigger": {
        "name": "GitHub Push Webhook",
        "is_active": true,
        "last_invoked_at": "2024-01-01T12:00:00Z"
    }
}
 

Example response (400, Not a Webhook Trigger):


{
    "success": false,
    "error": "Invalid Endpoint",
    "message": "This is not a webhook trigger"
}
 

Request   

GET webhooks/triggers/{trigger_id}/ping

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

trigger_id   string     

The ID of the trigger. Example: enim

trigger   integer     

The trigger ID or slug. Example: 1

Response

Response Fields

success   boolean     

Indicates if the endpoint is reachable

message   string     

Confirmation message

trigger   object     

Trigger information

name   string     

Trigger name

is_active   boolean     

Whether trigger is currently active

last_invoked_at   string     

Last invocation timestamp (ISO 8601, null if never invoked)