Skip to main content

Introduction

In addition to the GraphQL API, PentAGI provides REST endpoints for specific operations like authentication, terminal logs, and provider management.

Base URL

All REST endpoints are prefixed with:
https://your-server/api/v1

Authentication

REST endpoints use the same session-based authentication as the GraphQL API. Include the session cookie with all requests:
curl https://your-server/api/v1/flows \
  -H "Cookie: auth=your-session-cookie"

Response Format

Successful responses follow this structure:
{
  "success": true,
  "data": {
    // Response data
  }
}
Error responses:
{
  "error": "error_code",
  "message": "Human-readable error message"
}

Common HTTP Status Codes

CodeDescription
200Success
201Created
400Bad Request - Invalid parameters
401Unauthorized - Authentication required
403Forbidden - Insufficient permissions
404Not Found
500Internal Server Error

Available Endpoints

Authentication

Auth Endpoints

Login, logout, and session management

Flow Management

GET    /api/v1/flows
GET    /api/v1/flows/:flowID
POST   /api/v1/flows
PUT    /api/v1/flows/:flowID
DELETE /api/v1/flows/:flowID
GET    /api/v1/flows/:flowID/graph

Task Management

GET    /api/v1/flows/:flowID/tasks
GET    /api/v1/flows/:flowID/tasks/:taskID
GET    /api/v1/flows/:flowID/tasks/:taskID/graph

Terminal Logs

Terminal Log Endpoints

Access command execution logs

Provider Management

Provider Endpoints

Manage LLM provider configurations

Containers

GET    /api/v1/containers
GET    /api/v1/flows/:flowID/containers
GET    /api/v1/flows/:flowID/containers/:containerID

Screenshots

GET    /api/v1/screenshots
GET    /api/v1/flows/:flowID/screenshots
GET    /api/v1/flows/:flowID/screenshots/:screenshotID
GET    /api/v1/flows/:flowID/screenshots/:screenshotID/file

Query Parameters

Many list endpoints support query parameters for filtering, sorting, and pagination:
page
integer
default:"1"
Page number for pagination
limit
integer
default:"50"
Number of items per page
sort
string
default:"created_at"
Field to sort by
order
string
default:"desc"
Sort order: asc or desc
filter
string
Filter expression for search

Example

curl "https://your-server/api/v1/flows?page=1&limit=20&sort=updated_at&order=desc" \
  -H "Cookie: auth=your-session-cookie"

Swagger Documentation

Interactive API documentation is available via Swagger UI:
https://your-server/api/v1/swagger/index.html
Use the Swagger interface to test REST endpoints directly from your browser.

Next Steps

Terminal Logs

Access command execution logs via REST

Provider Management

Manage LLM providers via REST

Build docs developers (and LLMs) love