frappe-syntax-whitelisted

Enforce Frappe whitelist decorator syntax, permissions, and input handling for HTTP API endpoints.

163|53|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-syntax-whitelisted-impertio-studio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frappe-syntax-whitelisted
Source: https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package/tree/main/skills/source/syntax/frappe-syntax-whitelisted
Command: npx skills add https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-syntax-whitelisted-impertio-studio

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents production failures when exposing Frappe Whitelisted Methods as HTTP API endpoints by enforcing correct syntax, permissions, input handling, and safe response patterns.

Core Features & Use Cases

  • Whitelisted Method Construction: Use @frappe.whitelist with the correct decorator parameters and endpoint routing conventions for API-method URLs.
  • Permission-Safe API Design: Apply frappe.only_for and frappe.has_permission checks inside every whitelisted method to ensure proper authorization (not just authentication).
  • Robust Request/Response Handling: Validate and coerce request inputs (including JSON parsing), map errors to safe outputs, and return correctly structured results for client and external REST calls.
  • Client-Server Calling Patterns: Follow frappe.call, frm.call, and REST/cURL conventions for reliable invocation and predictable return shapes.

Quick Start

Use the frappe-syntax-whitelisted skill to write a production-ready @frappe.whitelist endpoint named myapp.api.get_customer_summary that supports GET, validates inputs, checks Customer read permission, and returns only non-sensitive customer fields.

Frequently Asked Questions about frappe-syntax-whitelisted

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure Frappe whitelisted methods for HTTP API endpoints?

To secure Frappe whitelisted methods, apply frappe.has_permission or frappe.only_for checks inside every endpoint to enforce proper authorization, rather than relying solely on user authentication. This prevents unauthorized access to sensitive data.

What is the correct way to use the @frappe.whitelist decorator for public endpoints?

The @frappe.whitelist decorator configures public endpoints by passing the allow_guest parameter. This explicitly exposes the method as a public HTTP API, bypassing standard authentication requirements for unauthenticated external REST calls.

How do I validate JSON request inputs in a Frappe API method?

You validate JSON request inputs in a Frappe API method through explicit parameter parsing and data coercion before processing. Safe error handling with frappe.throw ensures predictable response formats when clients submit invalid data.

How do I call Frappe whitelisted methods from a JavaScript client?

You call Frappe whitelisted methods from a JavaScript client using the frappe.call or frm.call functions. These handle /api/method routing automatically and parse the structured response formats returned by your whitelisted Python functions.

Why does my Frappe whitelisted method return unexpected response formats?

Frappe whitelisted methods return unexpected response formats when inputs are not explicitly parsed and coerced, or when errors are unhandled. Using frappe.log_error patterns and returning structured dictionaries ensures predictable client-server integration.

Can I expose document controller actions as Frappe REST API endpoints?

Yes, you can expose document controller actions as Frappe REST API endpoints by applying the @frappe.whitelist decorator. You must enforce frappe.has_permission checks within the controller to maintain strict document-level authorization.