Skip to content
On this page

Python SDK

Official Python client for the Aegis API. Supports Python 3.9+.

Installation

bash
pip install aegis-sdk
# or
poetry add aegis-sdk

Quick Start

python
from aegis import Aegis

client = Aegis(
    api_key=os.environ["AEGIS_API_KEY"],
    environment="production",
)

result = client.verify.cpf(
    cpf="12345678901",
    name="JOAO SILVA SANTOS",
)

print(result.status)  # 'verified'
print(result.score)   # 723

Configuration

python
client = Aegis(
    api_key=os.environ["AEGIS_API_KEY"],
    environment="production",
    timeout=10.0,       # seconds
    max_retries=3,
    webhook_secret="whsec_...",
)

Methods

verify.cpf()

python
result = client.verify.cpf(
    cpf="12345678901",
    name="JOAO SILVA SANTOS",
    birth_date="1990-01-15",
)

verify.cnpj()

python
result = client.verify.cnpj(
    cnpj="12345678000199",
    company_name="ACME LTDA",
)

Error Handling

python
from aegis.exceptions import AegisError, RateLimitError

try:
    result = client.verify.cpf(cpf="12345678901")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")
except AegisError as e:
    print(f"API error: {e.code} - {e.message}")

GitHub

github.com/aegis-tech/python-sdk

Released under the MIT License.