Sign up or login at https://fhir.epic.com (epic on fhir)
- At the tab "Build Apps" create a new app.

- Select "patients" radio button
- In the list of the available APIs choose the following ones: (note that you shoud choose R4)

- other settings:

- that's it for the test mode, click "Save & ready for Sandbox" (for production mode you will have to fill out all the settings)

- then you'll have production and non-production client id which you will while making requests: (use non-production client id)
