> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended** (the `-y` flags skip prompts, so the command runs without an interactive terminal):
> ```bash
> npx -y @scalekit-inc/cli setup -y
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup -y
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for other Agent Skills-compatible agents in `~/.agents/skills`.
> Skills: integrate-agentkit, implement-saaskit, add-mcp-oauth, implement-sso, implement-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Connect AI agents to ERPNext

The ERPNext connector lets your AI agent act in each user's ERPNext account. Each user connects their own ERPNext API key and secret once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 17 tools.

**Authentication:** API Key + Secret
**Categories:** Accounting & Finance, CRM & Sales
**Tools:** 17: 8 read, 7 write, 2 destructive
**Users sign in with:** API key
**Built by:** Scalekit connector
**Try it:** [Playground in the Scalekit dashboard](https://app.scalekit.com/ws/signup?sk_intent=playground&provider=ERPNEXT)

## Setup

1. ### Install the SDK

   **Node.js**

   ```bash
   npm install @scalekit-sdk/node dotenv
   ```

   **Python**

   ```bash
   pip install scalekit-sdk-python python-dotenv
   ```

2. ### Set your credentials

   Add your Scalekit credentials to your `.env` file. Find values in **[app.scalekit.com](https://app.scalekit.com)** > **Developers** > **API Credentials**.

   ```sh title=".env"
   SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
   SCALEKIT_CLIENT_ID=<your-client-id>
   SCALEKIT_CLIENT_SECRET=<your-client-secret>
   ```

3. ### Create the ERPNext connection

   In **AgentKit > Connections**, create an ERPNext connection. The name you give it is the `connection_name` your code passes. See [Configure connections](/agentkit/connections/).

## Tools

Pass the exact name to `execute_tool`, with an input like each tool's example. To ask for a tool that's missing, use the [request form](https://scalekitsupport.portal.usepylon.com/forms/request-a-connector-tool).

**Node.js**

```typescript
const result = await actions.executeTool({
  toolName: 'erpnext_doctype_meta_get',
  toolInput: {
    doctype: '<doctype>',
  },
  connector: 'erpnext',
  identifier: 'user_123',
})
```

**Python**

```python
result = actions.execute_tool(
    tool_name="erpnext_doctype_meta_get",
    tool_input={
        "doctype": "<doctype>",
    },
    connection_name="erpnext",
    identifier="user_123",
)
```

`result.data` is the app's response as JSON, and `result.execution_id` (`executionId` in Node.js) is the ID of the call.

### `erpnext_doctype_meta_get`

Get DocType Fields · Read-only

Get a DocType's metadata: its fields, field types, options, mandatory flags and child tables.
Returns docs with the DocType definition and its child DocTypes.
Use this before creating or filtering documents of an unfamiliar DocType.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer

Example input: `{"doctype":"<doctype>"}`

### `erpnext_document_get`

Get Document · Read-only

Get one full document, including its child tables.
Returns data with every field of the document.
Get the name from erpnext_documents_list or erpnext_link_search.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer
- `name` (`string`, required): The document's name (its ID), for example CUST-00001 or ACC-SINV-2026-00001. Example: CUST-00001
- `expand_links` (`boolean`, optional): Expand all link fields when true. Example: false

Example input: `{"doctype":"<doctype>","name":"<name>"}`

### `erpnext_document_value_get`

Get Field Values · Read-only

Get one or more field values from the first document that matches a name or filters.
Returns message with the requested fields.
Use this for a quick lookup without fetching the whole document.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer
- `fieldname` (`string`, required): Field to read, or a JSON array of fields. Example: ["customer_name", "territory"].
- `as_dict` (`boolean`, optional): As Dict. Example: true
- `filters` (`string`, optional): The document name, or a JSON object or array of filters to find the document. Example: {"customer_name": "Acme Inc"}.

Example input: `{"doctype":"<doctype>","fieldname":"<fieldname>"}`

### `erpnext_documents_count`

Count Documents · Read-only

Count the documents of a DocType that match filters.
Returns message with the count.
Use this instead of listing when you only need a number.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer
- `filters` (`string`, optional): JSON filters. Example: [["customer_group", "=", "Commercial"]]

Example input: `{"doctype":"<doctype>"}`

### `erpnext_documents_list`

List Documents · Read-only

List documents of any DocType (Customer, Sales Invoice, Item, Lead and so on) with chosen fields, AND/OR filters, sorting and paging.
Returns data, a list of documents with the requested fields (only name by default).
Pass DocType as doctype; use doctype DocType to list DocTypes. Use erpnext_document_get for one full document. Use erpnext_doctype_meta_get to see a DocType's fields.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer
- `expand` (`string`, optional): JSON array of link fields to expand into full objects. Example: ["customer"].
- `fields` (`string`, optional): JSON array of field names to return. Default is only name. Example: ["name", "customer_name"].
- `filters` (`string`, optional): JSON array of [field, operator, value] conditions joined with AND. Example: [["customer_group", "=", "Commercial"]].
- `limit_page_length` (`integer`, optional): Number of records to return (default 20; 0 returns all). Example: 20
- `limit_start` (`integer`, optional): Offset for paging (number of records to skip). Example: 0
- `or_filters` (`string`, optional): JSON array of [field, operator, value] conditions joined with OR. Example: [["territory", "=", "India"], ["territory", "=", "United States"]]
- `order_by` (`string`, optional): Sort clause: a field name followed by asc or desc. Example: modified desc.

Example input: `{"doctype":"<doctype>"}`

### `erpnext_link_search`

Search Link Values · Read-only

Search a DocType by text the way ERPNext's link fields do, returning matching names and descriptions.
Returns message with value and description pairs.
Use this to find a document name (for example a customer or item) from partial text.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer
- `txt` (`string`, required): Text to search for in the name and search fields. Example: acme.
- `filters` (`string`, optional): Optional JSON filters to narrow the search. Example: [["customer_group", "=", "Commercial"]]
- `page_length` (`integer`, optional): Maximum number of matches (default 10). Example: 10

Example input: `{"doctype":"<doctype>","txt":"<txt>"}`

### `erpnext_report_run`

Run Report · Read-only

Run a query or script report (for example General Ledger, Accounts Receivable or Stock Balance) with report filters.
Returns message with columns and result rows.
Report filters are a JSON object; required filters differ per report (often company, from_date and to_date).

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `report_name` (`string`, required): Report name as shown in ERPNext. Example: General Ledger.
- `filters` (`string`, optional): JSON object of report filters. Example: {"company": "Acme Inc", "from_date": "2026-01-01", "to_date": "2026-01-31"}.

Example input: `{"report_name":"<report_name>"}`

### `erpnext_user_me_get`

Get Current User · Read-only

Get the user the API key belongs to.
Returns message with the user ID (email).
Use this to confirm the connection; permissions follow this user's roles.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs: none.

Example input: `{}`

### `erpnext_comment_add`

Add Comment · Write

Add a comment to a document's timeline.
Returns message with the new Comment.
Use this to log a note on a customer, invoice or other document.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `comment_by` (`string`, required): Display name of the commenter. Example: Jane Doe
- `comment_email` (`string`, required): Email of the commenter, usually the API user. Example: jane@example.com
- `content` (`string`, required): Comment text (HTML allowed). Example: Called the customer about the overdue invoice.
- `reference_doctype` (`string`, required): Reference Doctype. Example: Customer
- `reference_name` (`string`, required): Reference Name. Example: CUST-00001

Example input: `{"comment_by":"<comment_by>","comment_email":"<comment_email>","content":"<content>","reference_doctype":"<reference_doctype>","reference_name":"<reference_name>"}`

### `erpnext_document_create`

Create Document · Write

Create a document of any DocType from a JSON object of field values (saved as a draft for submittable DocTypes).
Returns data with the saved document, including its new name.
Use erpnext_document_submit to submit it. Use erpnext_doctype_meta_get to see a DocType's fields.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `data` (`object`, required): Document fields to set, keyed by field name. Child tables are arrays of row objects. Example: {"customer_name": "Acme Inc", "customer_group": "Commercial", "territory": "All Territories"}
- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer

Example input: `{"data":{"customer_name":"Acme Inc","customer_group":"Commercial","territory":"All Territories"},"doctype":"<doctype>"}`

### `erpnext_document_rename`

Rename Document · Write

Rename a document (change its name/ID), optionally merging into an existing one.
Returns message with the new name.
Only DocTypes that allow renaming support this.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer
- `new_name` (`string`, required): New Name. Example: CUST-ACME
- `old_name` (`string`, required): Old Name. Example: CUST-00001
- `merge` (`boolean`, optional): Merge. Example: false

Example input: `{"doctype":"<doctype>","new_name":"<new_name>","old_name":"<old_name>"}`

### `erpnext_document_submit`

Submit Document · Write

Submit a draft document of a submittable DocType (for example Sales Invoice or Sales Order), making it final.
Returns message with the submitted document.
Pass the full document from erpnext_document_get. Use erpnext_document_cancel to reverse it.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `doc` (`object`, required): The full document to submit, as returned by erpnext_document_get (it must include doctype and name). Example: {"doctype": "Sales Invoice", "name": "ACC-SINV-2026-00001"}.

Example input: `{"doc":{"doctype":"Sales Invoice","name":"ACC-SINV-2026-00001"}}`

### `erpnext_document_update`

Update Document · Write

Update fields of an existing document. Only the fields sent change; a child table sent replaces the whole table.
Returns data with the updated document.
Submitted documents can only change fields allowed on submit. Use erpnext_doctype_meta_get to see a DocType's fields.

Read only: no. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `data` (`object`, required): Document fields to change, keyed by field name. Child tables are arrays of row objects. Example: {"customer_name": "Acme Inc", "customer_group": "Commercial", "territory": "All Territories"}
- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer
- `name` (`string`, required): The document's name (its ID), for example CUST-00001 or ACC-SINV-2026-00001. Example: CUST-00001

Example input: `{"data":{"customer_name":"Acme Inc","customer_group":"Commercial","territory":"All Territories"},"doctype":"<doctype>","name":"<name>"}`

### `erpnext_document_value_set`

Set Field Value · Write

Set one field (or several, by passing a JSON object as fieldname) on a document and save it.
Returns message with the updated document.
Use erpnext_document_update to change many fields at once.

Read only: no. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer
- `fieldname` (`string`, required): Field name to set, or an object of field names and values to set several. Example: territory.
- `name` (`string`, required): Name. Example: CUST-00001
- `value` (`string`, optional): New value for the field (omit when fieldname is an object). Example: Retail.

Example input: `{"doctype":"<doctype>","fieldname":"<fieldname>","name":"<name>"}`

### `erpnext_method_call`

Call Method · Write

Call a whitelisted server method with POST and a JSON body of arguments. Changes are committed.
Returns message with the method's result.
Use this for ERPNext or app methods that have no dedicated tool, for example erpnext.stock.utils.get_stock_balance. The method must be whitelisted on the site; methods restricted to GET are not supported.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `method` (`string`, required): Dotted path of a whitelisted method. Example: erpnext.stock.utils.get_stock_balance
- `args` (`object`, optional): Method arguments as a JSON object, sent as the request body. Example: {"doctype": "ToDo", "name": "abc123"}

Example input: `{"method":"<method>"}`

### `erpnext_document_cancel`

Cancel Document · Destructive

Cancel a submitted document. Linked documents may need cancelling first.
Returns message.
Use this to reverse a submitted document; amend it in ERPNext afterwards if needed.

Read only: no. Destructive: yes. Idempotent (safe to retry): no.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Sales Invoice
- `name` (`string`, required): Name. Example: ACC-SINV-2026-00001

Example input: `{"doctype":"<doctype>","name":"<name>"}`

### `erpnext_document_delete`

Delete Document · Destructive

Delete a draft or cancelled document.
Returns message ok.
Submitted documents must be cancelled first with erpnext_document_cancel.

Read only: no. Destructive: yes. Idempotent (safe to retry): yes.

Inputs:

- `doctype` (`string`, required): DocType name, exactly as shown in ERPNext, for example Customer, Sales Invoice, Item or Lead. Spaces are allowed. Example: Customer
- `name` (`string`, required): The document's name (its ID), for example CUST-00001 or ACC-SINV-2026-00001. Example: CUST-00001

Example input: `{"doctype":"<doctype>","name":"<name>"}`

## Related

Other Accounting & Finance connectors ([all 82](/agentkit/connectors/?category=accounting-finance)):

- [QuickBooks](/agentkit/connectors/quickbooks/): Scalekit connector, OAuth, 117 tools
- [Xero](/agentkit/connectors/xero/): Scalekit connector, OAuth, 94 tools
- [Stripe](/agentkit/connectors/stripe/): Scalekit connector, Access token, 178 tools


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
