Payer to Payer API

Payer Implementation

To use Opala’s Payer-to-Payer Data Exchange, Contact Us – Opala, to find out how to submit the Payer Application Registration.

Once the registration is vetted, approved and completed, you will receive client credentials, request an OAuth 2.0 access token (client credentials flow), match the member with $bulk-member-match, and download their data with FHIR Bulk Data $davinci-data-export.

Opala’s implementation follows the HL7 Da Vinci (HRex) v1.2.0 and PDex v2.2.0 Implementation Guides, US Core, SMART Backend Services, and FHIR Bulk Data Access.

Environment Base URLs

The Payer-to-Payer APIs are accessible through different environments. Use the appropriate base URL based on the environment you intend to access.

Environment

 

Base URL

 

Purpose

 

Production (Prod)

https://opala.tech/payer-to-payer/{payer-tenant}/v1/fhir-r4

Used by external payers to access the live Payer-to-Payer APIs.

 

Note: All API endpoints documented in this guide use {base-url} as a placeholder. Replace it with the corresponding environment URL from the table above when constructing API requests.

Step 1 — Register and request production access

  1. To use Opala's Payer-to-Payer Data Exchange, Contact Us - Opala, to find out how to submit the Payer Application Registration.
  2. Opala forwards your submissions to the Payer customer and expects to receive a response within 3-5 business days. Once approved, Opala securely sends your connection details.
  3. As part of the registration process, the payer must provide the following information to Opala:
    • JWKS URL: Either the JSON Web Key Set (JWKS), or the URL hosting the JWKS, containing the public key used by Opala to verify signed JWT assertions.
    • TIN (Tax Identification Number): The payer's Tax Identification Number.
    • NAIC (National Association of Insurance Commissioners) Code: The payer's NAIC identifier.

Step 2 — Obtain credentials

Once the registration process is completed, a client ID is issued and can be used to access production.

  • Client ID: A unique identifier assigned to the registered payer.
  • Tenant: The tenant associated with the payer's registration.
  • Base URL: The Production API base URL used to access the Payer-to-Payer APIs.

Step 3 — Get an access token

1curl -X POST '{base-url}/connect/token' \
2-H 'Content-Type: application/x-www-form-urlencoded' \
3--data-urlencode 'grant_type=client_credentials' \
4--data-urlencode 'client_id={your-client-id}' \
5--data-urlencode 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \
6--data-urlencode 'client_assertion={signed-jwt-assertion}' \
7--data-urlencode 'scope=system/*.rs' \

Build client_assertion as a JWT signed with your private key. Header: alg RS384, typ JWT, and kid. Claims: iss and sub set to your client ID, aud set to the token URL, iat, exp (300 seconds after iat), and a unique jti.

1 HTTP/1.1 200 OK
2 { "access_token": "{access_token}", "expires_in": 300, "token_type": "Bearer", "scope": "system/*.rs" }

Copy access_token from the response and send it as Authorization: Bearer {access_token} on every request. Tokens expire after 5 minutes (expires_in 300); reuest a new token when it expires.

The scope system/*.rs grants read access to all resource types and is the simplest option. If you request narrower scopes, include system/Group.rs for $bulk-member-match, plus system/{ResourceType}.rs (for example, system/Patient.rs) for each resource type you want exported.

Step 4a — Match the member ($bulk-member-match)

Send one MemberBundle per member, with the member's demographics, the coverage they held with the previous payer, and their consent. Each MemberBundle must contain exactly one each of MemberPatient, CoverageToMatch, and Consent. CoverageToLink (your own coverage for the member) is optional.

1curl -X POST '{base-url}/payer-to-payer/{payer-tenant}/v1/fhir-r4/Group/$bulk-member-match' \
2-H 'Content-Type: application/fhir+json' \
3-H 'Accept: application/fhir+json' \
4-H 'Prefer: respond-async' \
5-H 'Authorization: Bearer {access_token}' \
6-d '{
7"resourceType": "Parameters",
8"parameter": [
9{
10"name": "MemberBundle",
11"part": [
12{ "name": "MemberPatient", "resource": { "resourceType": "Patient",
13"id": "{member-patient-id}",
14"name": [{ "family": "{last-name}", "given": ["{first-name}"] }],
15"birthDate": "{YYYY-MM-DD}", "gender": "{gender}" } },
16{ "name": "CoverageToMatch", "resource": { "resourceType": "Coverage", "status": "active",
17"subscriberId": "{subscriber-id-at-previous-payer}",
18"identifier": [{ "type": { "coding": [{ "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "MB" }] }, "value": "{member-id-at-previous-payer}" }],
19"beneficiary": { "reference": "Patient/{member-patient-id}" },
20"payor": [{ "reference": "Organization/{previous-payer-organization-id}", "display": "{previous-payer-name}" }] } },
21{ "name": "Consent", "resource": { "resourceType": "Consent", "status": "active",
22"contained": [{ "resourceType": "DocumentReference", "id": "consent-doc", "status": "current",
23"content": [{ "attachment": { "contentType": "application/pdf", "url": "{consent-document-url}" } }] }],
24"sourceReference": { "reference": "#consent-doc" },
25"scope": { "coding": [{ "system": "http://terminology.hl7.org/CodeSystem/consentscope", "code": "patient-privacy" }] },
26"category": [{ "coding": [{ "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode", "code": "IDSCL" }] }],
27"patient": { "reference": "Patient/{member-patient-id}" },
28"performer": [{ "reference": "Patient/{member-patient-id}" }],
29"policy": [{ "uri": "http://hl7.org/fhir/us/davinci-hrex/StructureDefinition-hrex-consent.html#regular" }],
30"provision": { "type": "permit", "period": { "start": "{YYYY-MM-DD}", "end": "{YYYY-MM-DD}" },
31"actor": [{ "role": { "coding": [{ "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type", "code": "performer" }] },
32"reference": { "reference": "Organization/{previous-payer-organization-id}", "display": "{previous-payer-name}",
33"identifier": { "system": "urn:oid:2.16.840.1.113883.6.300", "value": "{previous-payer-naic}" } } },
34{ "role": { "coding": [{ "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType", "code": "IRCP" }] },
35"reference": { "type": "Organization",
36"identifier": { "system": "urn:oid:2.16.840.1.113883.4.4", "value": "{requesting-payer-tin}" } } }],
37"action": [{ "coding": [{ "system": "http://terminology.hl7.org/CodeSystem/consentaction", "code": "disclose" }] }] } } }
38]
39}
40]
41}'

  • The example includes one MemberBundle. Add a separate MemberBundle for each additional member included in the bulk member-match request.
  • During client registration, the payer must provide its Tax Identification Number (TIN) to Opala. Opala associates this TIN with the registered Client ID and includes it as the payer_to_payer claim in the access token.
  • The consent's recipient identifier ({requesting-payer-tin}) must match the payer_to_payer>/span> claim in the access token. This ensures that the requesting payer's TIN matches the recipient payer authorized in the member's consent record.
Response Meaning Next action
202 Accepted The job was queued. The status URL is in the Content-Location header. Go to Step 4b
401 Unauthorized Token missing, invalid or expired Request a new token (Step 3)
403 Forbidden The token does not include the scope Request a token that includes the allowed scope
1 HTTP/1.1 401 Unauthorized
2 { "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "security", "details": { "text": "Please provide a valid Bearer token" } } ] }
3
4 HTTP/1.1 403 Forbidden
5 { "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "forbidden", "diagnostics": "Access token is missing the required 'system/Group.rs' scope for $bulk-member-match." } ] }

Step 4b — Check the match job status and regtrieve the results

Use the status URL from the Content-Location header of Step 4a.

1 curl '{base-url}/payer-to-payer/{payer-tenant}/v1/fhir-r4/$bulk-member-match-status?job={job-id}' \
2 -H 'Accept: application/fhir+json' \
3 -H 'Authorization: Bearer {access_token}' \

Response Meaning Next action
202 Accepted The job is still running. Check again after the Retry-After interval
200 OK with a Parameters resource The job has finished. Members are grouped as MatchedMembers, NonMatchedMembers, and ConsentConstrainedMembers. Copy the ID of the Matched Members Group: it is the {groupId} for Step 5
404 Not Found No job found for this ID Start a new job in Step 4

If no members are matched, the Matched Members group in the result will have a quantity of 0 with no ID. The Not Matched Members and Consent Constrained Members groups will appear only if at least one member falls into the respective category.

Handling Zero Matched Members

If the MatchedMembers group returns a quantity of 0, no members have been successfully matched. In this scenario, no Group resource or Group ID is generated.

  • Do not proceed to Step 5 (Bulk Data Export), as there is no Group ID available to initiate the export request.
  • The payer should treat the response as a successful match operation with no matching members.
  • Review the matching request and source member information if further investigation is required.

Proceed to Step 5 only when the MatchedMembers group contains one or more matched members and a valid Group ID is returned.

1HTTP/1.1 200 OK
2{
3 "resourceType": "Parameters",
4 "id": "bulk-member-match-response",
5 "parameter": [
6 { "name": "MatchedMembers", "resource": { "resourceType": "Group", "id": "{matched-group-id}", "type": "person", "actual": true,
7 "code": { "coding": [{ "system": "http://hl7.org/fhir/us/davinci-pdex/CodeSystem/PdexMultiMemberMatchResultCS", "code": "match", "display": "Matched" }] },
8 "quantity": 1,
9 "member": [{ "entity": { "extension": [{ "url": "http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/base-ext-match-parameters", "valueReference": { "reference": "#1" } }],
10 "reference": "Patient/{member-patient-id}" } }] } },
11 { "name": "NonMatchedMembers", "resource": { "resourceType": "Group", "type": "person", "actual": true,
12 "code": { "coding": [{ "system": "http://hl7.org/fhir/us/davinci-pdex/CodeSystem/PdexMultiMemberMatchResultCS", "code": "nomatch", "display": "Not Matched" }] },
13 "quantity": 1,
14 "member": [{ "entity": { "extension": [{ "url": "http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/base-ext-match-parameters", "valueReference": { "reference": "#3" } }],
15 "reference": "#3" } }] } },
16{ "name": "ConsentConstrainedMembers", "resource": { "resourceType": "Group", "type": "person", "actual": true,
17"code": { "coding": [{ "system": "http://hl7.org/fhir/us/davinci-pdex/CodeSystem/PdexMultiMemberMatchResultCS", "code": "consentconstraint", "display": "Consent Constraint" }] },
18"quantity": 1,
19 "member": [{ "entity": { "extension": [{ "url": "http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/base-ext-match-parameters", "valueReference": { "reference": "#2" } }],
20"reference": "#2" } }] } }
21]
22}

Step 5 — Start a bulk export

Use the ID of the Matched Members Group from Step 4b as {groupId}.

1 curl -X POST '{base-url}/payer-to-payer/{payer-tenant}/v1/fhir-r4/Group/{groupId}/$davinci-data-export' \
2 -H 'Content-Type: application/fhir+json' \
3 -H 'Accept: application/fhir+json' \
4 -H 'Prefer: respond-async' \
5 -H 'Authorization: Bearer {access_token}' \
6 -d '{
7 "resourceType": "Parameters",
8 "parameter": [
9 { "name": "exportType", "valueString": "hl7.fhir.us.davinci-pdex#payertopayer" }
10 ]
11 }'

Optional parameters: _type (limit resource types) and _since (only data changed after a date, for refreshes on concurrent coverage).

Send them in the parameter list of the request body: _type as a comma-separated list of resource types, and _since as an instant (valueInstant). _type can also be sent as a query parameter on the request URL.

1{ "name": "_type", "valueString": "Patient,Coverage" }
2{ "name": "_since", "valueInstant": "2026-01-01T00:00:00Z" }

With _type, the manifest lists only the requested types. With _since, the export contains only resources last updated after that time; a listed file can be empty.

A 202 Accepted response returns the job status URL in the Content-Location header.

The access token must include the read scope for each resource type you want exported.

1HTTP/1.1 202 Accepted
2Content-Location: {base-url}/payer-to-payer/{payer-tenant}/v1/fhir-r4/$exportstatus?_id={export-id}
3{ "resourceType": "OperationOutcome", "issue": [ { "severity": "information", "code": "informational", "details": { "text": "The $export task is successfully added to the queue. Status updates can be requested using {status-url}. ..." } } ] }

Step 6 — Check job status

Use the status URL from the Content-Location header of Step 5 (the export ID is the value after _id=, not the group ID).

1 curl '{base-url}/payer-to-payer/{payer-tenant}/v1/fhir-r4/$exportstatus?_id={export-id}' \
2 -H 'Accept: application/json' \
3 -H 'Authorization: Bearer {access_token}' \

202 means the job is still running; poll again after the Retry-After interval. 200 returns the manifest:

1{
2 "transactionTime": "2026-11-02T13:21:26.3963516+00:00",
3 "request": "/Group/{groupId}/$export",
4 "requiresAccessToken": true,
5"output": [
6{ "type": "Patient", "url": "{base-url}/payer-to-payer/{payer-tenant}/v1/fhir-r4/$exportfilerequest?_id={export-id}&filename=contentPatient.ndjson" },
7{ "type": "Coverage", "url": "{base-url}/payer-to-payer/{payer-tenant}/v1/fhir-r4/$exportfilerequest?_id={export-id}&filename=contentCoverage.ndjson" },
8{ "type": "ExplanationOfBenefit", "url": "{base-url}/payer-to-payer/{payer-tenant}/v1/fhir-r4/$exportfilerequest?_id={export-id}&filename=contentExplanationOfBenefit.ndjson" },
9{ "type": "Condition", "url": "{base-url}/payer-to-payer/{payer-tenant}/v1/fhir-r4/$exportfilerequest?_id={export-id}&filename=contentCondition.ndjson" }
10],
11"error": []
12}

The manifest lists one file per resource type; four are shown.

Step 7 — Download the files

1 curl '{output-file-url}' \
2 -H 'Accept: application/fhir+ndjson' \
3 -H 'Authorization: Bearer {access_token}' \

Each file is Newline Delimited JSON (NDJSON): one FHIR resource per line. Download every file in the output. A 200 response returns the file with content type application/fhir+ndjson.

Responding to requests (Opala payer customers)

If you are an Opala customer, Opala answers inbound requests on your behalf: it verifies the requesting payer, runs the match against your member data, checks consent, and serves the export. Your team supplies the member, claims, and clinical data feeds and handles member support. To request data for your own new members, use the same steps above from your Opala console.