Data Model

Core entities, relationships, and field definitions used across the MyLib API.

Entities

User

Represents a human user in the system.

FieldTypeDescription
idstringUnique identifier. Prefix: usr_.
namestringFull display name.
emailstringUnique email address.
rolesstring[]Assigned roles.
statusenumactive | suspended | deleted
createdAtISO 8601Account creation timestamp.
updatedAtISO 8601Last modification timestamp.
interface User {
  id:        string;
  name:      string;
  email:     string;
  roles:     Role[];
  status:    'active' | 'suspended' | 'deleted';
  createdAt: string;  // ISO 8601
  updatedAt: string;
}

Token

Represents an API authentication token.

FieldTypeDescription
idstringUnique identifier. Prefix: tok_.
namestringHuman-readable label.
scopesstring[]Permission scopes granted.
lastUsedAtISO 8601 | nullWhen the token was last used.
expiresAtISO 8601 | nullExpiry time, or null if permanent.
createdAtISO 8601Creation timestamp.

ID Format

All entity IDs follow the pattern {prefix}_{random}:

  • usr_ — Users
  • tok_ — Tokens
  • org_ — Organizations

IDs are opaque strings — do not attempt to parse them. Their format may change between API versions.

Pagination Envelope

All list endpoints return results wrapped in a standard envelope:

interface PaginatedResponse<T> {
  data:  T[];
  meta: {
    page:    number;
    limit:   number;
    total:   number;
    hasMore: boolean;
  };
}

Timestamps

All timestamps are returned in ISO 8601 UTC format:

2025-01-15T09:30:00.000Z

When filtering by timestamp, you may use any ISO 8601 date string:

?since=2025-01-01
?since=2025-01-01T00:00:00Z