Kensa
API Reference

API Overview

Overview of the Kensa REST API, including authentication, base URL, and request conventions.

API Overview

The Kensa REST API allows you to programmatically generate videos, manage credits, and receive real-time notifications through webhooks.

Base URL

https://your-domain.com/api/v1

All API endpoints are prefixed with /api/v1.

Authentication

All API requests require authentication via session cookies. When calling from a browser, include credentials:

const response = await fetch('/api/v1/video/generate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  credentials: 'include',
  body: JSON.stringify({ /* ... */ })
});

The API uses Better Auth for session management. Users must be logged in with an active session to access API endpoints.

Authentication Errors

Status CodeMeaning
401Not authenticated -- no valid session found
403Forbidden -- insufficient permissions (e.g., non-admin accessing admin endpoints)

Request Format

  • All request bodies must be JSON with Content-Type: application/json.
  • Query parameters are used for GET requests.
  • All responses return JSON.

Response Format

Success Response

{
  "success": true,
  "data": { /* response data */ }
}

Error Response

{
  "success": false,
  "error": "Error message describing what went wrong"
}

Available Endpoints

EndpointMethodDescription
/api/v1/video/generatePOSTStart video generation
/api/v1/video/listGETList user's videos
/api/v1/video/[uuid]GETGet video details
/api/v1/video/[uuid]DELETEDelete a video
/api/v1/video/taskGETGet generation task status
/api/v1/credit/historyGETGet credit transaction history
/api/v1/config/modelsGETGet available AI models
/api/v1/video/callback/[provider]POSTAI provider webhook callback

Rate Limiting

API requests are subject to rate limiting to ensure fair usage. If you exceed the rate limit, you will receive a 429 Too Many Requests response. Wait and retry after the period indicated in the response headers.

Pagination

List endpoints support pagination via query parameters:

GET /api/v1/video/list?page=1&pageSize=20
ParameterTypeDefaultDescription
pagenumber1Page number (1-indexed)
pageSizenumber20Items per page
API Overview | Kensa