API

The REST API is enabled by running the vela enable api command, or by modifying the hooks.server.ts file. This exposes the PocketBase REST API at /api. Any SvelteKit API routes in the src/routes/api directory are served alongside the PocketBase API.

Syntax

$ vela enable api

API Configuration

The API is configured in the hooks.server.ts file. The default configuration is:

import { handlePocketbase } from '@vela/pocketbase';

export const handle = handlePocketbase({
    api: {
        enabled: true
    }
});

PocketBase API Routes

The following PocketBase API routes are exposed and take precedence over any SvelteKit API routes.

/api/batch
/api/collections
/api/realtime
/api/files
/api/settings
/api/logs
/api/crons
/api/backups
/api/health