Skip to main content

@api Decorator

Attach the @api decorator to Model or Frame class methods to create REST API endpoints.Basic usage:
Auto-generated endpoints:
httpMethod (required):
guards (authentication/authorization):
Creating Public APIs: Omit the guards option to create a public API accessible to anyone without authentication. Use this for endpoints that don’t require login or permission checks.
path (custom path):
Query parameters (single values):
Query parameters (object):
Single object:
Multiple parameters:
The @upload decorator is used independently without @api.Single file:
Multiple files:
BadRequestException (400):
UnauthorizedException (401):
Permission error (403):
NotFoundException (404):

Context and Session

userId/ip/userAgent are not top-level properties on Context. Use context.user?.id, context.request.ip, and context.headers["user-agent"] respectively.
Session configuration:
Save session:
Read session:
Delete session:

Authentication and Authorization

Guard configuration:
Using Guards:

Response Format

Default response:
Custom response:
Setting headers:
Using ListResult:

Frontend Integration

Service files auto-generated:When Model files change, {entity}.service.ts is auto-generated.
Using in React:
Using TanStack Query hooks: