# CLI Platform Commands

Inspect connected accounts and discover platform-specific ids (Instagram locations,
licensed audio, Pinterest boards, Pinterest product Pins) that other commands take
as input.

## Accounts

| Command | Description |
|---------|-------------|
| `accounts:list` | List connected accounts with channel ids, platforms, supported content types, and Pinterest boards |
| `accounts:get <id>` | Full details for one account, including platform-specific data such as Pinterest board ids |

```bash
omnisocials accounts:list
```

The channel ids in the output are what `posts:create --channels` expects.

## Location search

| Command | Description |
|---------|-------------|
| `locations:search "<name>"` | Search taggable locations (minimum 2 characters, `--q` or positional). Flags: `--platform <instagram\|threads>` (default `instagram`), and for Threads `--latitude` + `--longitude` instead of a name |

With the default `--platform instagram` it searches Facebook Places and returns
`location_id` values for `posts:create --location-id` (Instagram place tags).
Only places with a street address can be tagged.

```bash
omnisocials locations:search "Amsterdam Central"
omnisocials posts:create \
  --text "Live from Amsterdam" \
  --channels instagram \
  --media-urls https://example.com/photo.jpg \
  --location-id 106039436102339
```

With `--platform threads` it searches Threads locations and returns ids for
`posts:create --threads-location-id`. The two id namespaces are different: a
Facebook Place ID is not a Threads location id, so never reuse one as the
other. Threads also accepts coordinates instead of a name. Threads location
tagging is currently rolling out; until Meta approves the permission the
search answers `not_available`, and Threads connections made before the
permission existed answer `threads_reauth_required` until reconnected.

```bash
omnisocials locations:search "Griffith Observatory" --platform threads
omnisocials locations:search --platform threads --latitude 34.1184 --longitude -118.3004
omnisocials posts:create \
  --text "Best view in the city" \
  --channels threads \
  --threads-location-id 17841400000000000
```

## Audio search

| Command | Description |
|---------|-------------|
| `audio:search ["<song/artist>"]` | Search Meta's licensed music catalog for Instagram Reels. Empty query returns trending audio. Flags: `--type <music\|original_sound>` |

Returns `audio_id` values for `posts:create --instagram-audio-id` (reels only).

```bash
# Trending right now
omnisocials audio:search

# Find a specific track
omnisocials audio:search "daft punk" --type music
```

## Pinterest products

| Command | Description |
|---------|-------------|
| `pinterest:products` | List the product Pins of the connected Pinterest account. Flags: `--source <catalog\|pins>`, `--product-group-id <id>`, `--bookmark <bookmark>`, `--page-size <1-100>` (default 25, catalog only) |
| `pinterest:validate <pin-id-or-link>` | Check that a Pin ID or Pin link (`https://www.pinterest.com/pin/<id>/`) is a product Pin of the connected account |

`pinterest:products` returns `pin_id` values for
`posts:create --pinterest-product-tags` (max 24 products per Pin). Pinterest
accepts a product only when its Pin is public, belongs to the same Pinterest
account and links to a website that account claimed. Products of other
merchants cannot be tagged. Both commands need the `posts:read` scope.

```bash
omnisocials pinterest:products
omnisocials posts:create \
  --text "Autumn outfit" \
  --channels pinterest \
  --media-urls https://example.com/outfit.jpg \
  --pinterest-board-id 1234567890 \
  --pinterest-product-tags 813744226420795884,813744226420795885
```

```text
Pinterest products (2, source: catalog)
────────────────────────────────────────
pin_id: 813744226420795884  Blue ribbed top  (24.99 EUR, IN_STOCK, item TOP-BLUE-M)
  https://shop.example.com/products/blue-ribbed-top
pin_id: 813744226420795885  Grey wool scarf  (39.95 EUR, IN_STOCK, item SCARF-GREY)
  https://shop.example.com/products/grey-wool-scarf

Pass ids to posts:create/posts:update with --pinterest-product-tags <id,id> (max 24 per Pin).
```

There are two sources:

- `--source catalog` reads the Pinterest catalog. Each product carries its
  price, currency, availability and item id, and the output lists the product
  groups of the account so you can pick another one with `--product-group-id`.
  It needs catalog access on the Pinterest connection. Give it one time in the
  OmniSocials composer: open the Pinterest options, select **Add products**,
  then **Connect catalog**. Without catalog access the command fails with
  `pinterest_catalog_access_required`.
- `--source pins` reads the account's own Pins and returns the ones Pinterest
  marks as product Pins. It works on every connection. One call scans up to
  250 Pins, so a call can find no product Pin and still print a `--bookmark`
  value: run the command again with that bookmark.

Without `--source` the API uses `catalog` when the connection has catalog
access, else `pins`. When more results exist, the output ends with the
`--bookmark` value for the next page.

A problem is printed as an error (`Error [code]: message`, exit code 1), not
as an empty list: `pinterest_not_connected` (no Pinterest account on the
workspace), `pinterest_catalog_access_required`, or `platform_error` (Pinterest
did not answer or refused).

`pinterest:validate` checks one Pin before you tag it:

```bash
omnisocials pinterest:validate 813744226420795884
omnisocials pinterest:validate https://www.pinterest.com/pin/813744226420795884/
```

It prints `Valid product Pin: <pin_id>`, or `Not valid (<pin_id>): <reason>`
for a Pin that is not a product Pin, belongs to another account or does not
exist. `Not checked (<pin_id>): <reason>` means the check could not run; the
publish step is then the final check. `pin.it` short links do not work. The
check does not look at the claimed-website rule; Pinterest applies that one
when the post is published.
