API Reference¶
MyPost provides a RESTful API for all functionality.
Base URL¶
Authentication¶
All endpoints (except auth) require a Bearer token:
Authentication Endpoints¶
Login¶
POST /api/v1/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}
Response:
{
"accessToken": "eyJhbGciOiJIUzI1NiIs...",
"expiresIn": 900,
"user": {
"id": "uuid",
"email": "user@example.com",
"name": "John Doe"
}
}
Refresh Token¶
Logout¶
Get Current User¶
Workspaces¶
List Workspaces¶
Response:
Create Workspace¶
Get Workspace¶
Update Workspace¶
Brands¶
List Brands¶
Create Brand¶
POST /api/v1/workspaces/:workspaceId/brands
Content-Type: application/json
{
"name": "My Brand",
"description": "Brand description"
}
Get Brand¶
Update Brand¶
Delete Brand¶
Social Accounts¶
List Social Accounts¶
Response:
{
"data": [
{
"id": "uuid",
"network": "facebook",
"name": "My Page",
"profileImageUrl": "https://...",
"status": "active",
"tokenExpiresAt": "2026-02-01T00:00:00Z"
}
]
}
Connect Social Account¶
POST /api/v1/brands/:brandId/social-accounts
Content-Type: application/json
{
"network": "facebook"
}
Response:
Disconnect Social Account¶
Reconnect Social Account¶
Posts¶
List Posts¶
Query Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| status | string | draft, scheduled, published, failed |
| limit | number | Max results (default: 50) |
| cursor | string | Pagination cursor |
Create Post¶
POST /api/v1/brands/:brandId/posts
Content-Type: application/json
{
"content": "Hello world! 👋",
"mediaIds": ["uuid1", "uuid2"],
"targetAccountIds": ["account-uuid"],
"scheduledAt": "2026-01-15T14:00:00Z"
}
Get Post¶
Update Post¶
Delete Post¶
Schedule Post¶
POST /api/v1/posts/:id/schedule
Content-Type: application/json
{
"scheduledAt": "2026-01-15T14:00:00Z"
}
Publish Now¶
Cancel Scheduled Post¶
Media¶
Upload Media¶
Step 1: Initiate upload
POST /api/v1/brands/:brandId/media
Content-Type: application/json
{
"filename": "image.jpg",
"mimeType": "image/jpeg",
"size": 1024000
}
Response:
Step 2: Upload to presigned URL
Step 3: Complete upload
List Media¶
Delete Media¶
Analytics¶
Brand Overview¶
Response:
{
"followers": 15420,
"followerGrowth": 523,
"impressions": 142000,
"engagement": 8532,
"engagementRate": 6.01,
"posts": 45
}
Account Analytics¶
Post Analytics¶
Response:
Export Analytics¶
POST /api/v1/analytics/export
Content-Type: application/json
{
"brandId": "uuid",
"from": "2026-01-01",
"to": "2026-01-31",
"format": "csv"
}
Users & Team¶
List Users¶
Invite User¶
POST /api/v1/workspaces/:workspaceId/users/invite
Content-Type: application/json
{
"email": "newuser@example.com",
"roleId": "role-uuid"
}
Update User Role¶
PATCH /api/v1/workspaces/:workspaceId/users/:userId
Content-Type: application/json
{
"roleId": "new-role-uuid"
}
Remove User¶
Roles¶
List Roles¶
Create Role¶
POST /api/v1/workspaces/:workspaceId/roles
Content-Type: application/json
{
"name": "Content Manager",
"permissions": [
"posts.create",
"posts.edit",
"media.upload",
"analytics.view"
]
}
Available Permissions¶
| Permission | Description |
|---|---|
posts.create |
Create new posts |
posts.edit |
Edit existing posts |
posts.delete |
Delete posts |
posts.publish |
Publish posts |
posts.schedule |
Schedule posts |
media.upload |
Upload media assets |
media.delete |
Delete media assets |
brands.create |
Create brands |
brands.edit |
Edit brands |
brands.delete |
Delete brands |
accounts.connect |
Connect social accounts |
accounts.disconnect |
Disconnect accounts |
analytics.view |
View analytics |
analytics.export |
Export analytics data |
users.invite |
Invite team members |
users.manage |
Manage team members |
roles.manage |
Manage roles |
workspace.settings |
Modify workspace settings |
Approval Workflows¶
Submit for Approval¶
Approve Post¶
Reject Post¶
POST /api/v1/approvals/:id/reject
Content-Type: application/json
{
"reason": "Please revise the hashtags"
}
Audit Log¶
Get Audit Events¶
Response:
{
"data": [
{
"id": "uuid",
"action": "post.published",
"userId": "uuid",
"resourceType": "post",
"resourceId": "uuid",
"createdAt": "2026-01-01T12:00:00Z",
"metadata": {}
}
],
"page": {
"nextCursor": "..."
}
}
Error Responses¶
All errors follow this format:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable message",
"details": [
{
"path": "email",
"message": "Invalid email format"
}
],
"requestId": "req_abc123"
}
}
Error Codes¶
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED |
401 | Invalid or missing token |
FORBIDDEN |
403 | Insufficient permissions |
NOT_FOUND |
404 | Resource not found |
VALIDATION_ERROR |
400 | Invalid request data |
RATE_LIMITED |
429 | Too many requests |
INTERNAL_ERROR |
500 | Server error |
Rate Limits¶
| Scope | Limit |
|---|---|
| Global | 1000 req/sec |
| Per Workspace | 100 req/sec |
| Per User | 10 req/sec |
Rate limit headers:
Pagination¶
Cursor-based pagination:
Response:
Webhooks¶
Subscribe to Events¶
POST /api/v1/webhooks
Content-Type: application/json
{
"url": "https://your-server.com/webhook",
"events": ["post.published", "post.failed"],
"secret": "your-signing-secret"
}
Webhook Payload¶
{
"event": "post.published",
"timestamp": "2026-01-01T12:00:00Z",
"data": {
"postId": "uuid",
"brandId": "uuid",
"publishedAt": "2026-01-01T12:00:00Z"
}
}