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, delete_coupon, list_invites, create_invite, update_marketplace
  • client.affiliates: list, get, approve, block, unblock
  • client.conversions: list, stats, recent
  • client.payouts: list, list_pending, stats, create
  • client.flags: list, stats, resolve
  • client.billing: current, tiers, subscribe
  • client.merchant: get, update, connect_stripe, 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-2.0.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

agentref-2.0.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agentref-2.0.0.tar.gz
Algorithm Hash digest
SHA256 58446aef7a1fa21a2031ba67dedba9a23b5927bb5d6297e4ff4b6b38ff8bb842
MD5 235396928ab0e9702c504629de3a4cb0
BLAKE2b-256 d281317d4c6431a91caa668a372457304b4ed6359fb554d5add98959e1eb4aa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentref-2.0.0.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-2.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for agentref-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1099a8eb0d044c6b8bb29a29487ee344561f8b35343b7f8a3d9794d4e6e26e15
MD5 6b925ddf1cddc1a893bab2d8ff9de2b0
BLAKE2b-256 ca4c34114c4e4558ef33e9dcada16255a7c49730ce12ed1574785de2153b34b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentref-2.0.0-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