Link Search Menu Expand Document (external link)

Introduction

The Spyglass Web API provides access to various information that is helpful for data pack/resource pack toolings. It uses misode/mcmeta and SpyglassMC/vanilla-mcdoc under the hood and provides a few advantages over using the GitHub API directly:

  • Accessible within regions that have blocked raw.githubusercontent.com access.

  • Cache invalidation is handled through standard HTTP headers like ETag and If-None-Match; no more git commit sha hackery needed on client side.

  • Cleaner?

General Usage

The Spyglass API root endpoint is https://api.spyglassmc.com/. Clients must identify themselves using the User-Agent HTTP header; requests without the User-Agent header will be rejected.

Error Handling

All error responses (HTTP status code 4xx and 5xx) will include a JSON body with the following structure:

  • message: (str) A human readable message describing the error details.

Conditional Requests

All API endpoints include an ETag header in the response. Clients should cache the value of ETag along with the response body if possible, which can be achieved using the CacheStorage API on browsers. For future requests at the same endpoint, clients should include the value of ETag in the If-None-Match request header. A 304 Not Modified response will be returned if the resource has not changed since the last response.

Ratelimiting

Ratelimiting is generous and should not be hit by normal usage.

Endpoints

POST /hooks/github

Not for third party use. This endpoint accepts GitHub Webhook deliveries to update the local Git repositories.