API Reference¶
The AMP API is a RESTful JSON API that allows you to programmatically manage content missions, review generated content, and access analytics.
Base URL¶
For self-hosted deployments:
Authentication¶
All API requests require authentication via API key or JWT token:
See Authentication for details on obtaining and managing API keys.
Request Format¶
Headers¶
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer token (API key or JWT) |
Content-Type | For POST/PUT | application/json |
X-Tenant-ID | No | Override tenant context |
X-Request-ID | No | Custom request ID for tracing |
Idempotency-Key | No | Prevent duplicate operations |
Request Body¶
Send JSON for POST and PUT requests:
curl -X POST https://api.amp.dev/v1/missions \
-H "Authorization: Bearer $AMP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "My Mission",
"objectives": ["Drive awareness"],
"platforms": ["twitter"]
}'
Response Format¶
Success Response¶
{
"id": "msn_2xK9mPqR4vN8sT3w",
"name": "My Mission",
"status": "active",
"created_at": "2024-01-15T10:30:00Z"
}
List Response¶
{
"data": [
{"id": "msn_xxx", "name": "Mission 1"},
{"id": "msn_yyy", "name": "Mission 2"}
],
"has_more": true,
"total": 45
}
Error Response¶
{
"error": {
"code": "invalid_request",
"message": "The 'platforms' field is required",
"param": "platforms",
"doc_url": "https://docs.amp.dev/api/errors#invalid_request"
}
}
Pagination¶
List endpoints support cursor-based pagination:
# First page
curl "https://api.amp.dev/v1/missions?limit=20"
# Next page
curl "https://api.amp.dev/v1/missions?limit=20&starting_after=msn_xxx"
# Previous page
curl "https://api.amp.dev/v1/missions?limit=20&ending_before=msn_yyy"
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 20 | Results per page (1-100) |
starting_after | string | Cursor for next page | |
ending_before | string | Cursor for previous page |
Filtering¶
Many list endpoints support filtering:
# Filter by status
curl "https://api.amp.dev/v1/missions?status=active"
# Filter by date range
curl "https://api.amp.dev/v1/content?created_after=2024-01-01&created_before=2024-02-01"
# Multiple filters
curl "https://api.amp.dev/v1/content?mission_id=msn_xxx&status=published&platform=twitter"
Expanding Objects¶
Some endpoints support expanding related objects:
{
"id": "cnt_xxx",
"mission_id": "msn_yyy",
"mission": {
"id": "msn_yyy",
"name": "Developer Outreach"
}
}
Rate Limits¶
| Plan | Requests/Minute |
|---|---|
| Free | 60 |
| Pro | 300 |
| Enterprise | Custom |
Rate limit headers:
Versioning¶
The API is versioned via URL path (/v1/). We maintain backward compatibility within a version.
Breaking changes are introduced in new versions with a deprecation period for old versions.
API Endpoints¶
Authentication¶
| Method | Endpoint | Description |
|---|---|---|
POST | /auth/login | Authenticate user |
POST | /auth/refresh | Refresh token |
POST | /auth/logout | End session |
GET | /auth/whoami | Current user info |
POST | /auth/keys | Create API key |
GET | /auth/keys | List API keys |
DELETE | /auth/keys/:id | Revoke API key |
Missions¶
| Method | Endpoint | Description |
|---|---|---|
GET | /missions | List missions |
POST | /missions | Create mission |
GET | /missions/:id | Get mission |
PUT | /missions/:id | Update mission |
DELETE | /missions/:id | Delete mission |
POST | /missions/:id/pause | Pause mission |
POST | /missions/:id/resume | Resume mission |
Content¶
| Method | Endpoint | Description |
|---|---|---|
GET | /content | List content |
GET | /content/:id | Get content |
GET | /content/:id/preview | Preview content |
POST | /content/:id/approve | Approve content |
POST | /content/:id/reject | Reject content |
Publishing¶
| Method | Endpoint | Description |
|---|---|---|
POST | /publish | Publish immediately |
POST | /publish/schedule | Schedule publishing |
DELETE | /publish/:id | Cancel scheduled |
Analytics¶
| Method | Endpoint | Description |
|---|---|---|
GET | /analytics | Analytics overview |
GET | /analytics/missions/:id | Mission analytics |
GET | /analytics/performance | Performance metrics |
GET | /analytics/costs | Cost breakdown |
Integrations¶
| Method | Endpoint | Description |
|---|---|---|
POST | /connect/metricool | Connect Metricool |
GET | /connect/metricool/accounts | List accounts |
GET | /connect/status | Integration status |
SDKs¶
Official SDKs are available:
Testing¶
Use test mode API keys (amp_test_xxx) to experiment without publishing real content:
Test mode:
- Does not publish to real platforms
- Uses sandbox provider endpoints
- Has separate rate limits
- Data is periodically cleared