API Integration
Learn how to integrate Mediajinn with your existing systems using our comprehensive API.
Overview
Mediajinn's API allows you to automate workflows, integrate with other tools in your marketing stack, and extend the platform's functionality. You can access most of Mediajinn's features programmatically, enabling custom applications and integrations.
Note: API access is available on Business and Enterprise plans only. See our pricing documentation for more details.
Getting Started
Authentication
All API requests require authentication using an API key:
- Navigate to Settings → API in your Mediajinn dashboard
- Click Generate API Key
- Give your key a descriptive name (e.g., "Website Integration", "CRM Connection")
- Select the permission scopes needed for your integration
- Click Create Key
- Store your API key securely - it will only be shown once
Include your API key in all requests using the Authorization header:
Authorization: Bearer YOUR_API_KEYBase URL
All API endpoints use the following base URL:
https://api.mediajinn.ai/v1Response Format
All API responses are returned in JSON format with standard HTTP status codes:
- 200 OK: Request successful
- 201 Created: Resource created successfully
- 400 Bad Request: Invalid request parameters
- 401 Unauthorized: Invalid or missing API key
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Resource not found
- 429 Too Many Requests: Rate limit exceeded
- 500 Server Error: Internal server error
Key API Endpoints
Content Management
Create, retrieve, update, and delete content:
# Get all content
GET /content
# Get specific content by ID
GET /content/{content_id}
# Create new content
POST /content
# Update existing content
PUT /content/{content_id}
# Delete content
DELETE /content/{content_id}
# Generate AI content
POST /content/generateExample request to generate AI content:
POST /content/generate
{
"platform": "facebook",
"content_type": "post",
"brief": {
"topic": "Summer sale announcement",
"tone": "exciting",
"length": "short",
"include_keywords": ["discount", "limited time", "exclusive"],
"call_to_action": "Shop now"
},
"variations": 3
}Scheduling
Manage your content publishing schedule:
# Get all scheduled content
GET /schedule
# Get specific scheduled item
GET /schedule/{schedule_id}
# Schedule new content
POST /schedule
# Update schedule
PUT /schedule/{schedule_id}
# Delete scheduled item
DELETE /schedule/{schedule_id}
# Get optimal posting times
GET /schedule/optimal-timesExample request to schedule a post:
POST /schedule
{
"content_id": "cont_12345",
"platforms": ["facebook", "instagram"],
"scheduled_time": "2025-05-15T15:30:00Z",
"settings": {
"first_comment": "Let us know what you think in the comments!",
"geo_targeting": {
"countries": ["US", "CA"]
}
}
}Analytics
Retrieve performance metrics and insights:
# Get account overview metrics
GET /analytics/overview
# Get content performance
GET /analytics/content
# Get audience insights
GET /analytics/audience
# Get campaign performance
GET /analytics/campaigns/{campaign_id}
# Get custom report
GET /analytics/reports/{report_id}Example request to get content performance:
GET /analytics/content?start_date=2025-04-01&end_date=2025-04-30&platform=facebook&limit=10Ad Management
Create and manage advertising campaigns:
# Get all campaigns
GET /ads/campaigns
# Create new campaign
POST /ads/campaigns
# Get campaign details
GET /ads/campaigns/{campaign_id}
# Update campaign
PUT /ads/campaigns/{campaign_id}
# Create ad set
POST /ads/campaigns/{campaign_id}/adsets
# Create ad creative
POST /ads/campaigns/{campaign_id}/adsets/{adset_id}/adsWebhook Integration
Subscribe to real-time events from Mediajinn:
- Go to Settings → Webhooks
- Click Add Webhook
- Enter the URL where you want to receive webhook notifications
- Select the events you want to subscribe to:
- content.created
- content.published
- content.performance_update
- campaign.status_change
- audience.threshold_reached
- Set up any optional filters
- Click Save Webhook
Webhook Payload Example
{
"event": "content.published",
"timestamp": "2025-04-10T14:32:18Z",
"content": {
"id": "cont_67890",
"type": "post",
"platform": "instagram",
"platform_post_id": "12345678901234567",
"url": "https://instagram.com/p/AbCdEfGhIjK/",
"performance": {
"impressions": 0,
"likes": 0,
"comments": 0,
"shares": 0
}
}
}Common Integration Scenarios
CRM Integration
Connect Mediajinn with your CRM system:
- Sync audience data between platforms
- Create content based on CRM segments
- Track social engagement in customer records
- Trigger social campaigns based on CRM events
E-commerce Integration
Integrate with your online store:
- Automatically create posts for new products
- Generate ads for products with low inventory
- Track social media conversions to your store
- Create dynamic ads from your product catalog
Custom Reporting Dashboards
Build your own performance dashboards:
- Pull Mediajinn data into existing business intelligence tools
- Combine social data with other marketing channel metrics
- Create custom visualizations and reports
- Automate reporting for stakeholders
API Limits and Quotas
| Plan | Rate Limit | Daily Quota |
|---|---|---|
| Business | 100 requests/minute | 10,000 requests |
| Enterprise | 250 requests/minute | 50,000 requests |
Security Best Practices
- Never expose your API key in client-side code
- Implement IP whitelisting for additional security
- Use the minimum required scopes for each integration
- Regularly audit and rotate your API keys
- Implement proper error handling in your integrations
- Set up monitoring for unusual API usage patterns
Getting Help
If you need assistance with the API:
- Consult the detailed API reference
- Check our GitHub repository for code examples
- Join our developer community
- Contact api-support@mediajinn.ai for technical help