ERPNext Resource API
The Resource API from ERPNext — 2 operation(s) for resource.
The Resource API from ERPNext — 2 operation(s) for resource.
openapi: 3.0.0
info:
description: 'Unofficial documentation of the [Frappe](https://frappe.io) / [ERPNext](https://erpnext.org) API.
'
version: 0.0.1
title: Frappe / ERPNext Method Resource API
contact:
name: Raffael Meyer
url: https://alyf.de
email: raffael@alyf.de
license:
name: GPL-3.0
servers:
- url: https://demo.erpnext.com/api
description: Demo server
- url: https://{company}.erpnext.com/api
description: Custom ERPNext.com instance
variables:
company:
default: demo
description: Subdomain of your company's custom ERPNext instance
tags:
- name: Resource
paths:
/resource/{DocType}:
post:
summary: Create a new document
parameters:
- in: path
name: DocType
required: true
schema:
type: string
example: Customer
description: 'The DocType you''d like to receive. For example, Customer.
'
requestBody:
content:
application/json:
schema:
type: object
application/x-www-form-urlencoded:
schema:
type: object
properties:
data:
type: object
responses:
'200':
description: Document created
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/DocType'
'403':
description: Insufficient Permission
content:
application/json:
schema:
type: object
properties:
exc:
type: string
example: Traceback (most recent call last) ...
_error_message:
type: string
example: Insufficient Permission for {DocType}
text/html:
schema:
type: string
tags:
- Resource
get:
summary: Get a list of documents
description: Returns a list of documents of the given type
parameters:
- in: path
name: DocType
required: true
schema:
type: string
description: "The DocType you'd like to receive. For example Customer, Supplier, \nEmployee, Account, Lead, Company, Sales Invoice, Purchase Invoice, Stock Entry, etc.\n"
- in: query
name: fields
schema:
type: array
items:
type: string
default:
- name
description: "By default, only the \"name\" field is included in the listing, to add more fields, \nyou can pass the fields param to GET request. For example, fields=[\"name\",\"country\"]\n"
- in: query
name: filters
schema:
type: array
items:
type: array
items:
type: string
description: 'You can filter the listing using sql conditions by passing them as the filters GET param.
Each condition is an array of the format, [{doctype}, {field}, {operator}, {value}].
For example, filters=[["Customer", "country", "=", "India"]]
'
- in: query
name: limit_page_length
schema:
type: integer
default: 20
description: "By default, all listings are returned paginated. With this parameter you can change the \npage size (how many items are teturned at once).\n"
- in: query
name: limit_start
schema:
type: integer
default: 0
description: "To request successive pages, pass a multiple of your limit_page_length as limit_start. \nFor Example, to request the second page, pass limit_start as 20.\n"
responses:
'200':
description: "Found requested DocType. By default, only the \"name\" field is included in the listing, \nto add more fields, you can pass the fields param to GET request.\n"
content:
application/json:
schema:
$ref: '#/components/schemas/DocList'
tags:
- Resource
/resource/{DocType}/{DocumentName}:
get:
summary: Get a specific document
description: Get a document by it's name, for example EMP001 of DocType Employee.
parameters:
- in: path
name: DocType
required: true
schema:
type: string
description: "The DocType you'd like to receive. For example Customer, Supplier, \nEmployee, Account, Lead, Company, Sales Invoice, Purchase Invoice, Stock Entry, etc.\n"
- in: path
name: DocumentName
required: true
schema:
type: string
description: 'The name (ID) of the document you''d like to receive. For example EMP001 (of type Employee).
'
responses:
'200':
description: Found requested document
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/DocType'
tags:
- Resource
put:
summary: Update a specific document
description: TBD
parameters:
- in: path
name: DocType
required: true
schema:
type: string
description: "The DocType you'd like to update. For example Customer, Supplier, \nEmployee, Account, Lead, Company, Sales Invoice, Purchase Invoice, Stock Entry, etc.\n"
- in: path
name: DocumentName
required: true
schema:
type: string
description: 'The name (ID) of the document you''d like to update. For example EMP001 (of type Employee).
'
responses:
'200':
description: Updated specified document
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/DocType'
tags:
- Resource
delete:
summary: Delete a specific document
description: TBD
parameters:
- in: path
name: DocType
required: true
schema:
type: string
description: "The type of the document you'd like to delete. For example Customer, Supplier, \nEmployee, Account, Lead, Company, Sales Invoice, Purchase Invoice, Stock Entry, etc.\n"
- in: path
name: DocumentName
required: true
schema:
type: string
description: 'The name (ID) of the document you''d like to delete. For example EMP001 (of type Employee).
'
responses:
'202':
description: Deleted specified document
content:
application/json:
schema:
type: object
properties:
message:
type: string
tags:
- Resource
components:
schemas:
DocList:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/DocType'
DocType:
type: object
properties:
name:
type: string
modified_by:
type: string
creation:
type: string
modified:
type: string
doctype:
type: string
owner:
type: string
docstatus:
type: integer
securitySchemes:
tokenAuth:
type: apiKey
in: header
name: Authorization
description: 'Get your API keys at User -> Api Access -> Generate Keys.
"headers = {''Authorization'': ''token <api_key>:<api_secret>''}"
'
basicAuth:
type: http
description: 'Get your API keys at User -> Api Access -> Generate Keys.
username = api_key; password = api_secret
[More info](https://frappe.io/docs/user/en/guides/integration/token_based_auth)
'
scheme: basic
oAuth2:
type: oauth2
description: "This API uses OAuth 2 with the authorization code flow. \n[More info]https://frappe.io/docs/user/en/guides/integration/using_oauth)\n"
flows:
authorizationCode:
authorizationUrl: /method/frappe.integrations.oauth2.authorize
tokenUrl: /method/frappe.integrations.oauth2.get_token
refreshUrl: /method/frappe.integrations.oauth2.get_token
scopes:
all: Same permissions as the user who created the oAuth client