How to set ID field from Frappe REST API?

I want to integrate my application with ERPNext and I want to use the ID field from that application. How do I do that? Setting the “id” and “name” fields in my request don’t work. And setting “customer_name” field sets the name as my id

@trentmu @revant_one Can you guys answer this? Is it possible?

Hi @zeeeeeeeero
I’m afraid I don’t know (I’m a setup/network/troubleshoot guy, not a programmer, so I’m unable to answer)

1 Like

What specifically are you trying to achieve? Which doctype? Can you share your code snippets?

The fieldname id has no special meaning in ERPNext/Frappe unless a DocType uses it. However, by convention, all DocTypes have a name field which has the same semantics as id in other frameworks. The name is not typically set using API calls but by using the autoname feature when defining a DocType or by using the autoname controller method.

Setting a new Document’s 'name' value with an HTTP POST is only possible when its DocType’s Auto Name setting is “Prompt”.

If not Prompt, the value of 'name' is chosen automatically, regardless of what you send in your HTTP request.

Suggestion To Maintainers: In my opinion, if Frappe Framework receives a POST that contains 'name', and the DocType’s Auto Name is not Prompt? The HTTP Response should be an error. This helps the API Developer understand that what they expected to happen, did not happen.

Today, it just ignores your ‘name’ key and succeeds, which can confuse people.


You can also as I remember force to use a name by sending it like “__newname” in the request
It may work for you