agentHub
API

อ้างอิง API

เอกสาร REST API ครบถ้วนสำหรับการรวม AILoft

URL ฐาน
การยืนยันตัวตน
การตอบกลับ JSON

การยืนยันตัวตน

คำขอทั้งหมดต้องมี API Key ใน Authorization Header เป็น Bearer Token

// Header
Authorization: Bearer your-api-token

เก็บ API Key เป็นความลับ อย่าเปิดเผยในโค้ดฝั่งไคลเอนต์

Endpoint

GET/api/agentsแสดง Agent ที่ใช้ได้ทั้งหมดพร้อม Metadata คะแนน และราคา

พารามิเตอร์

categorystringFilter by category (Development, Analytics, Legal, ...)
searchstringSearch in name, description and tags
backendstringFilter by compatible backend (e.g. openai, claude, ollama)
pricingstringFilter: "free" or "paid"
sortstringSort: popular, newest, rating (default: newest)
pagenumberPage number (default: 1)
limitnumberResults per page (1–50, default: 12)
การตอบกลับ: { agents: Agent[], total: number, page: number }
GET/api/agents/:slugดูข้อมูลรายละเอียดของ Agent เฉพาะ

พารามิเตอร์

slugstringUnique agent slug (URL param)
การตอบกลับ: { ...AgentDetail, author: { id, name, username }, reviews: Review[] }
GET/api/agents/:slug/reviewsดูรีวิวแบบแบ่งหน้าของ Agent

พารามิเตอร์

slugstringAgent slug (URL param)
pagenumberPage number (default: 1)
limitnumberResults per page (1–50, default: 10)
การตอบกลับ: { reviews: Review[], total: number, page: number }
GET/api/agents/:slug/similarGet similar agents from the same category.

พารามิเตอร์

slugstringAgent slug (URL param)
การตอบกลับ: { agents: Agent[] }
POST/api/agents/:slug/installติดตั้ง Agent แบบเสียเงิน หักจากกระเป๋าเงิน

พารามิเตอร์

slugstringAgent slug (URL param)
backendstringTarget backend (default: "openai")
การตอบกลับ: { success: boolean, message: string, config: InstallConfig }
POST/api/agents/install-freeติดตั้ง Agent ฟรี ต้องยืนยันตัวตน

พารามิเตอร์

agentSlugstringAgent slug (body)
emailstringEmail for delivery (body)
การตอบกลับ: { ok: boolean }
POST/api/agents/:slug/reviews🔒ส่งรีวิวสำหรับ Agent ที่ติดตั้งแล้ว

พารามิเตอร์

ratingnumberRating 1–5 (required)
commentstringReview text (optional)
การตอบกลับ: { id, rating, comment, agentId, userId, createdAt }
GET/api/payments/wallet🔒ดูยอดคงเหลือกระเป๋าเงินและประวัติธุรกรรม
การตอบกลับ: { balance, totalEarned, totalWithdrawn, available, stripeAccountStatus }

ประเภทข้อมูล

Agent

id: string
slug: string
name: string
description: string
icon: string | null
category: string
agentType: "prompt_based" | "app_ui"
compatible: string[]
tags: string[]
pricing: { type: "one_time", amount?: number }
rating: number
installs: number
isFeatured: boolean
createdAt: string (ISO 8601)
author: { id: string, name: string }

Review

id: string
rating: number (1–5)
comment: string | null
agentId: string
userId: string
user: { name, username, avatarUrl }
createdAt: string (ISO 8601)