Skip to content

API reference

The current version is 0.2.0.

<script src="https://www.alldle.net/sdk.js" data-game="your-game-slug"></script>
Attribute Meaning
data-game Required. Your game’s slug, or its id before approval
data-debug Optional. Logs every call to the console

The tag creates a ready instance named alldle, and connects when the page loads. /sdk.js is always the latest version. /sdk/0.2.0/sdk.js is the same file under a fixed name, cached for a year, but only the current version is served: an older one returns a 404.

With the npm package, @alldle/sdk:

import { Alldle } from '@alldle/sdk';
const alldle = new Alldle({ gameSlug: 'your-game-slug' });
Option Default Notes
gameSlug Required Your game’s slug on Alldle
debug false Log every call to the console
apiUrl https://api.alldle.net For local development
siteOrigin https://www.alldle.net The Alldle site that frames your game
connectTimeout 3000 How long to wait, in milliseconds, for Alldle’s frame to hand over the session

AllDle, the name from 0.1, is the same class.

Call it when a round ends, won or lost.

completeMode(mode: string, data: ModeCompletionData): Promise<{ recorded: boolean; linked: boolean; error?: string }>
Field Type Notes
won boolean Required. Whether the player solved it
attempts number Guesses used. A whole number, 1 to 1,000
maxAttempts number Guesses allowed, so Alldle shows “3/6”. A whole number, 1 to 1,000
puzzleId string Your puzzle id, at most 64 characters. One result per player, mode, puzzle and day is kept. Without it, one per mode and day
durationMs number Time taken. A whole number, up to 86,400,000. Measured from startMode() when left out
score number Your own score, stored without being interpreted. A whole number within 1,000,000 of zero
resultGrid string Your emoji block. The caption line is dropped. Emoji, digits and basic separators only, 12 rows and 400 characters at most
Returned Meaning
recorded false for a puzzle the player already finished today, and when Alldle refused it
linked Whether the result is linked to an Alldle account
error Why it was refused

mode is at most 40 characters. A value out of range refuses the whole round, while a resultGrid that does not pass is dropped and the round is kept.

Optional. Marks the start of a round, so your dashboard can show how many are finished and how long they take.

startMode(mode: string, options?: { puzzleId?: string }): void

What this player already finished today. It reads from their Alldle account inside Alldle’s frame when they are signed in, and otherwise from what this browser reported.

getDailyStatus(): Promise<{ allModesCompleted: boolean; modes: Record<string, { completed: boolean }> } | null>

Read modes. Outside a signed-in player’s frame, allModesCompleted turns true after any one mode.

connect(), getSession(), isAuthenticated()

Section titled “connect(), getSession(), isAuthenticated()”

Who is playing, as far as Alldle knows. Reports and getDailyStatus() wait for the connection by themselves. getSession() and isAuthenticated() answer at once, so await alldle.connect() before reading them. The script tag connects on load, and with npm you call connect() yourself.

  • your game’s own domain and its subdomains
  • Alldle’s frame
  • localhost, shown live on your SDK page and left out of every figure

Requests are text/plain POSTs to https://api.alldle.net/sdk/v2/events, with keepalive: there is no preflight, and they still go out when the player closes the tab. Nothing the SDK does can throw into your game.

The SDK is MIT licensed.