import httpx
from datetime import datetime, timedelta, timezone
API_KEY = "mk_live_your_key_here"
BIZ_ID = "your-business-id"
BASE = "https://api.mymarky.ai/api"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
# 1. Create a post
resp = httpx.post(f"{BASE}/businesses/{BIZ_ID}/posts", headers=HEADERS, json={
"caption": "Why consistent social posting matters for small businesses #SmallBusiness",
"restrict_publish_to": ["instagram", "linkedin"],
})
post = resp.json()
# 2. Schedule it
publish_time = datetime.now(timezone.utc) + timedelta(days=1)
httpx.post(f"{BASE}/businesses/{BIZ_ID}/posts/{post['id']}/schedule", headers=HEADERS, json={
"scheduled_publish_time": publish_time.isoformat(),
})