Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mag3nt.com/llms.txt

Use this file to discover all available pages before exploring further.

Installation

pip install mag3nt

Setup

import mag3nt
from mag3nt.models.components import Security
import os

sdk = mag3nt.Mag3nt(
    server_url="https://mag3nt.com",
    security=Security(bearer_auth=os.environ["MAG3NT_API_KEY"]),
)

Usage

# Issue a card
card = sdk.cards.cards_create(
    purpose="Research Agent",
    limit_amount=50,
)

# Check balance
balance = sdk.funding.funding_get_balance()

# List transactions
txns = sdk.cards.cards_list_transactions(id=card.card.id)

Async support

Every method has an async variant with the _async suffix:
import asyncio

async def main():
    cards = await sdk.cards.cards_list_async()
    balance = await sdk.funding.funding_get_balance_async()

asyncio.run(main())

Error handling

from mag3nt.models.errors import BalanceError, Mag3ntError

try:
    sdk.cards.cards_create(purpose="Agent", limit_amount=100)
except BalanceError as e:
    print(f"Need {e.requested}, have {e.available}")
except Mag3ntError as e:
    print(f"Error: {e.status_code}")

Available methods

ModuleDescription
sdk.authWallet authentication and sessions
sdk.cardsCard issuance, controls, and transactions
sdk.keysAPI key management
sdk.fundingBalance and withdrawals
sdk.x402x402 protocol payments
sdk.ap2Agent-to-agent payments
sdk.mppMicropayment streaming
sdk.pay_linksShareable payment links
sdk.settlementSettlement status
sdk.statusPlatform health
See the API Reference for full method documentation.