Metadata-Version: 2.4
Name: verisafe-aml
Version: 0.1.0
Summary: Official Python SDK for the VeriSafe AML public REST API. Manage personas, operaciones, beneficial owners and ownership graphs, plus a webhook signature verifier — for sujetos obligados under Spain's Ley 10/2010 + EU AMLR.
Project-URL: Homepage, https://www.verisafeaml.com/api-docs
Project-URL: Documentation, https://github.com/verisafe-aml/verisafe-aml-sdk-python
Project-URL: Repository, https://github.com/verisafe-aml/verisafe-aml-sdk-python
Project-URL: Issues, https://github.com/verisafe-aml/verisafe-aml-sdk-python/issues
Author-email: ARWEN VENTURES SL <soporte@verisafeaml.com>
License: MIT License
        
        Copyright (c) 2026 ARWEN VENTURES SL (VeriSafe AML)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: aml,amlr,compliance,kyc,ley-10-2010,sepblac,spain,verisafe
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.9
Requires-Dist: httpx>=0.25
Requires-Dist: pydantic>=2.0
Description-Content-Type: text/markdown

# verisafe-aml (Python SDK)

Official Python SDK for the [VeriSafe AML](https://www.verisafeaml.com) public REST API. Companion to the Node SDK ([@verisafe-aml/sdk](https://www.npmjs.com/package/@verisafe-aml/sdk)).

[![PyPI version](https://img.shields.io/pypi/v/verisafe-aml.svg)](https://pypi.org/project/verisafe-aml/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

## Status

**0.1.0 — alpha.** Core surface (`people` + `operations`) is shipped; nested resources (documents, addresses, beneficial owners, ownership graph, tickets, entities) land in 0.2.0+. The Node SDK has the full surface — use it if you need everything today.

## Install

```bash
pip install verisafe-aml
```

Requires Python ≥3.9.

## Quick start

```python
import os
from verisafe_aml import VeriSafeAML

client = VeriSafeAML(api_key=os.environ["VERISAFE_API_KEY"])

# Create a person
created = client.people.create(
    external_id="crm-1234",
    type="individual",
    full_name="María García López",
    identification_type="dni",
    identification_number="12345678Z",
    identification_country="ES",
    nationality="ES",
    country_of_residence="ES",
)

# Ingest an operation
client.operations.create(
    external_id="op-2026-04-001",
    operation_date="2026-04-15",
    amount=12500,
    currency="EUR",
    payment_method="transferencia",
    parties=[
        {"person_external_id": "crm-1234", "role": "ordenante"},
        {"person_external_id": "vendor-5678", "role": "beneficiario"},
    ],
)

# Incremental sync
last = "2026-05-01T00:00:00Z"
while True:
    page = client.operations.list(modified_since=last, page_size=100)
    if not page["data"]:
        break
    for op in page["data"]:
        my_system.upsert_operation(op)
        last = op["updated_at"]
```

## Webhook signature verification

```python
from fastapi import FastAPI, Request, HTTPException
from verisafe_aml import verify_webhook_signature
import os

app = FastAPI()
SECRET = os.environ["VERISAFE_WEBHOOK_SECRET"]

@app.post("/webhooks/verisafe")
async def webhook(request: Request):
    body = await request.body()  # raw bytes — do NOT use await request.json()
    signature = request.headers.get("X-VeriSafe-Signature")
    if not verify_webhook_signature(body, signature, SECRET):
        raise HTTPException(401, "Invalid signature")
    event = request.headers.get("X-VeriSafe-Event")
    payload = await request.json()
    # dispatch on event ...
    return {"ok": True}
```

## Idempotency, rate limits, errors

Same semantics as the Node SDK — see the [API docs](https://www.verisafeaml.com/api-docs) for details. The client retries automatically on 429 (respecting `Retry-After`) and on transient 5xx with exponential backoff.

```python
from verisafe_aml import VeriSafeAMLApiError

try:
    client.people.create(...)
except VeriSafeAMLApiError as e:
    if e.code == "INSUFFICIENT_CREDITS":
        # ...
        pass
    raise
```

## Development

```bash
pip install -e '.[dev]'
pytest
```

## Roadmap

- [ ] 0.2.0: nested document/address/SMO/BO resources
- [ ] 0.3.0: ownership graph + tickets + entities (read-only screenings/alerts/cases)
- [ ] 0.4.0: typed Pydantic models for all responses
- [ ] 1.0.0: async variant via httpx.AsyncClient

## Links

- **API docs**: <https://www.verisafeaml.com/api-docs>
- **Help center**: <https://www.verisafeaml.com/help>
- **Node SDK (full surface)**: <https://github.com/verisafe-aml/verisafe-aml-sdk-node>

## License

MIT © ARWEN VENTURES SL (VeriSafe AML)
