Skip to Content
API Reference

API Reference

Complete reference for types and interfaces used in AgentPress Next.js.

Types

Method

Defines an API method that AgentPress can discover and use.

type Method = { method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; name: string; description: string; params?: ZodObject<any>; paramsType?: "query" | "body"; };

Properties:

PropertyTypeRequiredDescription
methodstringYesHTTP method (GET, POST, PUT, PATCH, DELETE)
namestringYesUnique identifier for this method
descriptionstringYesHuman-readable description (used by AI)
paramsZod SchemaNoZod schema for request parameters
paramsTypestringNoWhere params are sent: “body” or “query” (defaults to “body”)

Example:

const method: Method = { method: "POST", name: "createUser", description: "Create a new user account", params: z.object({ name: z.string(), email: z.string().email(), }), paramsType: "body", };

AuthTokenObject

Configuration for authentication token transmission.

type AuthTokenObject = { type: "header" | "query"; key: string; value: string; };

Properties:

PropertyTypeDescription
type”header” | “query”How to send the token
keystringHeader name or query parameter name
valuestringThe actual token value

Examples:

// Bearer token in Authorization header const auth: AuthTokenObject = { type: "header", key: "Authorization", value: "Bearer token_abc123", }; // Custom API key header const auth: AuthTokenObject = { type: "header", key: "X-API-Key", value: "key_xyz789", }; // Token in query parameter const auth: AuthTokenObject = { type: "query", key: "token", value: "token_abc123", };

Component Props

AgentpressChat Props

interface AgentpressChatProps { projectId: string; authToken?: string | AuthTokenObject; apiEndpoint?: string; onToolCall?: (tools: string[]) => void; }

Properties:

PropertyTypeRequiredDefaultDescription
projectIdstringYes-Your AgentPress project ID
authTokenstring | AuthTokenObjectNoundefinedAuthentication token for API calls
apiEndpointstringNohttps://agentpress.netlify.app/api/chat Custom API endpoint
onToolCallfunctionNoundefinedCallback when tools are executed

ChatInput Props

interface ChatInputProps { onSubmit: (prompt: string) => void; placeholder?: string; disabled?: boolean; }

Environment Variables

Required

AGENTPRESS_SECRET_KEY="your-secret-key"

Your AgentPress project’s secret key for syncing methods. Get this from your project settings.

Optional

NEXT_PUBLIC_AGENTPRESS_API_BASE_URL="https://api.example.com"

Custom API base URL. Only set if self-hosting or using a custom AgentPress instance.

Last updated on