Loading...
Loading...
Complete guide for ERPNext/Frappe API integrations (v14/v15/v16) including REST API, RPC API, authentication, webhooks, and rate limiting. Use when code is needed for external API calls to ERPNext, designing API endpoints, configuring webhooks, implementing authentication (token/OAuth2/session). Triggers: API integration, REST endpoint, webhook, token authentication, OAuth, frappe.call, external connection, API response, rate limiting.
npx skill4agent add openaec-foundation/erpnext_anthropic_claude_development_skill_package erpnext-api-patternsWhat do you want to achieve?
│
├─► CRUD operations on documents
│ └─► REST API: /api/resource/{doctype}
│
├─► Call custom business logic
│ └─► RPC API: /api/method/{path}
│
├─► Notify external systems on events
│ └─► Configure Webhooks
│
└─► Client-side server calls (JavaScript)
└─► frappe.call() or frappe.xcall()# Token Auth (RECOMMENDED for integrations)
headers = {
'Authorization': 'token api_key:api_secret',
'Accept': 'application/json',
'Content-Type': 'application/json'
}
# Bearer Token (OAuth2)
headers = {'Authorization': 'Bearer {access_token}'}| Operation | Method | Endpoint |
|---|---|---|
| List | | |
| Create | | |
| Read | | |
| Update | | |
| Delete | | |
# Basic filters
filters = [["status", "=", "Open"]]
filters = [["amount", ">", 1000]]
filters = [["status", "in", ["Open", "Pending"]]]
filters = [["date", "between", ["2024-01-01", "2024-12-31"]]]
filters = [["reference", "is", "set"]] # NOT NULL# Server-side: mark with decorator
@frappe.whitelist()
def my_function(param1, param2):
return {"result": "value"}
# API call
POST /api/method/my_app.api.my_function
{"param1": "value1", "param2": "value2"}// Async/await pattern (RECOMMENDED)
const result = await frappe.xcall('my_app.api.my_function', {
param1: 'value'
});
// Promise pattern
frappe.call({
method: 'my_app.api.my_function',
args: {param1: 'value'},
freeze: true,
freeze_message: __('Processing...')
}).then(r => console.log(r.message));{"data": {...}}{"message": "return_value"}{
"exc_type": "ValidationError",
"_server_messages": "[{\"message\": \"Error details\"}]"
}| Code | Meaning |
|---|---|
| Success |
| Validation error |
| No authentication |
| No permissions |
| Document not found |
| Server exception |
| Rate limit exceeded |
Accept: application/jsonfrappe.conf| File | Contents |
|---|---|
| authentication-methods.md | Token, Session, OAuth2 implementation |
| rest-api-reference.md | Complete REST API with filters and pagination |
| rpc-api-reference.md | Whitelisted methods and frappe.call patterns |
| webhooks-reference.md | Webhook configuration and security |
| anti-patterns.md | Common mistakes and fixes |
| Feature | v14 | v15 |
|---|---|---|
| ❌ | ✅ |
| Server Script rate limiting | ❌ | ✅ |
| PKCE for OAuth2 | Limited | ✅ |