:::note[Fail-open by default]
Every example returns `None` when the API is unreachable. Always let the user through when Syvel is unavailable — never block a registration because of a third-party service.
:::

No Syvel package needed — only `httpx` or `requests`.

## With httpx

```python
import os
import httpx

def check_email(email: str) -> dict | None:
    """
    Returns the Syvel check result, or None if the API is unavailable.
    Always fail open: return None and let the user through.
    """
    try:
        response = httpx.get(
            f"https://api.syvel.io/v1/check/{email}",
            headers={"Authorization": f"Bearer {os.environ['SYVEL_API_KEY']}"},
            timeout=3.0,  # 3 s max — never block the user
        )
        if not response.is_success:
            return None  # quota exceeded or server error → fail open
        return response.json()
    except Exception:
        return None  # network error or timeout → fail open


# In a Django / FastAPI / Flask view:
result = check_email(email)

if result and result.get("is_risky"):
    raise ValidationError("Please use a professional email address.")

# result is None → Syvel unavailable, let the user through
```

## Django REST Framework

```python
from rest_framework import serializers
import os
import httpx


class RegisterSerializer(serializers.Serializer):
    email = serializers.EmailField()

    def validate_email(self, value):
        try:
            res = httpx.get(
                f"https://api.syvel.io/v1/check/{value}",
                headers={"Authorization": f"Bearer {os.environ['SYVEL_API_KEY']}"},
                timeout=3.0,
            )
            if res.is_success and res.json().get("is_risky"):
                raise serializers.ValidationError(
                    "Please use a professional email address."
                )
        except httpx.RequestError:
            pass  # fail open — Syvel unavailable, let the user through
        return value
```

## FastAPI (async)

```python
from fastapi import FastAPI, HTTPException
import os
import httpx

app = FastAPI()


async def check_email(email: str) -> dict | None:
    try:
        async with httpx.AsyncClient() as client:
            res = await client.get(
                f"https://api.syvel.io/v1/check/{email}",
                headers={"Authorization": f"Bearer {os.environ['SYVEL_API_KEY']}"},
                timeout=3.0,
            )
        if not res.is_success:
            return None
        return res.json()
    except Exception:
        return None


@app.post("/register")
async def register(email: str):
    result = await check_email(email)
    if result and result.get("is_risky"):
        raise HTTPException(
            status_code=422,
            detail="Please use a professional email address.",
        )
    # continue with registration…
```

## With requests

```python
import os
import requests


def check_email(email: str) -> dict | None:
    try:
        response = requests.get(
            f"https://api.syvel.io/v1/check/{email}",
            headers={"Authorization": f"Bearer {os.environ['SYVEL_API_KEY']}"},
            timeout=3,
        )
        if not response.ok:
            return None
        return response.json()
    except Exception:
        return None
```

## Resources

- [API reference — Domain check](/docs/api/check)
- [Authentication](/docs/guides/authentication)
- [Error codes](/docs/guides/errors)
- [Python SDK](/docs/integrations/python)