The ERM API implements uses RESTful principles to provide consistent, basic data about servers data that you can integrate with your services.

Authentication Protocol

The API implements stateless authentication using cryptographically secure tokens.

Implementation Pattern

Requests must include the token in the Authorization header and the Guild in the Guild header:
curl -X GET \
  -H "Authorization: ${TOKEN}" \
  -H "Guild: $GUILD_ID" \
  -H "Content-Type: application/json" \
  https://core.ermbot.xyz/api/v1/shifts

Response Schema

The API implements a normalized response envelope pattern:
interface ResponseEnvelope<T> {
  data: T[];              // Resource collection
  pagination: {
    next_cursor: number;  // Temporal cursor position
    limit: number;        // Result set boundary
    has_more: boolean;    // Collection continuation flag
  }
}

Cursor-Based Pagination Implementation

The API implements resource-specific pagination mechanisms:

Resource-Specific Cursor Types

Shifts

  • Type: Unix Timestamp (float)
  • Format: Base-10 decimal timestamp
  • Example: 1736302471.07677
  • Usage: Time-based ordering of shift records

Moderations

  • Type: Discord Snowflake (int64)
  • Format: Discord-generated unique ID
  • Example: 1090340521350131742
  • Usage: Discord event sequencing

Leaves

  • Type: Unix Epoch (int64)
  • Format: Seconds since Unix epoch
  • Example: 1702544876
  • Usage: Chronological ordering of leave records

Query Parameters

ParameterTypeDescription
afterVariesCursor position (see resource type)
limitintegerResult set size constraint

Implementation Examples

# Shifts - Unix timestamp cursor
GET /api/v1/shifts?after=1736302471.07677&limit=50

# Moderations - Snowflake cursor
GET /api/v1/moderations?after=1090340521350131742&limit=50

# Leaves - Epoch timestamp cursor
GET /api/v1/leaves?after=1702544876&limit=50

Error Handling

When an error occurs, you’ll receive:
{
  "status": 400,
  "message": "Error description",
  "error_code": "ERROR_TYPE"
}