Managing Data Connections

Application APIs

This workflow demonstrates how to manage existing healthcare data connections, including viewing connection status, disconnecting or deleting connections, and re-establishing connections that have expired or been removed. These operations allow users to maintain control over which healthcare providers can access and sync their health data through b.well.


Prerequisites

Environment URL:

  • Client-Sandbox: https://api.client-sandbox.icanbwell.com/v1/graphql

Available Operations

1. View Established Connections

Use the getMemberConnections GraphQL query to retrieve all connection records associated with a user. This query returns connection status, sync status, authentication type, and error details for each established data source.

GraphQL Query:

query getMemberConnections() {
  getMemberConnections {
    id
    name
    category
    integrationType
    type
    status
    syncStatus
    syncErrors {
      coding {
        display
        code
      }
    }
    statusUpdated
    lastSynced
    created
  }
}



Example Response:

{
  "data": {
    "getMemberConnections": [
      {
        "id": "epic_on_fhir_sandbox",
        "name": "Epic on FHIR Sandbox",
        "category": "OAUTH",
        "integrationType": "PROA",
        "type": "PRACTITIONER",
        "status": "EXPIRED",
        "syncStatus": "RETRIEVED",
        "syncErrors": null,
        "statusUpdated": "2025-08-20T20:51:12.513000",
        "lastSynced": "2025-08-17T11:09:12.987000",
        "created": "2025-08-13T16:55:21.601000"
      },
      {
        "id": "proa_demo",
        "name": "BWell PROA Demo",
        "category": "OAUTH",
        "integrationType": "PROA",
        "type": "PRACTITIONER",
        "status": "DELETED",
        "syncStatus": "DATA_DELETED",
        "syncErrors": null,
        "statusUpdated": "2025-11-21T17:01:10.925000",
        "lastSynced": "2025-10-22T18:23:28.377000",
        "created": "2025-09-23T14:12:56.158000"
      }
    ]
  }
}

Response Properties:

PropertyDescriptionPossible Values
idConnection identifierUnique connection ID
nameHuman-readable connection name"BWell PROA Demo", "Epic on FHIR Sandbox"
categoryAuthentication methodBASIC, OAUTH
integrationTypeConnection typePROA
typeHealthcare provider typeCLINICAL, INSURANCE, LAB, PHARMACY, PRACTITIONER
statusConnection lifecycle stateCONNECTED, DELETED, DISCONNECTED, ERROR, EXPIRED
syncStatusData synchronization stateERROR, PENDING, RETRIEVED, RETRIEVING, DATA_DELETED
syncErrorsData sync pipeline errorsSee sync errors table below
statusUpdatedLast status update timestampISO 8601 format
lastSyncedLast data sync timestampISO 8601 format
createdConnection creation timestampISO 8601 format

Optional Filters:

The getMemberConnections query can be filtered by integrationType and/or status. By default, connections with a status of DELETED and syncStatus of DATA_DELETED are excluded.

Sync Errors:

CodeDisplayDescription
PERSON_MATCHING_ERRORFailure to match to a b.well personAll health data from the connection is unavailable
CONNECTION_ERRORFailure in connecting to source or internal serversSome or all health data may be unavailable
MAPPING_ERRORFailure to map source data to R4 FHIRSome or all health data may be unavailable
ENRICHMENT_ERRORFailure to run intelligence layerSome or all health data may be unavailable
PATIENT_RETRIEVAL_ERRORFailure to retrieve patient record from sourceAll health data from the connection is unavailable

2. Disconnect Connection

Use the disconnectConnection mutation to temporarily disconnect a data connection. Existing data remains in b.well, but future data syncs from this source are prevented until the connection is re-established.

GraphQL Mutation:

mutation disconnectConnection($connectionId: String!) {
  disconnectConnection(connectionId: $connectionId) {
    status
    statusUpdated
  }
}

Example Variables:

{
  "connectionId": "epic_on_fhir_sandbox"
}

Example Response:

{
  "data": {
    "disconnectConnection": {
      "status": "DISCONNECTED",
      "statusUpdated": "2025-08-20T20:51:12.513000"
    }
  }
}

3. Delete Connection

Use the deleteConnection mutation to permanently delete a data connection. All existing data from this connection is removed, and future data syncs are prevented.

GraphQL Mutation:

mutation deleteConnection($connectionId: String!) {
  deleteConnection(connectionId: $connectionId) {
    status
    statusUpdated
  }
}

Example Variables:

{
  "connectionId": "proa_demo"
}

Example Response:

{
  "data": {
    "deleteConnection": {
      "status": "DELETED",
      "statusUpdated": "2025-08-20T21:00:07.067000"
    }
  }
}

4. Re-Connect a Disconnected or Deleted Connection

Connections with a status of EXPIRED, DISCONNECTED, or DELETED can be re-established by generating a new OAuth authorization URL.

For connections with integrationType of PROA, use the connection id as the connectionId in the getOauthUrl query to generate a new OAuth authorization URL. Direct the user to this URL to re-authenticate and re-establish the connection.

See Steps 3 & 4 in the Search for & Establish Connections workflow guide for complete OAuth re-authentication details.