Publishing API¶
Endpoints for immediate publishing and schedule management.
Publish Immediately¶
POST /publish
Publish content immediately, bypassing the schedule.
Request¶
curl -X POST https://api.amp.dev/v1/publish \
-H "Authorization: Bearer $AMP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content_id": "cnt_5zN1pSsU7yA9vW6x"
}'
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
content_id | string | Yes | Content to publish |
Response¶
{
"content_id": "cnt_5zN1pSsU7yA9vW6x",
"status": "published",
"published_at": "2024-01-15T10:30:15Z",
"platform": "twitter",
"platform_post_id": "1747293847293847",
"platform_url": "https://twitter.com/yourbrand/status/1747293847293847"
}
Schedule Publishing¶
POST /publish/schedule
Schedule content for future publishing.
Request¶
curl -X POST https://api.amp.dev/v1/publish/schedule \
-H "Authorization: Bearer $AMP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content_id": "cnt_5zN1pSsU7yA9vW6x",
"scheduled_for": "2024-01-16T09:00:00-05:00"
}'
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
content_id | string | Yes | Content to schedule |
scheduled_for | datetime | Yes | Publishing time (ISO 8601) |
use_optimal_time | boolean | No | Let AI choose optimal time |
Response¶
{
"content_id": "cnt_5zN1pSsU7yA9vW6x",
"status": "scheduled",
"scheduled_for": "2024-01-16T09:00:00-05:00",
"metricool_post_id": "mc_12345"
}
Cancel Scheduled Publishing¶
DELETE /publish/:content_id
Cancel a scheduled publication.
Request¶
curl -X DELETE https://api.amp.dev/v1/publish/cnt_5zN1pSsU7yA9vW6x \
-H "Authorization: Bearer $AMP_API_KEY"
Response¶
{
"content_id": "cnt_5zN1pSsU7yA9vW6x",
"status": "approved",
"previous_scheduled_for": "2024-01-16T09:00:00-05:00",
"cancelled_at": "2024-01-15T10:30:00Z"
}
Get Publishing Queue¶
GET /publish/queue
View all scheduled content.
Request¶
Query Parameters¶
| Parameter | Type | Description |
|---|---|---|
platform | string | Filter by platform |
mission_id | string | Filter by mission |
from | datetime | Scheduled after |
to | datetime | Scheduled before |
Response¶
{
"data": [
{
"content_id": "cnt_xxx",
"platform": "twitter",
"scheduled_for": "2024-01-16T09:00:00-05:00",
"mission_id": "msn_yyy",
"preview": "APIs shouldn't feel like puzzles..."
}
],
"has_more": false,
"total": 15
}
Optimal Posting Times¶
GET /publish/optimal-times
Get AI-recommended posting times based on historical performance.
Request¶
curl "https://api.amp.dev/v1/publish/optimal-times?platform=twitter" \
-H "Authorization: Bearer $AMP_API_KEY"
Response¶
{
"platform": "twitter",
"timezone": "America/New_York",
"optimal_times": [
{"day": "Tuesday", "time": "14:00", "score": 0.95},
{"day": "Wednesday", "time": "09:00", "score": 0.88},
{"day": "Thursday", "time": "14:00", "score": 0.85}
],
"avoid_times": [
{"day": "Saturday", "reason": "Low engagement historically"},
{"day": "Friday", "time": "17:00+", "reason": "Rapid engagement drop-off"}
],
"confidence": 0.82,
"based_on_posts": 145
}