Skip to main content
A space is a data ownership container in TinyCloud. Each user has their own space where their data is stored and controlled.

Space ID Format

Space IDs follow the format:
{address}-{chainId}-{prefix}
ComponentDescriptionExample
addressEthereum address (lowercase)0x1234...abcd
chainIdEIP-155 chain ID1 (mainnet), 11155111 (sepolia)
prefixApplication identifiermy-app
Example space ID:
0x1234567890abcdef1234567890abcdef12345678-1-my-app

Auto-Creation vs Manual

By default, spaces are created automatically on first sign-in.
const tc = new TinyCloudWeb({
  host: 'https://api.tinycloud.xyz',
  prefix: 'my-app',
  // autoCreateSpace: true (default)
});

await tc.signIn();
// Space created automatically if it doesn't exist
To disable auto-creation:
const tc = new TinyCloudWeb({
  host: 'https://api.tinycloud.xyz',
  prefix: 'my-app',
  autoCreateSpace: false,
});

await tc.signIn();
// Throws error if space doesn't exist

Getting Space ID

After sign-in, retrieve the space ID for the current session.
await tc.signIn();

const spaceId = tc.userAuthorization.getSpaceId();
console.log('Space:', spaceId);
// "0x1234...abcd-1-my-app"

Prefix Usage

The prefix isolates data between different applications for the same user.
// User's game data
const gameClient = new TinyCloudWeb({
  host: 'https://api.tinycloud.xyz',
  prefix: 'my-game',
});

// User's notes data (separate space)
const notesClient = new TinyCloudWeb({
  host: 'https://api.tinycloud.xyz',
  prefix: 'my-notes',
});
Same wallet, different spaces:
  • 0x1234...abcd-1-my-game
  • 0x1234...abcd-1-my-notes
Data in one space is completely isolated from other spaces, even for the same user.