api-development

Build REST and RPC APIs in Frappe with authentication, permissions, and rate limiting.

62|23|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/lubusIN/frappe-skills --skill api-development-lubusin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-development
Source: https://github.com/lubusIN/frappe-skills/tree/main/api-development
Command: npx skills add https://github.com/lubusIN/frappe-skills --skill api-development-lubusin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developers building APIs on the Frappe framework often miss critical permission checks in whitelisted methods, misuse authentication patterns, or expose endpoints without proper validation, leading to security vulnerabilities and broken integrations. ## Core Features & Use Cases - REST and RPC Patterns: Guidance on using built-in REST endpoints for DocType CRUD versus custom @frappe.whitelist RPC methods for business logic. - Authentication & Permissions: Covers token-based auth, OAuth 2.0 flows, session auth, and explicit permission checks with frappe.has_permission. - Production Hardening: Includes rate limiting, input validation, background job offloading, and structured error handling. - Use Case: You need to expose a custom order approval endpoint to an external system. This Skill walks you through creating a whitelisted method, verifying document permissions, validating inputs, and securing it with API key authentication. ## Quick Start Use the api-development skill to create a whitelisted Frappe endpoint that processes an order with proper permission checks and token authentication.

Frequently Asked Questions about api-development

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

FAQPage Schema
How do I create a custom API endpoint in Frappe?▼

Create a custom Frappe API endpoint by decorating a Python function with @frappe.whitelist() and calling it via /api/method/your_app.module.function. Add allow_guest=True for public access, and always check permissions explicitly inside the method.

How do I authenticate Frappe REST API requests?▼

Frappe REST API authentication supports token-based auth using the header 'Authorization: token api_key:api_secret', Basic auth with base64-encoded credentials, OAuth 2.0 Bearer tokens, and session cookies for logged-in users.

When should I use REST API vs RPC whitelisted methods in Frappe?▼

Use the built-in REST API (/api/resource/DocType) for standard DocType CRUD operations since it enforces permissions automatically. Use RPC whitelisted methods for custom actions, workflows, or operations that do not map to a single document resource.

Why does my Frappe whitelisted method return Method not found?▼

The Method not found error occurs when the @frappe.whitelist() decorator is missing or the module path in the URL does not match the Python path. Verify the decorator is present and the dotted path matches your app structure.

How do I rate limit a public Frappe API endpoint?▼

Apply the @rate_limit decorator from frappe.rate_limiter with limit and seconds parameters, such as @rate_limit(limit=100, seconds=60). You can also build custom Redis-based limiters with per-user or per-API-key keys for tiered access.

Do whitelisted methods in Frappe check permissions automatically?▼

No, whitelisted RPC methods bypass automatic DocType permission checks. You must explicitly call frappe.has_permission() inside the method and throw frappe.PermissionError when access should be denied.