> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Get Global Story Targets

> Retrieve active story targets across the app using global story target query options.

Global story target APIs return story targets across the app. Use them for discovery experiences such as a global story tray.

## Parameters

| Operation | Parameter | Required | Description |
| - | - | - | - |
| Query global story targets | Seen-state query option | Yes | Option such as smart, unseen, seen, or all. |
| Query global story targets | `limit` | No | TypeScript page size for global target results. |

## Query Options

| Option | Description |
| - | - |
| `SMART` | Combines unseen targets first, then seen targets. |
| `UNSEEN` | Returns targets with unseen stories. |
| `SEEN` | Returns targets without unseen stories. |
| `ALL` | Returns all active story targets. |

> [!NOTE]
>
> Option casing follows each platform: TypeScript uses `Amity.StorySeenQuery.SMART`, iOS uses `.smart`, Android and Flutter use `AmityGlobalStoryTargetsQueryOption.SMART`.

## Query Global Story Targets

Query global story targets for a tray or discovery surface, using the seen-state option that matches your product sort order.

```typescript TypeScript theme={null}
import { StoryRepository } from '@amityco/ts-sdk';

const unsubscribe = StoryRepository.getGlobalStoryTargets(
  {
    seenState: Amity.StorySeenQuery.SMART,
    limit: 20,
  },
  ({ data, loading, error, hasNextPage, onNextPage }) => {
    if (error) {
      handleError(error);
      return;
    }

    if (!loading) {
      renderResults(data);
    }

    if (hasNextPage) {
      onNextPage?.();
    }
  },
);

unsubscribe();
```

```swift iOS theme={null}
token = storyRepository.getGlobalStoryTargets(option: .smart).observe { collection, error in
    if let error {
        handleError(error)
        return
    }

    showSuccessMessage(collection.snapshots.count)
}
```

```kotlin Android theme={null}
fun observeGlobalStoryTargets(storyRepository: AmityStoryRepository) {
    storyRepository.getGlobalStoryTargets(
        queryOption = AmityGlobalStoryTargetsQueryOption.SMART
    )
        .doOnNext { targets: PagingData<AmityStoryTarget> ->
            getPagingData(targets)
        }
        .doOnError { error -> showErrorMessage(error = error) }
        .subscribe()
}
```

```dart Flutter theme={null}
void observeGlobalStoryTargets() {
  final collection = GlobalStoryTargetLiveCollection(
    queryOption: AmityGlobalStoryTargetsQueryOption.SMART,
  );

  collection.getStreamController().stream.listen((storyTargets) {
    final targetCount = storyTargets.length;
    showError(targetCount);
  });

  collection.getData();
}
```

## Notes

* `SMART` is the right default for a consumer-facing global tray because it prioritizes unseen targets.
* Use `UNSEEN` for a strict "new stories only" surface.
* Use `SEEN` when you need a replay or archive-style surface of already seen active targets.
* Use `ALL` when your UI needs all active targets regardless of current user's seen state.

## Related Topics

> [card] [Get Story Targets](/social-plus-sdk/social/content-management/stories/retrieval/get-story-targets.md)
>
> Retrieve specific story target state.

> [card] [Get Stories](/social-plus-sdk/social/content-management/stories/retrieval/get-stories.md)
>
> Retrieve the actual story objects for one or more targets.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.