Skip to main content

Endpoint

POST /api/v1/pulse/theta/{provider_slug}/unlink

Overview

Remove the connection between a user and their health device account. This revokes access tokens and deletes stored credentials.

Request

provider_slug
string
required
The provider slug to unlink (e.g., theta_garmin, theta_whoop)
user_id
string
required
The unique identifier for the user unlinking their account
curl -X POST http://localhost:18080/api/v1/pulse/theta/theta_garmin/unlink \
  -H "Content-Type: application/json" \
  -d '{"user_id": "user_123"}'

Response

{
  "success": true,
  "message": "Successfully unlinked provider",
  "provider_slug": "theta_garmin",
  "user_id": "user_123"
}

What Happens

When you unlink a provider:
1

Credentials Retrieved

System retrieves stored OAuth credentials for the user
2

Access Revoked (Optional)

If supported by the provider, access is revoked at the provider’s API
3

Credentials Deleted

All stored credentials are removed from the database
4

Link Removed

The user-provider link is marked as deleted
This action cannot be undone. The user will need to complete the OAuth flow again to reconnect.

Example Usage

import aiohttp

async def unlink_provider(user_id: str, provider_slug: str):
    url = f"http://localhost:18080/api/v1/pulse/theta/{provider_slug}/unlink"
    data = {"user_id": user_id}
    
    async with aiohttp.ClientSession() as session:
        async with session.post(url, json=data) as resp:
            result = await resp.json()
            return result

# Unlink provider
result = await unlink_provider("user_123", "theta_garmin")
print(f"Unlinked: {result['success']}")

Error Responses

{
  "success": true,
  "message": "No credentials found",
  "provider_slug": "theta_garmin",
  "user_id": "user_123"
}
{
  "error": {
    "code": "PROVIDER_NOT_FOUND",
    "message": "Provider 'theta_unknown' not found"
  }
}
Even if revoking access at the provider’s API fails, the local credentials are still deleted. Users should also revoke access through the provider’s website or app for complete disconnection.
After unlinking, any scheduled data syncs for this user-provider combination are automatically stopped.