Overview#
AWorld Lab is a multi-tenant gamification platform providing REST APIs across two contexts: App and Dashboard.Prerequisites#
AWorld Lab account (via administrator or sign-up)
Workspace ID for your environment
Basic understanding of REST APIs
Development environment with HTTP client
Account and Workspace Setup#
1. Get Access#
You'll receive an invitation email with account access instructions.2. User Types#
User: Workspace-scoped user with specific roles (admin, editor, viewer)
3. Workspace ID#
Your workspaceId identifies your isolated environment. You'll need this for authentication and API calls.API Domains#
Auth: https://auth.aworld.cloud
API: https://api.aworld.cloudDashboard (Admin) API: https://api.aworld.cloud/dashboard/v1/*
App (Consumer) API: https://api.aworld.cloud/app/v1/*
Authentication#
AWorld Lab uses AWS Cognito for authentication. Choose the method that fits your use case:Email OTP (passwordless): For interactive user login via one-time password sent by email. See Quick Start below. Access tokens contain critical claims including workspaceId, userId, and role. See JWT Token Structure for details.Quick Start: Email OTP#
See Authentication for complete implementation including server-side flows.API Contexts#
AWorld Lab exposes two API contexts with different base URLs:| Context | Base URL | Purpose | Auth Level |
|---|
| Dashboard (Admin/Management API) | /dashboard/v1/* | User management, content creation & configuration | Admin/Editor |
| App (Consumer/User-facing API) | /app/v1/* | End-user interactions, content consumption | User |
For server-side integrators: If you are integrating from a backend server, "Dashboard" is your management API (create users, configure content) and "App" is your consumer API (act on behalf of users). Each context requires its own set of client credentials (clientId and clientSecret). See the Server-side Integration Guide for a complete walkthrough.
Making Your First API Call#
REST Example: Get Missions (App Context)#
REST Example: Get Single Mission (App Context)#
REST Example: Submit Quiz (App Context)#
REST Example: Create Mission (Dashboard Context)#
Token Management#
Check Token Expiration#
Auto-Refresh Access Token#
API Wrapper with Auto-Refresh#
Common Patterns#
Error Handling#
Retry Logic with Exponential Backoff#
Workspace Context#
All API calls are scoped to your workspace via the workspaceId claim in your access token.Critical: Ensure your token's workspaceId matches the workspace you're accessing. APIs validate this on every request.Next Steps#
Learn Key Concepts#
Explore API References#
OpenAPI Specs: /packages/schemas/{context}/v1/openapi.jsonDashboard: Content creation & configuration
App: User-facing endpoints
Integration Best Practices#
1.
Always validate tokens: Check exp claim before use
2.
Implement auto-refresh: Handle token expiration gracefully
3.
Use idempotency keys: Prevent duplicate operations
4.
Enable compression: Include Accept-Encoding: gzip
5.
Handle errors properly: Implement retry with backoff
6.
Request only needed data: Minimize payload size
7.
Use pagination: Don't fetch all items at once
Troubleshooting#
Authentication Issues#
| Issue | Cause | Solution |
|---|
401 Unauthorized | Missing/expired token | Refresh access token |
403 Forbidden | Insufficient permissions | Check user role in token claims |
WORKSPACE_MISMATCH | Wrong workspaceId | Verify token's workspaceId claim |
API Usage#
| Issue | Cause | Solution |
|---|
400 Bad Request | Invalid input | Check error details for validation failures |
404 Not Found | Resource doesn't exist | Verify resource ID |
409 Conflict | Duplicate resource | Check if resource already exists |
422 Unprocessable | Semantic validation error | Review business logic constraints |
Common Mistakes#
1.
Not checking token expiration: Always validate exp claim
2.
Hardcoding workspaceId: Extract from token, don't assume
3.
Missing idempotency keys: Can cause duplicate resources
4.
Ignoring error details: Error responses contain helpful info
5.
Not using pagination: Fetching too much data at once
Support#
Documentation: Refer to Authentication and API Architecture docs
OpenAPI Specs: Complete endpoint reference in monorepo
Support: Contact your account administrator
Quick Reference#
Auth Domain: https://auth.aworld.cloudAPI Domain: https://api.aworld.cloudDashboard (Admin): /dashboard/v1/*
App (Consumer): /app/v1/*
Server-side Credentials (two separate sets required):Dashboard: clientId/clientSecret for /dashboard/v1/*
App: clientId/clientSecret for /app/v1/*
Authorization: Bearer {accessToken}
Content-Type: application/json
Accept-Encoding: gzip
x-idempotency-key: {uuid} (for mutations)
Modified at 2026-03-19 16:02:47