---
title: "API"
space: "Frappe Framework"
url: "https://www.prilk.com/docs/frappe-framework/api"
updated: "2026-05-14"
---

## API

Frappe exposes a REST API for every DocType and every whitelisted method. You don't write API endpoints — you define data and code, the framework generates the API.

### Two URL families

| Endpoint | Use |
|---|---|
| `/api/resource/<DocType>` | CRUD on records — list, get, create, update, delete |
| `/api/method/<dotted.path>` | Call a whitelisted Python function |

### Authentication

Three options:

| Method | Best for |
|---|---|
| **API key + secret** | Server-to-server scripts, long-lived integrations |
| **OAuth 2.0** | Third-party apps acting on behalf of a user |
| **Session cookie** | Browser-based logged-in users |

Generate an API key on **User → API Access**.

### Example: list invoices

```bash
curl 'https://mysite/api/resource/Sales Invoice' \
  -H 'Authorization: token <api_key>:<api_secret>' \
  -d 'fields=["name","customer","grand_total","posting_date"]' \
  -d 'filters=[["docstatus","=",1],["posting_date",">=","2026-01-01"]]'
```

### Example: call a method

```bash
curl -X POST 'https://mysite/api/method/my_app.api.run_report' \
  -H 'Authorization: token <api_key>:<api_secret>' \
  -d 'report_name=Sales Summary' -d 'year=2026'
```

### Client SDKs

- **[frappe-js-sdk](https://github.com/The-Commit-Company/frappe-js-sdk)** — vanilla JS / TypeScript
- **[frappe-react-sdk](https://github.com/The-Commit-Company/frappe-react-sdk)** — React hooks with caching
- **frappe-client** — official Python client

### Webhooks
For outbound notifications (doc submitted, status changed), use **Webhook** DocType in the desk. It sends an HTTP POST to your URL on the configured event.
