# Storefront · Social

Part of AppEngine API Documentation. Full index: https://appengine.appmint.io/documentation.md
## POST /storefront/sync/post-to-social

**Post products to social media**

`operationId: StorefrontController_postToSocial`

Builds a social post from one or more products and publishes it, or schedules it for later.

The caption is assembled from the products unless `customCaption` overrides it; price, hashtags and a product link are included by default and can each be switched off. `postType` is auto-detected from the product media when omitted.

Preview the result first with `POST /storefront/sync/preview-social-post` — that runs the same rendering without publishing.

#### Signature

```http
POST /storefront/sync/post-to-social (body) -> The published or scheduled post
```

#### Access

Public — no credentials required.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| `404` | PRODUCT_NOT_FOUND | Product not found | The product id or SK does not resolve in the org. | Check the identifier with `GET /storefront/products`. |
| `400` | INVALID_TARGET | Invalid or unreachable post target | `to` is malformed for the platform, or names a page the connection cannot publish to. | Use a `to` value from `GET /storefront/sync/social-targets/{platform}`. |

Plus the standard platform errors: `429`, `500`.

#### See also

- `POST /storefront/sync/preview-social-post`
- `GET /storefront/sync/social-targets/{platform}`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgid` | header | string | yes | Organization (tenant) identifier. Every request is scoped to this org; data from other orgs is never visible. Issued with your API credentials. |

### Request body

What to post, and where.

```json
{
  "platform": "instagram",
  "productIds": [
    "66f1a2b3c4d5e6f708192a3b"
  ],
  "to": "x/1234567890/17841400000000000",
  "siteName": "main-store"
}
```

### Responses

| Status | Meaning |
| --- | --- |
| `201` | The published or scheduled post |
| `400` | Invalid or unreachable post target — `to` is malformed for the platform, or names a page the connection cannot publish to. |
| `404` | Product not found — The product id or SK does not resolve in the org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## POST /storefront/sync/preview-social-post

**Preview a social post**

`operationId: StorefrontController_previewSocialPost`

Renders exactly what `post-to-social` would publish — caption, hashtags, link and selected media — and returns it without posting anything. Nothing is sent to the platform and no integration is required.

It takes the same body minus `to`, `scheduleAt` and `configId`, since there is no destination involved.

#### Signature

```http
POST /storefront/sync/preview-social-post (body) -> The rendered post
```

#### Access

Public — no credentials required.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| `404` | PRODUCT_NOT_FOUND | Product not found | The product id or SK does not resolve in the org. | Check the identifier with `GET /storefront/products`. |

Plus the standard platform errors: `429`, `500`.

#### See also

- `POST /storefront/sync/post-to-social`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgid` | header | string | yes | Organization (tenant) identifier. Every request is scoped to this org; data from other orgs is never visible. Issued with your API credentials. |

### Request body

The post to render.

```json
{
  "platform": "instagram",
  "productIds": [
    "66f1a2b3c4d5e6f708192a3b"
  ],
  "siteName": "main-store",
  "includePrice": true
}
```

### Responses

| Status | Meaning |
| --- | --- |
| `201` | The rendered post |
| `404` | Product not found — The product id or SK does not resolve in the org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## GET /storefront/sync/social-targets/{platform}

**List social post targets**

`operationId: StorefrontController_getSocialTargets`

Lists the pages, accounts and boards a product post can be published to on a platform. Each target includes a ready-to-use `to` value, so a client never has to assemble the platform-specific format itself.

Call this to populate a destination picker before posting.

#### Signature

```http
GET /storefront/sync/social-targets/{platform} (platform: string) -> The available targets
```

#### Access

Public — no credentials required.

#### Notes

- Always take `to` from this response. Its format differs per platform — Facebook uses `x/pageId`, Instagram `x/pageId/instagramId`, Pinterest a board id, and the rest a bare account id.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| `404` | PLATFORM_NOT_CONNECTED | No integration configured for this platform | The org has not connected that social platform. | Connect the platform in the org integration settings. |

Plus the standard platform errors: `429`, `500`.

#### See also

- `POST /storefront/sync/post-to-social`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgid` | header | string | yes | Organization (tenant) identifier. Every request is scoped to this org; data from other orgs is never visible. Issued with your API credentials. |
| `platform` | path | string | yes | One of `facebook`, `instagram`, `tiktok`, `twitter`, `linkedin`, `pinterest`. |

### Responses

| Status | Meaning |
| --- | --- |
| `200` | The available targets |
| `404` | No integration configured for this platform — The org has not connected that social platform. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

