Skip to main content

Content & AI API

Leverage Ally, Affilync's AI marketing assistant, to generate promotional content, images, video scripts, and manage social media content 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 '{
"content_type": "promotional",
"product": "Summer fitness collection",
"audience": "fitness enthusiasts aged 25-45",
"tone": "energetic",
"benefits": ["high-quality materials", "comfortable fit", "durable"],
"cta": "Shop Now"
}'

Response (200):

{
"data": {
"content": "🏋️ Summer is here and so is your transformation!\n\nOur new fitness collection has everything you need...",
"content_type": "promotional",
"character_count": 245
}
}

Supported content types: promotional, educational, engagement, product_review

Generate Social Post​

curl -X POST https://api.affilync.com/api/ai/social/create-post \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"platform": "instagram",
"campaign_id": "camp_abc123",
"content_type": "promotional",
"target_audience": "fitness enthusiasts",
"key_message": "New summer collection launch",
"tone": "energetic",
"length": "medium",
"include_image": true
}'

Response (200):

{
"data": {
"post_content": "🏋️ Summer is here and so is your transformation!...",
"platform": "instagram",
"character_count": 245,
"hashtags": ["#FitnessGoals", "#SummerFit", "#WorkoutGear"]
}
}

Supported platforms: instagram, twitter, facebook, linkedin, tiktok

Generate Social Caption​

Generate captions for campaign images across social platforms.

curl -X POST https://api.affilync.com/api/ai/caption/generate \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": "camp_abc123",
"image_context": "Product photo of summer fitness gear on white background",
"platform": "instagram",
"tone": "professional"
}'

Response (200):

{
"data": {
"caption": "Introducing our new summer collection...",
"character_count": 180,
"suggestions": ["Add call-to-action", "Include location tag"]
}
}

Generate AI Images​

Generate AI-powered images for your campaigns using advanced AI models.

curl -X POST https://api.affilync.com/api/script-generator-pro/generate-images \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Modern fitness equipment on a clean white background",
"style": "product",
"count": 2,
"aspect_ratio": "1:1"
}'

Response (200):

{
"data": {
"images": [
{
"id": "img_abc123",
"type": "ai-generated",
"url": "https://cdn.affilync.com/generated/img_abc123.png",
"prompt": "Modern fitness equipment on a clean white background"
},
{
"id": "img_def456",
"type": "ai-generated",
"url": "https://cdn.affilync.com/generated/img_def456.png",
"prompt": "Modern fitness equipment on a clean white background"
}
],
"generation_time_ms": 3420
}
}

Supported styles: realistic, anime, digital-art, cinematic, fantasy, product, marketing, 3d-figurine

Supported aspect ratios: 1:1, 16:9, 4:3, 9:16

Image Generation Requirements

Image generation requires Pro subscription or higher. Rate limits apply per tier.


Schedule Content​

Schedule your content to post at optimal times across platforms.

Schedule Content Post​

curl -X POST https://api.affilync.com/api/content/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-06-25T14:00:00Z",
"image_url": "https://cdn.affilync.com/generated/img_abc123.png"
}'

Response (201):

{
"data": {
"content_id": "content_abc123",
"platforms": ["instagram", "twitter", "facebook"],
"scheduled_at": "2026-06-25T14:00:00Z",
"status": "scheduled"
}
}

List Scheduled Content​

curl https://api.affilync.com/api/content/schedule \
-H "Authorization: Bearer YOUR_TOKEN"

Response (200):

{
"data": {
"items": [
{
"content_id": "content_abc123",
"content": "Check out this amazing deal!",
"scheduled_at": "2026-06-25T14:00:00Z",
"status": "scheduled",
"platforms": ["instagram", "twitter", "facebook"]
}
],
"total": 1
}
}

Analyze Competitors​

Get AI-powered insights on competitor strategies and positioning.

curl -X POST https://api.affilync.com/api/ai/competitors/analyze \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"competitors": [
{
"name": "CompetitorA",
"website": "https://competitor-a.com",
"description": "Fitness gear retailer"
}
],
"focus_areas": ["pricing", "messaging", "content_strategy"]
}'

Response (200):

{
"data": {
"analysis": {
"strengths": ["Strong social presence", "Competitive pricing"],
"weaknesses": ["Limited email marketing", "Poor mobile experience"],
"opportunities": ["Email automation", "Video content"],
"recommendations": ["Improve site speed", "Increase content frequency"]
}
}
}

AI Chat Assistant​

Chat with Ally, your AI marketing assistant, for personalized guidance and multi-step workflows. Ally chat requires a paid tier (Starter or above).

curl -X POST https://api.affilync.com/api/affiliate/ai-assistant/chat-simple \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "Create a post about my summer campaign and suggest a posting time",
"conversation_id": "conv_abc123",
"include_data": true
}'

Request Body:

FieldTypeRequiredDescription
messagestringYesYour message to Ally (1–2000 chars)
conversation_idstringNoMaintain context across turns; omit to start a new conversation
include_databooleanNoInclude your performance data in context (default true)

Response (200):

{
"success": true,
"message": "Success",
"data": {
"response": "Here's a promotional post for your summer campaign...",
"conversation_id": "conv_abc123",
"suggestions": ["Schedule for 6 PM", "Add a discount code"],
"confidence": 0.92,
"tier": "starter",
"function_results": []
}
}

When Ally executes tools on your behalf, the results are returned in function_results.

Get Conversation History​

curl "https://api.affilync.com/api/affiliate/ai-assistant/conversations?limit=10" \
-H "Authorization: Bearer YOUR_TOKEN"

Query Parameters: limit (1–100, default 20), offset (default 0), active_only (default true), include_archived (default false).

Response (200):

{
"success": true,
"data": {
"conversations": [
{
"id": "conv_abc123",
"conversation_id": "conv_abc123",
"title": "Summer campaign post",
"message_count": 4,
"total_tokens": 245,
"is_active": true,
"is_archived": false,
"created_at": "2026-06-20T10:30:00Z",
"last_message_at": "2026-06-20T10:35:00Z"
}
],
"total": 1,
"limit": 10,
"offset": 0,
"has_more": false
}
}

Submit Feedback​

curl -X POST https://api.affilync.com/api/affiliate/ai-assistant/feedback \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message_id": "msg_abc123",
"feedback": "positive"
}'

Request Body:

FieldTypeRequiredDescription
message_idstringYesID of the message to rate
feedbackstringYespositive or negative

Rate Limits​

AI endpoints are rate-limited based on your subscription tier. The limit is measured in API requests per hour.

TierRequests/HourRequests/Minute
Free103
Starter5010
Pro20030
Business50060
Agency75090
Enterprise1000120
Rate Limit Headers

Rate limit information is included in response headers:

  • X-RateLimit-Limit: Your hourly limit
  • X-RateLimit-Remaining: Requests remaining this hour
  • X-RateLimit-Reset: Unix timestamp when limit resets

Exceeding your tier's rate limit will return a 429 Too Many Requests response. Upgrade your subscription to increase limits.