Official Python SDK for the AgentRef Affiliate API
Project description
AgentRef Python SDK
Official Python SDK for the AgentRef REST API v1.
Install
pip install agentref
Quickstart
from agentref import AgentRef
client = AgentRef(api_key="ak_live_...")
programs = client.programs.list()
print(programs.meta.request_id)
Async quickstart
from agentref import AsyncAgentRef
async with AsyncAgentRef(api_key="ak_live_...") as client:
programs = await client.programs.list()
Authentication
- Uses
Authorization: Bearer <key>. - Supports
ak_live_*,ak_aff_*,ak_onb_*. - Provide
api_keydirectly or setAGENTREF_API_KEY.
Resources
client.programs:list,list_all,get,create,update,delete,stats,list_affiliates,list_coupons,create_coupon,create_inviteclient.affiliates:list,get,approve,block,unblockclient.conversions:list,stats,recentclient.payouts:list,list_pending,statsclient.flags:list,stats,resolveclient.billing:current,tiers,subscribeclient.merchant:get,domain_status
Pagination
List endpoints return PaginatedResponse[T] with:
meta.totalmeta.pagemeta.page_sizemeta.has_moremeta.next_cursormeta.request_id
Auto-pagination (list_all) stops on has_more is False.
Idempotency and retry behavior
- GET/HEAD: auto-retry on 429/5xx.
- POST: auto-retry only when
idempotency_keyis provided. - PATCH/DELETE: never auto-retry.
Idempotency-Keyheader is sent only for POST requests.
Error handling
from agentref import AgentRef
from agentref.errors import ForbiddenError, NotFoundError, RateLimitError, AgentRefError
client = AgentRef(api_key="ak_live_...")
try:
client.programs.get("missing-id")
except ForbiddenError as e:
print(e.code, e.request_id)
except NotFoundError as e:
print(e.request_id)
except RateLimitError as e:
print(e.retry_after)
except AgentRefError as e:
print(e.status)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
agentref-1.0.0.tar.gz
(10.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
agentref-1.0.0-py3-none-any.whl
(14.0 kB
view details)
File details
Details for the file agentref-1.0.0.tar.gz.
File metadata
- Download URL: agentref-1.0.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d805505eb5e121943f3fe52c7dc3369c87b023742fbc74510a984f8b4eaaf89f
|
|
| MD5 |
d82dd913fedd34b3a7a88729b3a34544
|
|
| BLAKE2b-256 |
b7a2e4733fe641d63f012fbef02502c256d3d996e98e7c2524ecf3621a62a229
|
File details
Details for the file agentref-1.0.0-py3-none-any.whl.
File metadata
- Download URL: agentref-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c56309e0b4f42fb84cd99c399443051615c46e30dc790e077f035eb8e7fb54ab
|
|
| MD5 |
a9f7189cdd1a567cd0c634f87caa2219
|
|
| BLAKE2b-256 |
860757f5f644cda1fcc9699d1fcfa07da3a21fb246d91b3fbaa2da6c5af21283
|