openapi: 3.0.3
info:
  title: MineMaps Public API
  version: 1.0.0
  description: |
    Read-only published Minecraft map data. List endpoints use offset pagination.
    Requests may be anonymous or use an operator-issued X-API-Key for a higher quota.
    The per-process quotas are 120 requests/minute per anonymous socket IP and 600 per valid key.
servers:
  - url: /api/v1
security:
  - {}
  - ApiKey: []
paths:
  /overview:
    get:
      operationId: getAtlasOverview
      summary: Get published coverage totals and the five most recently updated mapped worlds
      responses:
        '200':
          description: Published atlas overview
          content:
            application/json:
              schema:
                type: object
                required: [data]
                properties:
                  data:
                    type: object
                    required: [worlds, chunks, panoramas, recent]
                    properties:
                      worlds: { type: integer }
                      chunks: { type: integer }
                      panoramas: { type: integer }
                      recent:
                        type: array
                        maxItems: 5
                        items:
                          type: object
                          required: [id, serverId, serverName, name, scannedChunks, updatedAt]
                          properties:
                            id: { type: string }
                            serverId: { type: string }
                            serverName: { type: string }
                            name: { type: string }
                            scannedChunks: { type: integer }
                            updatedAt: { type: string, format: date-time, nullable: true }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /servers:
    get:
      operationId: listServers
      summary: List published servers
      parameters:
        - in: query
          name: q
          description: Case insensitive substring of the server name or address
          schema: { type: string, maxLength: 100 }
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
      responses:
        '200':
          description: Published data
          headers: &quotaHeaders
            X-RateLimit-Limit: { $ref: '#/components/headers/RateLimit' }
            X-RateLimit-Remaining: { $ref: '#/components/headers/RateRemaining' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ServerPage' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /servers/{serverId}:
    get:
      operationId: getServer
      summary: Get a published server
      parameters:
        - $ref: '#/components/parameters/ServerId'
      responses:
        '200':
          description: Published data
          headers: *quotaHeaders
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ServerResult' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /servers/{serverId}/worlds:
    get:
      operationId: listWorlds
      summary: List published worlds on a server
      parameters:
        - $ref: '#/components/parameters/ServerId'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
      description: An unknown or unpublished parent returns an empty list.
      responses:
        '200':
          description: Published data
          headers: *quotaHeaders
          content:
            application/json:
              schema: { $ref: '#/components/schemas/WorldPage' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /worlds/{worldId}/metadata:
    get:
      operationId: getWorldMetadata
      summary: Get world bounds and scan coverage
      parameters:
        - $ref: '#/components/parameters/WorldId'
        - in: query
          name: live
          description: Set to 1 to bypass the public response cache
          schema: { type: string, enum: ['1'] }
      responses:
        '200':
          description: Published data
          headers: *quotaHeaders
          content:
            application/json:
              schema: { $ref: '#/components/schemas/WorldMetadataResult' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /worlds/{worldId}/history/changes:
    get:
      operationId: compareSnapshotTiles
      summary: List differing zoom 22 tiles between two published versions of one world
      parameters:
        - $ref: '#/components/parameters/WorldId'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
        - in: query
          name: left
          description: Base snapshot ID. Omit to use the current map.
          schema: { type: string, maxLength: 128 }
        - in: query
          name: right
          required: true
          description: Snapshot ID for comparison
          schema: { type: string, maxLength: 128 }
      responses:
        '200':
          description: Tile coordinates and type of difference. Rendering and coverage can differ between versions.
          content:
            application/json:
              schema:
                type: object
                required: [data, pagination]
                properties:
                  pagination: { $ref: '#/components/schemas/Pagination' }
                  data:
                    type: array
                    items:
                      type: object
                      required: [x, y, kind]
                      properties:
                        x: { type: integer }
                        y: { type: integer }
                        kind: { type: string, enum: [changed, left-only, right-only] }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /worlds/{worldId}/players:
    get:
      operationId: listLivePlayers
      summary: List consented live player markers
      description: Returns active player positions only when the server owner enabled markers. Each player must opt in, and stale positions expire after 45 seconds.
      parameters:
        - $ref: '#/components/parameters/WorldId'
      responses:
        '200':
          description: Live positions or an empty list when the owner disabled markers
          headers: *quotaHeaders
          content:
            application/json:
              schema: { $ref: '#/components/schemas/LivePlayersResult' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /worlds/{worldId}/tiles/{z}/{x}/{y}:
    get:
      operationId: getTile
      summary: Get a current raster tile
      parameters:
        - $ref: '#/components/parameters/WorldId'
        - $ref: '#/components/parameters/Zoom'
        - $ref: '#/components/parameters/TileX'
        - $ref: '#/components/parameters/TileY'
      responses:
        '200': { $ref: '#/components/responses/Tile' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /worlds/{worldId}/panoramas:
    get:
      operationId: listPanoramas
      summary: List panorama locations
      parameters:
        - $ref: '#/components/parameters/WorldId'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
      description: An unknown or unpublished parent returns an empty list.
      responses:
        '200':
          description: Published data
          headers: *quotaHeaders
          content:
            application/json:
              schema: { $ref: '#/components/schemas/PanoramaPage' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /panoramas/{panoramaId}:
    get:
      operationId: getPanorama
      summary: Get panorama metadata and image URL
      parameters:
        - $ref: '#/components/parameters/PanoramaId'
      responses:
        '200':
          description: Published data
          headers: *quotaHeaders
          content:
            application/json:
              schema: { $ref: '#/components/schemas/PanoramaResult' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /panoramas/{panoramaId}/image:
    get:
      operationId: getPanoramaImage
      summary: Get a published panorama PNG
      parameters:
        - $ref: '#/components/parameters/PanoramaId'
      responses:
        '200': { $ref: '#/components/responses/PanoramaImage' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /worlds/{worldId}/history:
    get:
      operationId: listSnapshots
      summary: List snapshots, newest first
      parameters:
        - $ref: '#/components/parameters/WorldId'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
      description: An unknown or unpublished parent returns an empty list.
      responses:
        '200':
          description: Published data
          headers: *quotaHeaders
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SnapshotPage' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
  /worlds/{worldId}/history/{snapshotId}/tiles/{z}/{x}/{y}:
    get:
      operationId: getSnapshotTile
      summary: Get a retained snapshot tile
      parameters:
        - $ref: '#/components/parameters/WorldId'
        - $ref: '#/components/parameters/SnapshotId'
        - $ref: '#/components/parameters/Zoom'
        - $ref: '#/components/parameters/TileX'
        - $ref: '#/components/parameters/TileY'
      responses:
        '200': { $ref: '#/components/responses/Tile' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/InvalidKey' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/RateLimited' }
        '503': { $ref: '#/components/responses/Unavailable' }
components:
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
  parameters:
    ServerId: { in: path, name: serverId, required: true, schema: { type: string } }
    WorldId: { in: path, name: worldId, required: true, schema: { type: string } }
    PanoramaId: { in: path, name: panoramaId, required: true, schema: { type: string } }
    SnapshotId: { in: path, name: snapshotId, required: true, schema: { type: string } }
    Zoom: { in: path, name: z, required: true, schema: { type: integer, minimum: 0, maximum: 24 } }
    TileX:
      in: path
      name: x
      required: true
      description: XYZ tile column, less than 2 raised to the zoom.
      schema: { type: integer, minimum: 0 }
    TileY:
      in: path
      name: y
      required: true
      description: XYZ tile row, less than 2 raised to the zoom.
      schema: { type: integer, minimum: 0 }
    Limit: { in: query, name: limit, schema: { type: integer, minimum: 1, maximum: 100, default: 50 } }
    Offset: { in: query, name: offset, schema: { type: integer, minimum: 0, maximum: 1000000, default: 0 } }
  headers:
    RateLimit:
      description: Request quota for the current client in a 60-second window.
      schema: { type: integer, enum: [120, 600] }
    RateRemaining:
      description: Requests remaining in the current window.
      schema: { type: integer, minimum: 0 }
  responses:
    Tile:
      description: Raster image in the stored format
      headers: *quotaHeaders
      content:
        image/webp: { schema: { type: string, format: binary } }
        image/avif: { schema: { type: string, format: binary } }
        image/png: { schema: { type: string, format: binary } }
    PanoramaImage:
      description: Equirectangular 2:1 panorama stored as PNG
      headers: *quotaHeaders
      content:
        image/png: { schema: { type: string, format: binary } }
    BadRequest:
      description: Invalid pagination, tile coordinates, or path encoding
      headers: *quotaHeaders
      content: &errorContent
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    InvalidKey:
      description: The supplied API key is invalid
      headers: *quotaHeaders
      content: *errorContent
    NotFound:
      description: The resource is absent or unpublished
      headers: *quotaHeaders
      content: *errorContent
    RateLimited:
      description: The quota has been exhausted
      headers:
        X-RateLimit-Limit: { $ref: '#/components/headers/RateLimit' }
        X-RateLimit-Remaining: { $ref: '#/components/headers/RateRemaining' }
        Retry-After: { description: Seconds until the quota resets, schema: { type: integer, minimum: 1 } }
      content: *errorContent
    Unavailable:
      description: The database is unavailable or unconfigured
      headers: *quotaHeaders
      content: *errorContent
  schemas:
    Error:
      type: object
      required: [statusCode, statusMessage]
      properties:
        statusCode: { type: integer }
        statusMessage: { type: string }
    Pagination:
      type: object
      required: [limit, offset, hasMore]
      properties:
        limit: { type: integer, minimum: 1, maximum: 100 }
        offset: { type: integer, minimum: 0, maximum: 1000000 }
        hasMore: { type: boolean }
    Server:
      type: object
      required: [id, name, description, address]
      properties:
        id: { type: string }
        name: { type: string }
        description: { type: string, nullable: true }
        address: { type: string, nullable: true }
    World:
      type: object
      required: [id, name, dimension, updatedAt]
      properties:
        id: { type: string }
        name: { type: string }
        dimension: { type: string, example: 'minecraft:overworld' }
        updatedAt: { type: string, format: date-time, nullable: true }
        capturedVersion: { type: string, nullable: true, description: Minecraft version of the newest retained full block capture }
        panoramaCount: { type: integer, minimum: 0 }
        snapshotCount: { type: integer, minimum: 0 }
    WorldMetadata:
      allOf:
        - $ref: '#/components/schemas/World'
        - type: object
          required: [minX, minZ, maxX, maxZ, scannedChunks, maxTileZoom]
          properties:
            minX: { type: integer, nullable: true }
            minZ: { type: integer, nullable: true }
            maxX: { type: integer, nullable: true }
            maxZ: { type: integer, nullable: true }
            scannedChunks: { type: integer }
            maxTileZoom: { type: integer, minimum: 0, maximum: 24, description: Highest stored tile zoom for this map. }
    LivePlayer:
      type: object
      required: [uuid, name, dimension, x, y, z, yaw, updatedAt]
      properties:
        uuid: { type: string, format: uuid }
        name: { type: string, maxLength: 16 }
        dimension: { type: string }
        x: { type: number, format: double }
        y: { type: number, format: double }
        z: { type: number, format: double }
        yaw: { type: number, format: float }
        updatedAt: { type: string, format: date-time }
    PanoramaLocation:
      type: object
      required: [id, x, y, z, capturedAt]
      properties:
        id: { type: string }
        x: { type: number, format: double }
        y: { type: number, format: double }
        z: { type: number, format: double }
        capturedAt: { type: string, format: date-time }
    Panorama:
      allOf:
        - $ref: '#/components/schemas/PanoramaLocation'
        - type: object
          required: [worldId, imageUrl, links]
          properties:
            worldId: { type: string }
            imageUrl: { type: string }
            links:
              type: array
              items:
                type: object
                required: [id, distance]
                properties:
                  id: { type: string }
                  distance: { type: integer, minimum: 0, description: Straight-line distance in Minecraft blocks. }
    Snapshot:
      type: object
      required: [id, capturedAt, description, waterColumns, surfaceColumns, waterCoverage, maxTileZoom]
      properties:
        id: { type: string }
        capturedAt: { type: string, format: date-time }
        description: { type: string, nullable: true }
        maxTileZoom: { type: integer, minimum: 0, maximum: 24, description: Highest stored tile zoom for this snapshot. }
        waterColumns: { type: string, pattern: '^[0-9]+$', nullable: true }
        surfaceColumns: { type: string, pattern: '^[0-9]+$', nullable: true }
        waterCoverage:
          type: number
          format: double
          minimum: 0
          maximum: 1
          nullable: true
          description: Fraction of captured surface columns whose topmost block was water.
    ServerPage:
      type: object
      required: [data, pagination]
      properties:
        data:
          type: array
          items: { $ref: '#/components/schemas/Server' }
        pagination: { $ref: '#/components/schemas/Pagination' }
    ServerResult:
      type: object
      required: [data]
      properties:
        data: { $ref: '#/components/schemas/Server' }
    WorldPage:
      type: object
      required: [data, pagination]
      properties:
        data:
          type: array
          items: { $ref: '#/components/schemas/World' }
        pagination: { $ref: '#/components/schemas/Pagination' }
    WorldMetadataResult:
      type: object
      required: [data]
      properties:
        data: { $ref: '#/components/schemas/WorldMetadata' }
    LivePlayersResult:
      type: object
      required: [enabled, data]
      properties:
        enabled: { type: boolean, description: Whether the server owner currently allows opt-in player markers. }
        data:
          type: array
          maxItems: 64
          items: { $ref: '#/components/schemas/LivePlayer' }
    PanoramaPage:
      type: object
      required: [data, pagination]
      properties:
        data:
          type: array
          items: { $ref: '#/components/schemas/PanoramaLocation' }
        pagination: { $ref: '#/components/schemas/Pagination' }
    PanoramaResult:
      type: object
      required: [data]
      properties:
        data: { $ref: '#/components/schemas/Panorama' }
    SnapshotPage:
      type: object
      required: [data, pagination]
      properties:
        data:
          type: array
          items: { $ref: '#/components/schemas/Snapshot' }
        pagination: { $ref: '#/components/schemas/Pagination' }
