Automate Social Commerce Publishing with a Social Media API for E-commerce
A social media API for e-commerce lets a store backend publish product launches, promotions, and seasonal campaigns from one request instead of maintaining a separate integration for every social channel.
curl -X POST {{API_BASE_URL}}/v1/posts \
-H "x-access-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"content": "A short example update.",
"mediaItems": [
{ "url": "https://cdn.example.com/product-hero.jpg", "type": "image" }
],
"platforms": [
{ "platform": "instagram", "accountId": "acc_ig" },
{ "platform": "facebook", "accountId": "acc_fb" },
{ "platform": "pinterest", "accountId": "acc_pin",
"platformSpecificData": {
"boardId": "board_products",
"link": "https://example.com/summer"
}
}
]
}'curl -X POST {{API_BASE_URL}}/v1/posts \
-H "x-access-key: your-api-key" \
-H "Content-Type: application/json" \
This guide explains how to automate product launch posts, schedule flash sale posts, and create shoppable Pinterest pins API workflows, with the exact request fields shown in the worked example below.
Automate social commerce publishing: task, inputs, and scope
E-commerce teams need consistent social publishing whenever a product launches, a sale goes live, or inventory changes. A unified request can carry the announcement text, product media, and the list of destination accounts, so the backend triggers publishing from the same event that updates the catalog. The scope here is publishing from a backend: one POST request targets Instagram, Facebook, and Pinterest together, with Pinterest receiving extra product-link data. Automated Product Announcements are the core pattern: connect the catalog event to a post creation call, rather than copying the same announcement manually into each platform. Visual-First Publishing means the media is part of the request, not an afterthought, so product images and videos travel with the copy. Pinterest Link Attribution adds a destination link and board so a pin can send shoppers back to the product page. Campaign Scheduling covers planning seasonal campaigns and flash sales in advance, although the captured example on this page shows immediate creation rather than a scheduling payload.
Field map for the POST /v1/posts request
The request is built around four top-level ideas: content for the announcement text, mediaItems for product visuals, and platforms for the destinations. Each entry in platforms names a platform and the accountId to publish to. Pinterest entries can also carry platformSpecificData, which in the example holds boardId and link. Read the field map below before building the call: it distinguishes what the example actually shows from what remains unverified, such as requiredness, types beyond the example, and any response or error behavior. That distinction matters because a field appearing in an example is not proof of its requiredness or validation rules.
Announce a new product: worked API example
The worked example below announces a new summer collection. It sends one content string, one image in mediaItems, and three platform targets. Instagram and Facebook receive only platform and accountId, while Pinterest also receives platformSpecificData with boardId and link. To automate product launch posts, replace the example copy, image URL, account identifiers, board identifier, and product link with values from your catalog event, then send the request from your backend with your access key in the x-access-key header. To cross-post product promotions, keep the same structure and change the content and link for each campaign. The example is illustrative and unexecuted; it preserves the captured request shape with the origin written as {{API_BASE_URL}}.
Platform-specific publishing notes for Instagram, Facebook, and Pinterest
For Instagram and Facebook, the example uses the shared content and mediaItems fields with a platform and accountId per target. For Pinterest, add platformSpecificData so the pin can be placed on a board and linked to the product. Before publishing, check that every accountId belongs to the intended store account, that the media URL is reachable and matches the format each platform expects, and that the Pinterest boardId and link are present and correct. Visual-First Publishing works best when the hero image is chosen per product rather than reused across the whole catalog, because the same asset may need different crops or formats on different platforms. Treat per-platform media validation as a pre-publish checklist on your side until the exact validation rules are confirmed.
Failure matrix and pre-publish validation checklist
Most publishing failures in this workflow are predictable and can be caught before the request is sent. Missing mediaItems means a visual-first announcement goes out without its product image, so check that at least one media item is attached when the campaign requires one. An invalid platform value or an accountId that does not match the platform will target the wrong destination or fail, so validate each platforms entry against the connected accounts. For Pinterest, a missing boardId or link breaks the shoppable pin, so treat both as required for that target in your own validation even though the captured source does not define requiredness. A failed catalog trigger, such as a product event that fires before the image is uploaded, should be handled by retrying the trigger or holding the post until the media is ready. Use the failure matrix below as a pre-publish checklist and log which platform target failed so a single bad target does not silently block the others.
Decision criteria: unified API versus separate integrations
Choose a unified social publishing API when the same announcement must reach several platforms with shared content and media, and when the team wants one request shape and one place to maintain publishing logic. Separate platform integrations may fit better when a store needs deep platform-specific features, custom approval flows, or analytics that a unified layer does not expose. Compare options on the number of platforms supported, how platform-specific data such as Pinterest boardId and link is handled, media validation behavior, scheduling support, error reporting per target, and how clearly the contract documents required fields and failure modes. A unified API reduces duplicated integration work, but it does not remove the need to validate media, account identifiers, and platform-specific fields before publishing. Tracking which social channels drive the most traffic is not shown in the captured POST /v1/posts request, so treat channel-level traffic attribution as a separate analytics check to confirm through documented reporting rather than assuming it is returned by this publishing call.
| Field | Shown in example | Purpose in the example | Requiredness / type status |
|---|---|---|---|
| content | Yes | Announcement text for the product launch | Shown as a string; requiredness unverified |
| mediaItems | Yes | Array of product media; example contains one image with url and type | Shown as an array of objects; requiredness unverified |
| mediaItems[].url | Yes | URL of the product image | Shown as a string; requiredness unverified |
| mediaItems[].type | Yes | Media type; example uses image | Shown as a string; enum values unverified |
| platforms | Yes | Array of destination targets | Shown as an array; requiredness unverified |
| platforms[].platform | Yes | Destination platform: instagram, facebook, pinterest | Shown as strings; enum values unverified |
| platforms[].accountId | Yes | Account to publish to for that platform | Shown as strings such as acc_ig; requiredness unverified |
| platforms[].platformSpecificData | Yes, Pinterest only | Platform-specific data for the Pinterest target | Shown as an object; requiredness unverified |
| platformSpecificData.boardId | Yes, Pinterest only | Pinterest board the pin is published to | Shown as board_products; requiredness unverified |
| platformSpecificData.link | Yes, Pinterest only | Product link attached to the pin | Shown as a URL string; requiredness unverified |
Requiredness and types beyond the example are unverified; do not treat presence in the example as a requiredness rule.
| Failure | What to check before publishing | How to respond |
|---|---|---|
| Missing media | Confirm mediaItems contains the product image or video and the URL is reachable | Hold the post or attach media before sending |
| Invalid platform or accountId | Confirm each platforms entry uses a supported platform and the correct accountId | Fix the target list; do not send to a mismatched account |
| Missing Pinterest boardId or link | Confirm platformSpecificData includes boardId and link for the Pinterest target | Add both fields or remove the Pinterest target |
| Failed catalog trigger | Confirm the product event fired after media upload and catalog data were ready | Retry the trigger or queue the post until assets are ready |
| Media format mismatch | Confirm image or video format and dimensions suit each platform | Re-export or replace the asset for the affected platform |
Response and error contracts are unverified in the captured source; this matrix is a client-side checklist, not a documented error contract.