Data Models
Core data models and TypeScript interfaces for the LegionEdge Platform
This page documents the core data models used throughout the LegionEdge Platform. All models are available as TypeScript interfaces from the @legionedge/sdk package.
User
Represents an authenticated user on the platform.
interface User {
id: string; // "user_abc123"
email: string;
name: string;
avatarUrl: string | null;
status: "active" | "suspended" | "pending";
emailVerified: boolean;
createdAt: string; // ISO 8601
updatedAt: string;
lastLoginAt: string | null;
metadata: Record<string, unknown>;
}Organization
The top-level entity for grouping users, projects, and billing.
interface Organization {
id: string; // "org_abc123"
name: string;
slug: string;
plan: "free" | "pro" | "enterprise";
ownerId: string;
billingEmail: string;
ssoEnabled: boolean;
createdAt: string;
updatedAt: string;
settings: OrganizationSettings;
}
interface OrganizationSettings {
defaultProjectEnvironment: "development" | "staging" | "production";
enforceSSO: boolean;
allowedDomains: string[];
maxProjects: number;
maxMembers: number;
}Project
A container for resources, deployments, and team collaboration.
interface Project {
id: string; // "proj_abc123"
name: string;
slug: string;
description: string;
organizationId: string;
status: "active" | "archived" | "suspended";
settings: ProjectSettings;
createdAt: string;
updatedAt: string;
}
interface ProjectSettings {
defaultEnvironment: "development" | "staging" | "production";
autoScaling: boolean;
notificationsEnabled: boolean;
secrets: Record<string, string>; // encrypted at rest
}Resource
Represents a managed resource within a project.
interface Resource {
id: string; // "res_abc123"
projectId: string;
type: "compute" | "storage" | "database" | "agent" | "custom";
name: string;
status: "provisioning" | "running" | "stopped" | "error" | "deprovisioned";
config: Record<string, unknown>;
region: string;
createdAt: string;
updatedAt: string;
healthCheck: {
status: "healthy" | "degraded" | "unhealthy";
lastCheckedAt: string;
};
}Team
A group of users within an organization with shared project access.
interface Team {
id: string; // "team_abc123"
organizationId: string;
name: string;
description: string;
members: TeamMember[];
createdAt: string;
updatedAt: string;
}
interface TeamMember {
userId: string;
role: "lead" | "member";
joinedAt: string;
}API Key
Represents a long-lived authentication credential.
interface ApiKey {
id: string; // "key_abc123"
organizationId: string;
name: string;
prefix: string; // "le_live_abc" (first 12 chars)
scopes: string[]; // ["projects:read", "resources:read"]
projectId: string | null; // null = org-wide
expiresAt: string | null;
lastUsedAt: string | null;
createdAt: string;
}Pagination
All list endpoints return paginated responses with a consistent envelope:
interface PaginatedResponse<T> {
data: T[];
pagination: {
total: number;
page: number;
perPage: number;
totalPages: number;
hasMore: boolean;
};
}Usage:
const response = await client.projects.list({
organizationId: "org_abc123",
page: 1,
perPage: 20,
});
console.log(`Showing ${response.data.length} of ${response.pagination.total} projects`);Next Steps
- See the API reference for how these models map to REST endpoints.
- Learn about authorization policies that control access to these entities.