Metadata-Version: 2.4
Name: accreditednow
Version: 1.1.1
Summary: Official AccreditedNow API client: CPA-signed accredited investor verification for Rule 506(c), investor screening and signed webhooks.
Author: AccreditedNow LLC
License: MIT
Project-URL: Homepage, https://accreditednow.org/developers
Project-URL: Documentation, https://accreditednow.org/verification-api
Keywords: accredited investor,506(c),verification,kyc,aml
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# AccreditedNow for Python

The official client for the [AccreditedNow API](https://accreditednow.org/verification-api): CPA-signed accredited investor verification for Rule 506(c), investor sanctions screening, and signed webhooks. Python 3.8 or newer; standard library only.

```
pip install accreditednow
```

## Quick start

```python
import os
from accreditednow import AccreditedNow, AccreditedNowError

an = AccreditedNow(os.environ["ACCREDITEDNOW_API_KEY"])   # sk_test_... for the sandbox

v = an.verifications.create({
    "investor": {"first_name": "Ada", "last_name": "Lovelace", "email": "ada@example.com"},
    "external_id": "crm-123",
})
print(v["hosted_url"])   # send the investor here

latest = an.verifications.retrieve(v["id"])
if latest["needs_info"]:
    print("The CPA asked for more documents on", latest["documents_requested_at"])

for x in an.verifications.list_all(status="verified"):
    print(x["id"], x["expiration_date"])

an.verifications.request_reconfirmation(v["id"])   # emails the investor a re-confirmation link
print(an.verifications.letter_url(v["id"])["letter_url"])
```

Creates and other de-duplicated POSTs get an `Idempotency-Key` automatically, so the client can retry them safely after a timeout. Pass `idempotency_key="..."` to use your own.

Errors raise `AccreditedNowError` with `status`, `type` (the API's error type, e.g. `not_found`), `param` and `retry_at`.

## Webhooks

```python
from accreditednow import webhooks

# Flask: use the RAW body (request.get_data()), not parsed JSON.
@app.post("/accreditednow")
def hook():
    try:
        event = webhooks.construct_event(request.get_data(), request.headers.get("X-AccreditedNow-Signature"), os.environ["ACCREDITEDNOW_WEBHOOK_SECRET"])
    except AccreditedNowError:
        return "", 400
    if event["event"] == "verification.needs_info":
        pass  # nudge the investor
    return "", 200
```

## Sandbox

With an `sk_test_` key, `an.verifications.complete(id)` and `an.verifications.request_documents(id)` simulate the CPA's decision and send `livemode: false` webhooks to your endpoint.

## All methods

- `verifications`: `create`, `list`, `list_all`, `retrieve`, `letter_url`, `request_reconfirmation`, `add_photo_id`, `add_owner`, `remove_owner`, `complete` (sandbox), `request_documents` (sandbox)
- `funds`: `list`, `create`
- `screenings`: `create`, `list`, `list_all`, `retrieve`, `remove`, `dismiss`, `contact.get`, `contact.set`, `contact.clear`
- `webhooks`: `verify`, `construct_event`, `sign`

Full reference: https://accreditednow.org/verification-api · OpenAPI: https://accreditednow.org/openapi-v1.json
