Marketing API
Use the Marketing API to manage campaigns, tasks, content calendar, analytics, and leads that power your acquisition, engagement, and retention workflows.
Base URL
All marketing endpoints are prefixed with:
All endpoints require a secret API key sent as a Bearer token in the Authorization header.
Campaign Management
Endpoints for listing, creating, updating, and deleting marketing campaigns for your project.
List Campaigns
Retrieve all campaigns for the current project.
Retrieve all marketing campaigns for the project.
curl -X GET "https://api.meetandrock.com/v1/dev/marketing/campaigns" \ -H "Authorization: Bearer YOUR_API_KEY"Create Campaign
Create a new marketing campaign with type, schedule, budget, target audience, and optional goals and KPIs.
Create a new marketing campaign.
curl -X POST "https://api.meetandrock.com/v1/dev/marketing/campaigns" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Summer Sale Campaign", "description": "Promotional campaign for summer products", "type": "sales", "status": "draft", "start_date": "2024-06-01T00:00:00Z", "end_date": "2024-08-31T23:59:59Z", "total_budget": 10000.00, "target_audience": { "age_range": [25, 45], "gender": ["male", "female"], "locations": ["US", "CA"], "interests": ["technology", "shopping"] }, "goals": { "primary": "Increase sales by 30%", "secondary": ["Brand awareness", "Customer retention"], "kpis": [ { "metric": "conversions", "target": 1000, "current": 0 } ] }, "channels": [ { "name": "Facebook Ads", "type": "social_media", "platform": "facebook", "budget_allocation": 5000.00, "start_date": "2024-06-01T00:00:00Z", "end_date": "2024-08-31T23:59:59Z" } ], "kpis": [ { "name": "Conversions", "target": 1000, "current": 0, "unit": "count" } ] }'Get Campaign
Retrieve details of a specific campaign by its ID.
Fetch a single marketing campaign by ID.
curl -X GET "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId" \ -H "Authorization: Bearer YOUR_API_KEY"Update Campaign
Update an existing campaign's core attributes such as name, budget, or description.
Update an existing marketing campaign.
curl -X PUT "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Updated Campaign Name", "total_budget": 15000.00, "description": "Updated description" }'Update Campaign Status
Change a campaign's lifecycle status between draft, active, paused, completed and cancelled.
Update the status of a marketing campaign.
curl -X PATCH "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/status" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "status": "active" }'Delete Campaign
Permanently delete a campaign by its ID.
Delete a marketing campaign.
curl -X DELETE "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId" \ -H "Authorization: Bearer YOUR_API_KEY"Campaign Tasks
Endpoints for managing execution tasks associated with a campaign.
List Campaign Tasks
Retrieve all tasks for a given campaign.
List all tasks for a specific campaign.
curl -X GET "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/tasks" \ -H "Authorization: Bearer YOUR_API_KEY"Create Campaign Task
Create a new task linked to a campaign, such as copywriting or asset production.
Create a new task for a campaign.
curl -X POST "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/tasks" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "Create ad copy", "description": "Write compelling ad copy for Facebook", "assigned_to": "uuid-here", "due_date": "2024-06-15T00:00:00Z", "status": "pending" }'Update Campaign Task
Update a campaign task's status or description as it moves through your workflow.
Update an existing campaign task.
curl -X PUT "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/tasks/:taskId" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "status": "completed", "description": "Updated description" }'Delete Campaign Task
Delete a campaign task that is no longer needed.
Delete a task from a campaign.
curl -X DELETE "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/tasks/:taskId" \ -H "Authorization: Bearer YOUR_API_KEY"Content Calendar
Endpoints for managing scheduled content across channels within a campaign.
List Content
Retrieve all planned or published content items for a campaign.
List all content items for a campaign.
curl -X GET "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/content" \ -H "Authorization: Bearer YOUR_API_KEY"Create Content
Create a new content item with optional media attachments using multipart form-data.
Create a new content calendar entry.
curl -X POST "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/content" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: multipart/form-data" \ -F "title=New Blog Post" \ -F "content_type=blog" \ -F "scheduled_date=2024-06-15T10:00:00Z" \ -F "platform=wordpress" \ -F "status=draft" \ -F "content=Content description" \ -F "assigned_to=uuid-here" \ -F "media=@/path/to/file.png"Update Content
Update an existing content item, including status changes or replacing the media asset.
Update an existing content calendar item.
curl -X PUT "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/content/:contentId" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: multipart/form-data" \ -F "title=Updated Title" \ -F "status=published" \ -F "content=Updated content" \ -F "media=@/path/to/file.png"Delete Content
Delete a content calendar item when it is no longer required.
Delete a content item from a campaign.
curl -X DELETE "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/content/:contentId" \ -H "Authorization: Bearer YOUR_API_KEY"Campaign Analytics
Endpoints for tracking and querying analytics metrics for your campaigns.
Get Analytics
Retrieve analytics data for a campaign over a given date range and optional source.
Retrieve analytics data for a campaign.
curl -X GET "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/analytics?start_date=2024-06-01&end_date=2024-06-30&source=facebook" \ -H "Authorization: Bearer YOUR_API_KEY"Track Analytics
Record analytics metrics like impressions, clicks, conversions, cost, and revenue for a campaign.
Record analytics metrics for a campaign.
curl -X POST "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/analytics" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "date": "2024-06-15", "source": "facebook", "metrics": { "impressions": 10000, "clicks": 500, "conversions": 50, "cost": 250.00, "revenue": 5000.00, "custom_metrics": { "engagement_rate": 0.05 } } }'Get Analytics Summary
Get an aggregated analytics summary for a campaign over a date range.
Fetch aggregated analytics summary for a campaign.
curl -X GET "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/analytics/summary?start_date=2024-06-01&end_date=2024-06-30" \ -H "Authorization: Bearer YOUR_API_KEY"Campaign Leads
Endpoints for managing leads generated by your marketing campaigns.
List Campaign Leads
Retrieve all leads for a campaign, optionally filtered by status or search query.
List leads for a campaign.
curl -X GET "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/leads?status=new&search=john" \ -H "Authorization: Bearer YOUR_API_KEY"Create Campaign Lead
Create a new lead record for a campaign with email, name, and optional metadata.
Create a new lead for a campaign.
curl -X POST "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/leads" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "John Doe", "email": "john@example.com", "phone": "+1234567890", "source": "facebook", "status": "new", "notes": "Interested in product", "custom_fields": { "referral_code": "SUMMER2024" } }'Update Campaign Lead
Update an existing lead's status or notes as they progress through your funnel.
Update a campaign lead.
curl -X PUT "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/leads/:leadId" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "status": "contacted", "notes": "Follow up scheduled" }'Import Leads
Bulk import leads into a campaign from a CSV file.
Import leads from a CSV file.
curl -X POST "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/leads/import" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: multipart/form-data" \ -F "file=@/path/to/leads.csv"Export Leads
Export all leads for a campaign to a CSV file.
Export campaign leads to a CSV file.
curl -X GET "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/leads/export" \ -H "Authorization: Bearer YOUR_API_KEY" -o leads.csvDelete Campaign Lead
Delete an individual lead from a campaign.
Delete a lead from a campaign.
curl -X DELETE "https://api.meetandrock.com/v1/dev/marketing/campaigns/:campaignId/leads/:leadId" \ -H "Authorization: Bearer YOUR_API_KEY"Error responses
Typical error payloads you may encounter when working with the Marketing API.
400 Bad Request
{
"message": "Invalid request parameters"
}
401 Unauthorized
{
"message": "Invalid or missing API key"
}
404 Not Found
{
"message": "Campaign not found"
}
500 Internal Server Error
{
"message": "Something went wrong"
}