Content & AI API
Leverage Ally, Affilync's AI marketing assistant, to generate promotional content, images, video scripts, and schedule social media posts programmatically.
Generate Post Content
curl -X POST https://api.affilync.com/api/ai/content/generate \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "social_post",
"platform": "instagram",
"campaign_id": "camp_abc123",
"topic": "Summer fitness collection launch",
"tone": "energetic",
"include_hashtags": true
}'
Response (200):
{
"data": {
"content": "🏋️ Summer is here and so is your transformation!\n\nOur new fitness collection has everything you need...",
"hashtags": ["#FitnessGoals", "#SummerFit", "#WorkoutGear"],
"estimated_engagement": "high",
"character_count": 245
}
}
Supported types: social_post, email, blog_outline, product_review, video_script, ad_copy
Supported platforms: instagram, twitter, facebook, linkedin, tiktok, youtube
Generate Image
curl -X POST https://api.affilync.com/api/ai/images/generate \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Modern fitness equipment on a clean white background",
"style": "product_photo",
"size": "1024x1024"
}'
Response (200):
{
"data": {
"image_url": "https://cdn.affilync.com/generated/img_abc123.png",
"prompt_used": "Modern fitness equipment...",
"size": "1024x1024"
}
}
Generate Video Script
curl -X POST https://api.affilync.com/api/ai/scripts/generate \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"product_name": "FitPro Bundle",
"duration_seconds": 60,
"platform": "tiktok",
"style": "review"
}'
Social Scheduling
Schedule a Post
curl -X POST https://api.affilync.com/api/social/schedule \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"content": "Check out this amazing deal! 🔥",
"platforms": ["instagram", "twitter", "facebook"],
"scheduled_at": "2026-03-25T14:00:00Z",
"image_url": "https://cdn.affilync.com/generated/img_abc123.png",
"tracking_link": "https://track.affilync.com/s/abc123"
}'
Response (201):
{
"data": {
"post_id": "post_abc123",
"platforms": ["instagram", "twitter", "facebook"],
"scheduled_at": "2026-03-25T14:00:00Z",
"status": "scheduled"
}
}
List Scheduled Posts
curl https://api.affilync.com/api/social/scheduled \
-H "Authorization: Bearer YOUR_TOKEN"
Get Optimal Posting Times
curl https://api.affilync.com/api/social/optimal-times?platform=instagram \
-H "Authorization: Bearer YOUR_TOKEN"
Response (200):
{
"data": {
"platform": "instagram",
"recommended_times": [
{ "day": "monday", "time": "12:00", "engagement_score": 92 },
{ "day": "wednesday", "time": "18:00", "engagement_score": 88 },
{ "day": "friday", "time": "09:00", "engagement_score": 85 }
]
}
}
Connected Social Accounts
List Connected Accounts
curl https://api.affilync.com/api/social/accounts \
-H "Authorization: Bearer YOUR_TOKEN"
Connect Account
Initiate OAuth flow for a social platform.
curl -X POST https://api.affilync.com/api/social/connect \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "platform": "instagram" }'
Returns an auth_url to redirect the user to for OAuth authorization.
Agentic Workflows
Ally can execute multi-step workflows from a single natural language command.
curl -X POST https://api.affilync.com/api/ai/chat \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "Create a post about my summer campaign, generate an image, and schedule it to Instagram for tomorrow at noon"
}'
Ally will automatically:
- Generate post copy optimized for Instagram
- Create a promotional image
- Schedule both to Instagram at the requested time
- Return results for each step
Response (200):
{
"data": {
"response": "Done! I've created your post, generated an image, and scheduled both to Instagram for March 25 at 12:00 PM.",
"actions_taken": [
{ "tool": "generate_post", "status": "success" },
{ "tool": "generate_image", "status": "success" },
{ "tool": "schedule_post", "status": "success" }
]
}
}
Rate Limits
AI content generation is rate-limited based on your subscription tier. Free plans: 10 generations/day. Pro plans: 100/day. Business+: Unlimited.