# Unauthorised - 401 When accessing eRS Document Retrieval

**URL:** <https://developer.community.nhs.uk/t/unauthorised-401-when-accessing-ers-document-retrieval/4452>\
**Category:** API Platform\
**Tags:** testing, fhir\
**Created:** [10 February 2025 15:55 UTC](https://developer.community.nhs.uk/t/unauthorised-401-when-accessing-ers-document-retrieval/4452 "2025-02-10T15:55:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon.goody](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@jon.goody](https://developer.community.nhs.uk/u/jon.goody)\
**Post date:** [10 February 2025 15:55 UTC](https://developer.community.nhs.uk/t/unauthorised-401-when-accessing-ers-document-retrieval/4452/1 "2025-02-10T15:55:57Z")

</div>

I am receiving a 401 error when trying to retrieve documents associated with appointments in eRS.

CIS2 has been setup and working and using the ID token we call into the developer API platform to get an access token as per [https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation/application-restricted-restful-apis-signed-jwt-authentication](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation/application-restricted-restful-apis-signed-jwt-authentication)

This token is then used as per guidance to call the API e-Referral Service - Application Restricted ( Integration Testing ).

Application has been registered as per [https://digital.nhs.uk/services/e-referral-service/api/integration-process/build#2-2-create-and-register-your-application](https://digital.nhs.uk/services/e-referral-service/api/integration-process/build#2-2-create-and-register-your-application).

API Key: mEGvQWNBpW4Ha3XfzfhVfGhWvnlZXCIO

I have discussed with the eReferral Service development forum who has now directed me to this one. More details of the issue can be found at [Unauthorised - 401 eRS Document Retrieval - #6 by jon.goody](https://developer.community.nhs.uk/t/unauthorised-401-ers-document-retrieval/4368/6)

Can you please advise on how I resolve this. From what i can see the access token returned tells me success authentication with Developer API Platform so confused why it then fails with eRS FHIR API.

---

<div class="post-metadata">

**Author:** ![stephen.koch](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@stephen.koch](https://developer.community.nhs.uk/u/stephen.koch)\
**Post date:** [20 February 2025 08:29 UTC](https://developer.community.nhs.uk/t/unauthorised-401-when-accessing-ers-document-retrieval/4452/2 "2025-02-20T08:29:31Z")

</div>

It looks like this is being tracked under a separate posting here now, [Unauthorised - 401 eRS Document Retrieval - #15 by jon.goody](https://developer.community.nhs.uk/t/unauthorised-401-ers-document-retrieval/4368/15) incase anyone else has a similar issue and reads this posting.
