Documentation Index
Fetch the complete documentation index at: https://docs.adrelay.dev/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Or with poetry:
Basic Usage
from adrelay import AdRelay
client = AdRelay(api_key="your-api-key-here")
# List all campaigns
campaigns = client.campaigns.list()
print(campaigns["unified"])
# List campaigns filtered by platform
google_campaigns = client.campaigns.list(
platform="google_ads",
status="ACTIVE",
)
# Create a campaign
campaign = client.campaigns.create(
name="Summer Sale 2026",
goal="CONVERSIONS",
budget_amount=50.00,
budget_period="DAILY",
platform="google_ads",
)
# Update a campaign
updated = client.campaigns.update("camp_abc123", status="ACTIVE", budget_amount=75.00)
# Delete a campaign
client.campaigns.delete("camp_abc123")
# List connections
connections = client.connections.list()
# Get billing status
billing = client.billing.status()
Configuration Options
client = AdRelay(
api_key="your-api-key-here",
base_url="https://api.adrelay.dev/v1", # default
timeout=30, # request timeout in seconds, default 30
)
Environment Variable
The SDK automatically reads the ADRELAY_API_KEY environment variable if no api_key is provided:
import os
os.environ["ADRELAY_API_KEY"] = "your-api-key-here"
client = AdRelay() # Uses ADRELAY_API_KEY from environment
Error Handling
from adrelay import AdRelay, AdRelayError
try:
campaign = client.campaigns.create(
name="Test",
goal="CONVERSIONS",
budget_amount=50,
budget_period="DAILY",
platform="google_ads",
)
except AdRelayError as e:
print(f"Error {e.code}: {e.message}")
print(f"Request ID: {e.request_id}")
Coming Soon
Advanced SDK features are under active development:
- Async client (
AsyncAdRelay)
- Automatic pagination iterators
- Webhook event parsing
- Retry with exponential backoff
- Multi-platform campaign builder
- Pydantic models for all API objects