Error, no Relationship being returned

Hello e-RS API Team,

We are currently building a data ingestion pipeline against the e-RS FHIR API (STU3) in the INT environment. We are authenticating using the Application-Restricted OAuth2 flow (system-to-system JWT).

For additional context we are using Databricks python notebooks to handle connecting and pulling data.

We have successfully established connectivity, but we are hitting a hard block related to Legitimate Relationships and a listType validation. To avoid gateway header conflicts, we have executed a clean diagnostic run without passing User-Restricted headers (no NHSD-eRS-Business-Function and no NHSD-eRS-On-Behalf-Of-User-ID).

Here is our diagnostic breakdown:

1. Authentication & Connectivity (Success)

Endpoint: GET /CodeSystem/SPECIALTY (A004)

Result: 200 OK

Conclusion: Our JWT is valid, and we can successfully reach and read from the INT API.

We have a UBRN that exists in the system, the service id relates to the following.

2. Worklist Pull: Referrals for Review (Failure)

Endpoint: POST /ReferralRequest/$ers.fetchworklist (A008)

Payload: ```json

{

            "resourceType": "Parameters",

            "meta": {"profile": \[[https://fhir.nhs.uk/STU3/StructureDefinition/eRS-FetchWorklist-Parameters-1](https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffhir.nhs.uk%2FSTU3%2FStructureDefinition%2FeRS-FetchWorklist-Parameters-1&data=05%7C02%7Cpete.davies%40transparity.com%7C3b99f2d22ab94f763a5c08de7f77ec8f%7C9739882f464f4853b6cc95f78012db44%7C0%7C0%7C639088350241871259%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=AKvJv6Pgerw0FnEVsjWXOhRjMhMsWWkceVA0ezwq%2FZo%3D&reserved=0)\]},

            "parameter": \[

                            {"name": "listType", "valueCodeableConcept": {"coding": \[{"system": [https://fhir.nhs.uk/STU3/CodeSystem/eRS-ReferralListSelector-1](https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffhir.nhs.uk%2FSTU3%2FCodeSystem%2FeRS-ReferralListSelector-1&data=05%7C02%7Cpete.davies%40transparity.com%7C3b99f2d22ab94f763a5c08de7f77ec8f%7C9739882f464f4853b6cc95f78012db44%7C0%7C0%7C639088350241905815%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=U%2Bvt8AK3AhtQFPEvyVGbo4JoB%2F9rtfndv5Ww3trveoc%3D&reserved=0), "code": "REFERRALS_FOR_REVIEW"}\]}},

                            {"name": "service", "valueIdentifier": {"system": [https://www.google.com/search?q=http://fhir.nhs.net/Id/ers-service](https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dhttp%3A%2F%2Ffhir.nhs.net%2FId%2Fers-service&data=05%7C02%7Cpete.davies%40transparity.com%7C3b99f2d22ab94f763a5c08de7f77ec8f%7C9739882f464f4853b6cc95f78012db44%7C0%7C0%7C639088350241937700%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Rbk1wqsREDGYceeFZ4pOWHrlyin6m6H1pIHt5NhHYmw%3D&reserved=0), "value": "6711275"}}

            \]

}

Result: 422 Unprocessable Entity

Diagnostic Output: NO_RELATIONSHI

Context: Test Service ID 6711275 is confirmed to be set up under our target Trust ODS code (`RXQ`).

3. Direct Clinical Read (Failure)

Endpoint: GET /ReferralRequest/000049821806 (A005)

Result: 422 Unprocessable Entity

Diagnostic Output: No legitimate relationship with referral (000049821806).

Context: This UBRN is a test referral bound to ODS RXQ.

4. Worklist Pull: Advice & Guidance (Failure)**

Endpoint: POST /ReferralRequest/$ers.fetchworklist (A008)

Payload: Same as Test 2, but with code: PROVIDER_ADVICE_AND_GUIDANCE_REQUESTS

Result: 422 Unprocessable Entity

Diagnostic Output: INVALID_CODE (‘List Type’ is invalid)`

I have looked through this forum for solution but none of them seem to be working

Thank you in advance for any guidance on getting this connections up and running

Hi Bill, welcome to the forum. It looks like you are not using the test data/orgs we provided you for application 11616940-e9d5-40b2-a82a-036334220a67

Your test data and application are configured to L2E7W, so you must refer into that organisation and use that organisation to make API calls against. Your card issued is also associated against L2E7W not RXQ. Please use the test orgs provided and re-try. If you access the web app in INT you can validate our assumption as you will likely not see any Provider roles at RXQ