Yes2SDK API Reference

Welcome to the Yes2SDK API reference. This is the single source of truth for the SDK surface: every public function across the three SDK surfaces (Core in TypeScript/JavaScript, Unity in C#, and Defold in Lua), with, for each function, a clear view of how it behaves on every platform.

Start here for the support matrix and the status legend, then open any module page for full signatures and per-platform detail.


How the SDK is accessed

SurfaceImport / accessAsync style
Core (TS/JS)import Yes2SDK from '@yes2sdk/core' → singleton. Modules via getters: Yes2SDK.ads, Yes2SDK.player, …Promise / async; resolves with results, rejects with a structured ErrorMessage
Unity (C#)using Yes2SDK; → static class. Modules via static props: Yes2SDK.Ads, Yes2SDK.Player, …Callback overloads and Task + CancellationToken overloads (Task surfaces failures as Yes2SDKException)
Defold (Lua)local yes2sdk = require "yes2sdk.yes2sdk" → flat module. Functions are prefixed: yes2sdk.ads_show_interstitial(...), yes2sdk.data_get_int(...)Last-argument callbacks (self, success, payload)

All three bundle the same Core SDK and select the host platform automatically at runtime. Each platform adapter loads only that platform's own SDK from its CDN. Write your game once; it runs everywhere Yes2SDK ships.


Status legend

Each function is rated per platform so you always know what to expect:

StatusMeaning
ReadyFully integrated with the platform's own SDK.
PartialWorks today, with a sensible fallback or platform-specific scope (e.g. local storage, a browser-derived value).
NoneNot offered by this platform. The call stays safe: it returns a clear FeatureNotSupported result or a no-op default, so a single codebase runs cleanly everywhere.

Optional features degrade gracefully: guard them with isSupported() / IsSupported() and your integration behaves correctly on every platform, with zero special-casing required.

Growing fast. A few more modules are already built into Core and on the rollout path. See Upcoming modules below.


Module pages

These modules are available today via Yes2SDK.<module> (Core), Yes2SDK.<Module> (Unity), and yes2sdk.<module>_* (Defold).

ModulePageWhat it does
Lifecycle & eventslifecycle.mdInit, loading progress, start, pause/resume, audio
Adsads.mdInterstitial, rewarded, banner
Analyticsanalytics.mdGameplay events, level/score/tutorial/purchase logging
Sessionsession.mdLocale, country, device, orientation, traffic source
Datadata.mdTyped key-value storage (PlayerPrefs-style): the default for saved game state
Playerplayer.mdIdentity, account-bound saved data, connected players
Authauth.mdSign-in, tokens, account linking
Gamegame.mdGameplay lifecycle, invite links, settings, clipboard
Bannersbanners.mdPositioned display banners (distinct from ads banner)
Friendsfriends.mdPaginated friends list
Scorescore.mdScore submission (incl. encrypted)
Leaderboardleaderboard.mdNamed leaderboards: submit scores, read ranked entries
Statsstats.mdNumeric player statistics (get / set / increment)
IAPiap.mdIn-app purchases: catalog, purchase, consume, subscriptions
Referralsreferrals.mdShare an invite link and list players who joined through it
Configconfig.mdRemote configuration / feature flags
Reviewreview.mdIn-game rating / feedback prompt
Errorserrors.mdError model, ErrorCode, exceptions

Platform support matrix

A module-level summary across the six live platforms. Per-method detail is on each module page.

ModulePokiGameDistributionCrazyGamesYandexYouTubeJest
Ads: interstitial & rewardedReadyReadyReadyReadyReadyNone⁹
Ads: bannerNoneNoneReadyReadyNoneNone
AnalyticsPartial¹Partial¹Partial¹Partial¹Partial¹Partial¹⁰
SessionPartialPartialReadyReadyPartialPartial¹³
DataPartial²Partial²ReadyReadyReadyReady¹¹
Player: identityNoneNonePartialReadyNoneReady¹⁴
Player: saved dataPartial²Partial²ReadyReadyReadyReady¹¹
AuthNoneNoneReady³Ready³NoneReady³
Game: lifecycleReadyPartial⁴ReadyReadyPartial⁴Partial¹⁰
Game: invite linksReadyNoneReadyNoneNoneNone¹²
BannersNoneNoneReadyReady⁵NoneNone
FriendsNoneNoneReadyNoneNoneNone
ScoreNone⁶None⁶ReadyNone⁶ReadyNone⁶
LeaderboardNoneNoneNoneReadyNoneNone
StatsNoneNoneNoneReadyNoneNone
IAPNoneNoneNoneReady⁷NoneReady⁷
ReferralsNoneNoneNoneNoneNoneReady¹²
NotificationsNoneNoneNoneNoneNoneReady¹⁵
Context: image sharingNoneNoneNone¹⁶NoneNonePartial¹⁶
Config: feature flagsPartial⁸Partial⁸Partial⁸ReadyPartial⁸Partial⁸
Review: rating promptNoneNoneNoneReadyNoneNone

¹ Custom analytics events are recorded locally; the gameplay-lifecycle calls (logLevelStart/logLevelEnd) drive each platform's real gameplayStart/gameplayStop. On YouTube, error/warning reporting also flows to the platform's health channel. ² Poki & GameDistribution don't expose a storage API, so Data and Player saved-data persist via namespaced localStorage (device-local). Player identity stays anonymous on these platforms. ³ Auth is available; platform sign-out isn't offered, and account-linking is CrazyGames-only. Jest also offers showRegistrationPrompt, for guests only: Jest draws a minimal overlay with the required legal text and a close button, and your game supplies the rest, its own copy and buttons wired to the returned login and close actions. The message option is the text pre-filled in the player's messaging app. ⁴ GameDistribution and YouTube track gameplay via internal state. YouTube drives the real lifecycle through firstFrameReady/gameReady. ⁵ Yandex presents a single sticky banner; placement and size are managed for you, and refresh re-displays it. ⁶ Score submission isn't offered by these platforms; calls are recorded locally and are safe to keep in your code. ⁷ Yandex IAP covers products and purchases. Jest covers products, purchases, recovery of incomplete purchases at startup, and subscriptions. Subscriptions are offered on Jest only: isSubscriptionSupported() is true on Jest and false on the other five platforms. ⁸ Config has no remote-config service on these platforms, so getFlagsAsync returns your provided defaults unchanged. Always safe to call. Only Yandex serves remote overrides (isSupported() is true there only). ⁹ Jest has no ads. The calls stay safe and never show an ad. Core: noFill then afterAd. Defold: no_fill then after_ad. Unity: onError with NoFill (check error.Code), and no afterAd follows, so Unity games resume in onError on a no-fill, and in afterAd only when an ad actually ran, which never happens on Jest. ¹⁰ Jest has no gameplay start or stop signal. gameplayStart/gameplayStop and logLevelStart/logLevelEnd are logged only, and custom analytics events are recorded locally. startGameAsync() (Unity StartGameAsync, Defold start_game) tells Jest the game has loaded. Jest also fires exitRequested when the player starts to leave: save synchronously in the handler, and Yes2SDK flushes player data right after. ¹¹ On Jest, Data and Player saved data share one Jest player store that persists across sessions and devices, limited to 1 MB per game per player. Writes past the limit fail. ¹² Jest invites go through Referrals (referrals.shareAsync), not invite links. Jest counts an invited player once they complete registration. ¹³ On Jest, session.getEntryPointData() returns Jest's entry payload, the data attached to the referral, notification, registration prompt or image share the player arrived through. The page URL is never read. getCountry() returns "" and isAudioEnabled() is always true. ¹⁴ Jest gives every player, guest or registered, a stable id. Jest also generates avatars for bots (player.getBotAvatarAsync; check isBotAvatarSupported() first). The signed player (player.getSignedPlayerInfoAsync) returns { playerId, signature }: verify the signature on a server before you trust it (see Server Verification). ¹⁵ Notifications are offered on Jest only, for registered players: a guest gets PLAYER_NOT_AUTHENTICATED. Jest asks for a D1 to D7 sequence, at least one notification per day for the next seven days. There is no method to list scheduled notifications, and cancelAllAsync() cancels only the notifications scheduled in the current page session. ¹⁶ Jest supports image sharing only (context.shareAsync, Unity Context.ShareImageAsync, Defold context_share). isSupported() is false on Jest, but sharing an image works, so do not gate it on isSupported(). The context is always solo: getContext(), getType() and isSizeBetween() answer for a solo context, and getPlayersAsync, switchAsync, chooseAsync, createAsync and updateAsync report FEATURE_NOT_SUPPORTED. On CrazyGames, context.shareAsync shows CrazyGames' invite button and ignores image and data, so skip the call there. On Poki, GameDistribution, Yandex and YouTube it reports FEATURE_NOT_SUPPORTED.


Upcoming modules

Two more modules are implemented in Core and not offered on any current platform yet. You can design against their API surface today and adopt them as platform support lands. Notifications and Context image sharing already work on Jest and are in the support matrix above.

Achievements · Tournament

ModulePokiGameDistributionCrazyGamesYandexYouTubeJest
AchievementsNoneNoneNoneNoneNoneNone
TournamentNoneNoneNoneNoneNoneNone

Full signatures and the rollout picture are in upcoming.md. These map directly to Facebook Instant Games capabilities on the platform roadmap, so they're a natural next step.

Module availability by surface

ModuleCoreUnityDefold
Ads · Analytics · Session · Data · Player · Auth · Game · Banners · Friends · Score · Leaderboard · Stats · IAP · Config · ReviewAvailableAvailableAvailable
Referrals · NotificationsAvailableAvailableAvailable
ContextAvailableImage sharing onlyImage sharing only
Achievements · TournamentAvailableAccessor onlyNot exposed
  • Core 2.10.0 wires every module to the Yes2SDK.<module> API, including referrals, notifications, context, achievements and tournament. On every current platform, Achievements and Tournament calls report FEATURE_NOT_SUPPORTED, except tournament.getCurrentAsync(), which resolves null (no current tournament) instead of rejecting.
  • Unity 2.10.0 exposes every module, including Referrals, Notifications and IAP subscriptions. Context.ShareImageAsync (and the older Context.ShareAsync) shares an image. SwitchAsync, ChooseAsync and CreateAsync return FeatureNotSupported, and Context.IsSupported() is always false, so do not gate image sharing on it. The Achievements and Tournament accessors return FeatureNotSupported.
  • Defold 1.8.0 exposes every module except Achievements and Tournament, including referrals_*, notifications_* and IAP subscriptions. Context is context_share plus the context_is_supported() hint. The newer calls need Yes2SDK runtime 2.10.0; older runtimes report FEATURE_NOT_SUPPORTED for them.
  • Core 2.11.0, Unity 2.12.0 and Defold 1.9.0 add bot avatars to Player (getBotAvatarAsync and isBotAvatarSupported, Jest only), the Jest-only onboardingSlug and notificationTemplates options to referrals.shareAsync, and allow an empty notification title.

Versions

SDKVersionNotes
Core (TS)2.11.0UMD bundle, injected by the dashboard build pipeline
Unity2.12.0Unity 2021.3+; WebGL build target
Defold1.9.0Defold 1.10.2+; HTML5 build target

Live platforms across all surfaces: Poki, CrazyGames, Yandex Games, GameDistribution, YouTube Playables, Jest.

On Jest, Core reports the platform id "jest". In Unity, GetPlatform() returns Platform.Jest from 2.11.0 (2.10.0 returns Platform.Unknown there).

Get started