Back to Blog Index
developer guide

Social Media API Errors: Common Codes, Rate Limits & Handling Strategies

ESER Engineering Team July 19, 202610 min read

A comprehensive developer troubleshooting guide for social media API errors across Meta, X, LinkedIn, TikTok, and YouTube.

## Troubleshooting Social Media API Errors Publishing content across external social APIs requires robust error handling, defensive retries, and accurate classification of transient vs permanent failure modes. --- ### Common Error Classes & Resolution Strategies #### 1. OAuth Token Expiration (`TOKEN_EXPIRED` / `401 Unauthorized`) - **Cause:** Platform access tokens expire (Meta 60 days, LinkedIn 60 days, TikTok 24 hours without refresh). - **Handling:** Catch 401 responses, invoke OAuth token refresh endpoints using stored refresh tokens, and retry the original publish payload. #### 2. Media Constraint Violations (`INVALID_MEDIA_SPEC` / `400 Bad Request`) - **Cause:** Aspect ratio out of bounds, file size exceeding caps, or unsupported audio codec. - **Handling:** Pre-validate video specs before upload (9:16 vertical, max 500MB, H.264 video with AAC audio). #### 3. Platform Rate Limiting (`429 Too Many Requests`) - **Cause:** Exceeding per-user or per-app hourly publishing limits. - **Handling:** Inspect the `Retry-After` header, enqueue the post into a delayed retry queue, and apply exponential backoff with jitter. --- ### Idempotency Keys Always supply a unique `idempotencyKey` with publish requests to prevent duplicate posts on intermittent network drops.

Automate your social strategy with ESER AI

Ingest content sources and generate multi-platform posts automatically.

Start 7-Day Free Trial →