ERPNext Integration with other Apps


ERPNext connect to other Apps via rest api.
to make request to this rest api, we have to hit login rest api which return token.

this token has expired within 24 hours.
this token is part of request header on each request.

how to achieve this kind of scenario in ERPNext?

do we have to create custom doctype to save token?

if we use for example webhook in purchase order doctype, how to update header request if token is expired?


You can use a service user account to achieve this. Create a user and give it the necessary permissions. Generate API Key and Secret for that user and you can pass the key and secret in your header. this does not expire unless the secret is changed/renegerated.

1 Like


the token comes from other Apps, not comes from ERPNext.

ERPNext post request json data to other Apps


You can either use frappe script API methods and pass the key in that:

Or use webhooks:

Both methods allow for headers where you should be able to enter the authorization parameters.


is it possible to execute “frappe.make_post_request” inside python file?