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-1.0.2.tar.gz (12.6 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.2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentref-1.0.2.tar.gz
  • Upload date:
  • Size: 12.6 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.2.tar.gz
Algorithm Hash digest
SHA256 4f5f76bc8c0f97f058dc5542d4af0f9e5d4a922f48da4901d75a8b3b3db3c208
MD5 fe881e2bb4e2344145ddd4f757764eb7
BLAKE2b-256 38b3fae88745c99ae703985ea6f3a2cb4fb69f9a3682017fa6ec61970e13e2c9

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: agentref-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 15.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4f3bdbe86b24d92d555d79b193f849f27459fdbffdd1d3b883497d1d1ba696bb
MD5 7637ca0b4f404a14c8595448f5aa9255
BLAKE2b-256 37b7634b7691d1f8a045a48dbf1ab453b0aa6cd179909c5cc3137decc04d514d

See more details on using hashes here.

Provenance

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