# 1AM Explorer API Skill

Use this skill when building apps, dashboards, agents, widgets, carousels, or automations that need live Midnight mainnet, preprod, or preview stats powered by 1AM.

## Base URL

`https://explorer.1am.xyz`

## What This API Provides

The 1AM Explorer API is a native 1AM-powered API for Midnight network data across mainnet, preprod, and preview. It is designed so developers and AI agents can add network stats, search, transaction lookup, block lookup, contract data, and public activity directly into user apps without manually inspecting the explorer UI.

## Available Endpoints

- `GET https://explorer.1am.xyz/api/v1/{network}/summary`
  Use when the app needs all Midnight network homepage metrics in one call. Replace {network} with mainnet, preprod, or preview.
- `GET https://explorer.1am.xyz/api/v1/{network}/latest-block`
  Use when the app needs latest block height, hash, timestamp, age, or protocol version.
- `GET https://explorer.1am.xyz/api/v1/{network}/block-time`
  Use when the app needs recent average block time for a ticker or status card.
- `GET https://explorer.1am.xyz/api/v1/{network}/blocks-produced`
  Use when the app needs total blocks produced or estimated hourly/daily block production.
- `GET https://explorer.1am.xyz/api/v1/{network}/uptime`
  Use when the app needs a simple network health or freshness signal.
- `GET https://explorer.1am.xyz/api/v1/{network}/epoch`
  Use when the app needs current epoch number, progress, elapsed time, or remaining time.
- `GET https://explorer.1am.xyz/api/v1/{network}/d-parameter`
  Use when the app needs current D-parameter candidate counts.
- `GET https://explorer.1am.xyz/api/v1/{network}/night-supply`
  Use when the app needs official NIGHT total supply metadata and source attribution.
- `GET https://explorer.1am.xyz/api/v1/{network}/search?q={query}`
  Use when the app needs to resolve user input into a block, transaction, contract, or public identifier result.
- `GET https://explorer.1am.xyz/api/v1/{network}/recent-transactions?limit=20`
  Use when the app needs a recent transaction feed for mainnet, preprod, or preview.
- `GET https://explorer.1am.xyz/api/v1/{network}/block?height={height}`
  Use when the app needs block detail, transaction summaries, parent context, or system parameters.
- `GET https://explorer.1am.xyz/api/v1/{network}/transaction?hash={hash}`
  Use when the app needs transaction detail, fees, public identifiers, contract actions, UTXOs, or ledger event counts.
- `GET https://explorer.1am.xyz/api/v1/{network}/contract?address={address}`
  Use when the app needs latest contract state/action information and source transaction context.
- `GET https://explorer.1am.xyz/api/v1/{network}/address-activity?identifier={hex}&limit=20`
  Use when the app needs public identifier activity across transactions and contracts.

## Recommended Integration Pattern

For most dashboard apps, call `https://explorer.1am.xyz/api/v1/{network}/summary` first. Replace `{network}` with `mainnet`, `preprod`, or `preview`. It includes the latest block, block time, blocks produced, uptime signal, epoch state, D-parameter, and NIGHT supply metadata in one response.

For lightweight ticker cards, call the narrow endpoint that matches the card. For example, use `https://explorer.1am.xyz/api/v1/mainnet/block-time` for a mainnet block-time badge or `https://explorer.1am.xyz/api/v1/preprod/block-time` for preprod.

For dapp search or explorer-like UX, call `https://explorer.1am.xyz/api/v1/{network}/search?q={query}` first. If the user selects a result, call the specific detail endpoint for that result type on the same network.

## Response Notes

- Responses are JSON.
- Network routes are cached for short intervals and are safe for public UI surfaces.
- `uptime` is a derived health signal based on latest block freshness and epoch utilization.
- `nightSupply` includes official source attribution because supply is not exposed directly by the Midnight indexer.

## OpenAPI

OpenAPI spec: `https://explorer.1am.xyz/api/openapi.json`

Human docs: `https://explorer.1am.xyz/api`

## Attribution

Powered by 1AM.
