ERPNext provides a comprehensive REST API built on the Frappe Framework that allows you to programmatically interact with your ERP system. You can perform CRUD operations on all DocTypes, execute whitelisted methods, and integrate ERPNext with external applications.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/frappe/erpnext/llms.txt
Use this file to discover all available pages before exploring further.
Base URL
All API requests are made to your ERPNext instance URL:API Endpoints Structure
The ERPNext API follows a consistent pattern for accessing resources:Resource Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/resource/{doctype} | GET | Get a list of documents |
/api/resource/{doctype} | POST | Create a new document |
/api/resource/{doctype}/{name} | GET | Get a specific document |
/api/resource/{doctype}/{name} | PUT | Update a document |
/api/resource/{doctype}/{name} | DELETE | Delete a document |
Method Endpoints
@frappe.whitelist().
Common DocTypes
ERPNext includes hundreds of DocTypes. Here are some commonly used ones:- Customer - Customer records
- Item - Product/item master
- Sales Order - Sales order transactions
- Purchase Order - Purchase order transactions
- Sales Invoice - Sales invoices
- Purchase Invoice - Purchase invoices
- Delivery Note - Delivery documents
- Stock Entry - Stock movements
- Payment Entry - Payment records
- Journal Entry - Accounting entries
Request Format
All requests should include:- Content-Type:
application/json - Accept:
application/json - Authorization: API Key or Token (see Authentication)
Response Format
API responses are returned in JSON format:Getting a List of Documents
Retrieve multiple documents with filtering, sorting, and pagination:Query Parameters
JSON array of field names to return. Example:
["name", "customer_name"]JSON array of filters. Example:
[["Customer", "territory", "=", "United States"]]Number of records to return per page
Starting index for pagination
Field to sort by. Example:
modified desc or customer_name ascGetting a Single Document
Creating a Document
When creating documents, you only need to provide required fields and any optional fields you want to set. ERPNext will automatically populate default values and generate naming series.
Updating a Document
Deleting a Document
Calling Custom Methods
ERPNext has many whitelisted methods that provide additional functionality:Custom methods decorated with
@frappe.whitelist() in the codebase are accessible via the API. Check the ERPNext source code to discover available methods.File Uploads
Upload files and attach them to documents:Rate Limiting
ERPNext doesn’t enforce strict rate limits by default, but it’s recommended to:- Batch requests when possible
- Implement retry logic with exponential backoff
- Monitor API usage to avoid overwhelming the server
- Use webhooks for real-time updates instead of polling
Error Handling
Common HTTP status codes:- 200 OK - Successful GET request
- 201 Created - Successful POST request
- 202 Accepted - Successful PUT/DELETE request
- 400 Bad Request - Invalid request format
- 401 Unauthorized - Invalid or missing authentication
- 403 Forbidden - Insufficient permissions
- 404 Not Found - Resource doesn’t exist
- 417 Expectation Failed - Validation error
- 500 Internal Server Error - Server error
Always check both the HTTP status code and the response body for detailed error messages. ERPNext provides descriptive error messages in the
exception and _server_messages fields.Next Steps
- Learn about Authentication methods
- Explore the Frappe Framework documentation for advanced features
- Check the ERPNext source code for available whitelisted methods
- Join the ERPNext community forum for API support