How to give the Authentication to REST API

I want to add the lead from another website
Create : POST api/resource/:doctype I am using this REST API, How can give the Authentication to API, and How do generate an access token

are you getting the info?

curl --location 'http://erp.localhost:8000/api/resource/Lead' \
--header 'Authorization: token api_key:api_secret' \
--header 'Content-Type: application/json' \
--data '{
    "first_name": "test"
}'

for authorization you have to generate api_key and api_secret from User doctype. Open User Doctype-> open any record which has Lead access → Go to setting tab → API Access → Click on Generate keys button it will generate secret key @manal_erpnext @Eranna

1 Like