Skip to main content

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_key directly or set AGENTREF_API_KEY.

Resources

  • client.programs: list, list_all, get, create, update, delete, stats, list_affiliates, list_coupons, create_coupon, create_invite
  • client.affiliates: list, get, approve, block, unblock
  • client.conversions: list, stats, recent
  • client.payouts: list, list_pending, stats
  • client.flags: list, stats, resolve
  • client.billing: current, tiers, subscribe
  • client.merchant: get, domain_status

Pagination

List endpoints return PaginatedResponse[T] with:

  • meta.total
  • meta.page
  • meta.page_size
  • meta.has_more
  • meta.next_cursor
  • meta.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_key is provided.
  • PATCH/DELETE: never auto-retry.
  • Idempotency-Key header 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


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.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentref-1.0.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file agentref-1.0.1.tar.gz.

File metadata

  • Download URL: agentref-1.0.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentref-1.0.1.tar.gz
Algorithm Hash digest
SHA256 621d0e0059ca0950fd2896b5b8b48b01776c38c9e9781bae66df18e45bb34bad
MD5 b6c9277e9809208b4babbaa004aa68ad
BLAKE2b-256 7cc666627a018ffd3c001d82d7eaeed13a7218bd3a7e56792e09f7fca7800dcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentref-1.0.1.tar.gz:

Publisher: publish.yml on LukasvanUden/agentref-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentref-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: agentref-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentref-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 501f54ad5874bdffb06bcd09b3c940c84f57f29206d1646061a7683d37e3c11c
MD5 05570bd62e4a4e381fd01f133e81ddd3
BLAKE2b-256 14cc1284bf7585165599368f2541039bec22665e4a46662d5b2d2d460ea7ad49

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentref-1.0.1-py3-none-any.whl:

Publisher: publish.yml on LukasvanUden/agentref-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page