Functions API
The Kapso Functions API allows you to programmatically create, manage, deploy, and invoke serverless functions. Choose between Cloudflare Workers for high-performance edge computing or Supabase Functions for database-integrated serverless functions.Overview
Functions in Kapso are serverless JavaScript functions that can be invoked via HTTP. They are perfect for:- Processing webhooks
- Data transformations
- Custom business logic
- Integration with external services
- Background processing
- Database operations (with Supabase Functions)
- User authentication workflows (with Supabase Functions)
Authentication
All Functions API endpoints require authentication via API key. Include your API key in theX-API-Key header:
Base URL
All API endpoints are relative to:Key Concepts
Function Types
Functions can be deployed to different platforms:- cloudflare_worker (default): Deploys to Cloudflare Workers with global edge distribution
- supabase_function: Deploys to Supabase Functions with direct database access
Function Status
Functions can be in one of three states:- draft: Function is created but not deployed
- deployed: Function is deployed and can be invoked
- error: Function deployment failed
Function Code
Cloudflare Workers Format
Supabase Functions Format
Deployment
Functions must be deployed before they can be invoked. Deployment is asynchronous - the API returns immediately and deployment happens in the background.Common Operations
Create a Function
Deploy a Function
Deployment works the same for both function types - the platform is determined by the function’sfunction_type:
Invoke a Function
Function invocation works the same regardless of platform - requests are automatically routed to the appropriate function type:Rate Limits
Function invocations are tracked for billing purposes. Rate limits depend on your subscription plan.Error Handling
The API uses standard HTTP status codes:200- Success201- Created204- No Content (for DELETE)400- Bad Request401- Unauthorized404- Not Found422- Unprocessable Entity (e.g., “Function is not deployed” or “Supabase project required for Supabase functions”)500- Internal Server Error
error field:

