The Public Files API
Query any published MyJay site's asset index directly from your application code. Zero setup, zero scraping, full CORS flexibility.
The Problem This Solves
Building custom dynamic interfaces (like portfolios, blogs, or anthologies) on top of traditional static hosts usually requires heavy build-steps or parsing HTML strings via fragile scraping tools.
The Public Files API treats your static directories as a live, queryable data layout. Pass a username, and MyJay returns a structural mapping of every file that site owns. This makes it effortless to turn your MyJay files into a headless content directory.
The Endpoint
GET https://myjay.net/api/sites/:username/files
Replace :username with the targeted site's subdomain (the segment preceding .myjay.net). Use lowercase strings only; omit sub-paths or protocols.
Response Schema
| Field | Type | Description |
|---|---|---|
username | string | The requested user subdomain target. |
files | array | An un-ordered collection of all public objects contained in the site directory. |
files[].key | string | Relative path starting from the root directory (e.g., literature/story-one.md). |
files[].size | number | Exact storage allocation in bytes. |
files[].modified | string | ISO 8601 string documenting the file's last update timestamp. |
Note on architecture: MyJay relies on a flat key-value architecture. Folders do not exist as independent systemic entries. A key featuring a forward slash is simply an individual file object explicitly tracking its directory pathway prefix. See the File Manager docs for more detail.
Integration Example (JavaScript Fetch)
Because this API is completely unauthenticated and cross-origin accessible, you can dynamically read, sort, and render contents inside client-side components:
Route Matching & Accessibility
The endpoint strictly mimics the identical availability checks running on the production gateway at username.myjay.net. Review how routing works for comprehensive details:
| Deployment State | HTTP Status | Payload String / Action |
|---|---|---|
| Subdomain is unregistered or expired | 404 Not Found | "No site is registered at this subdomain" |
| Registered account, currently in draft state | 403 Forbidden | "This site exists but has not been published" |
| Registered and explicitly live | 200 OK | Returns structural JSON file array listing. |
This mechanism presents no security surface exposure risks: it treats visibility exactly like standard web requests. Unauthenticated external requests will never read index mappings belonging to un-published or draft accounts.
Authentication & CORS Scope
While account actions or site writing requires specific cookies or explicit authorization headers, this route functions with no barriers:
- No Keys Required: No bearer tokens, access parameters, or active user sessions are demanded.
- Wildcard CORS (
Access-Control-Allow-Origin: *): Explicitly unrestricted permissions allow direct queries from cross-origin contexts, including frontend browser engines, automation servers, workflows, or remote local hosts.
Limitations & Exclusions
- No Inline Payload Data: This is an inventory summary mapping, not a content bundle tool. To ingest file bodies, perform distinct requests directly to the file distribution network targets (e.g.,
https://noah.myjay.net/literature/story-one.md). - Empty Virtual Pathways: Directory names containing zero active tracking files are not included in results since empty folders are structurally dropped by the system engine.