Integration Guide
Everything you need to integrate with Pivota Agent API
Choose your language:
1. Installation
pip install pivota-agent
2. Quick Start
from pivota_agent import PivotaAgentClient
# Initialize client
client = PivotaAgentClient(api_key="YOUR_API_KEY")
# Search products
products = client.search_products(
query="laptop",
merchant_id="merch_6b90dc9838d5fd9c"
)
# Create order
order = client.create_order(
merchant_id="merch_6b90dc9838d5fd9c",
items=[{"product_id": products[0]["id"], "quantity": 1}],
customer_email="customer@example.com"
)
print(f"Order created: " + "{order['order_id']}")3. Complete Example
from pivota_agent import PivotaAgentClient
client = PivotaAgentClient(api_key="YOUR_API_KEY")
# 1. List available merchants
merchants = client.list_merchants()
print(f"Found {len(merchants)} merchants")
# 2. Search products
products = client.search_products(
query="coffee mug",
merchant_id=merchants[0]["merchant_id"],
limit=10
)
# 3. Get product details
product = client.get_product(
product_id=products[0]["id"],
merchant_id=merchants[0]["merchant_id"]
)
# 4. Create an order
order = client.create_order(
merchant_id=merchants[0]["merchant_id"],
items=[{
"product_id": product["id"],
"quantity": 2,
"price": product["price"]
}],
customer_email="customer@example.com",
shipping_address={
"name": "John Doe",
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94102",
"country": "US"
}
)
print(f"✅ Order " + "{order['order_id']}" + " created successfully!")
print(f"💰 Total: $" + "{order['total']}")