# Synapse Platform Profile

## Overview

[Synapse](https://www.synapse.org/) is Sage Bionetworks' collaborative data platform for biomedical research. It provides DRS-compatible object access, data governance, and provenance tracking.

## Supported GA4GH Specs

| Spec | Support | Notes |
|------|---------|-------|
| DRS v1.4 | Full | Native DRS endpoints for file access |
| Data Connect v1 | Partial | SQL-like queries via Synapse tables |
| Passports v1 | Planned | OAuth2 with GA4GH Passport visas |
| DUO | Full | Data use conditions on datasets |

## Configuration

```toml
# profiles/synapse.toml
[platform]
name = "synapse"
display_name = "Sage Bionetworks Synapse"
base_url = "https://repo-prod.prod.sagebase.org"

[auth]
method = "bearer"
token_env = "SYNAPSE_AUTH_TOKEN"
# Get a personal access token from https://www.synapse.org/#!PersonalAccessTokens:

[drs]
enabled = true
base_url = "https://repo-prod.prod.sagebase.org/repo/v1"
# DRS URIs use the compact identifier format: drs://repo-prod.prod.sagebase.org/syn12345

[data_connect]
enabled = true
base_url = "https://repo-prod.prod.sagebase.org/repo/v1"
```

## Quick Start

```python
from ai4gh.specs.drs.client import DRSClient

async with DRSClient(
    base_url="https://repo-prod.prod.sagebase.org/repo/v1",
    headers={"Authorization": f"Bearer {token}"},
) as client:
    obj = await client.get_object("syn12345")
    print(obj.name, obj.size)
```

## Authentication

Synapse uses personal access tokens for API authentication:

1. Log in to [Synapse](https://www.synapse.org/)
2. Navigate to Account Settings > Personal Access Tokens
3. Create a token with appropriate scopes
4. Set `SYNAPSE_AUTH_TOKEN` environment variable

```bash
export SYNAPSE_AUTH_TOKEN="your-token-here"
```

## Compliance Testing

```bash
ai4gh test drs https://repo-prod.prod.sagebase.org/repo/v1 \
  --header "Authorization: Bearer $SYNAPSE_AUTH_TOKEN"
```
