Make a GeeSome deployment understandable and safely usable by an automated agent that starts with only the public site URL. The agent should not need to inspect frontend bundles, guess reverse-proxy prefixes, read server source, or infer response shapes before it can authenticate, upload immutable content, verify it, and construct a public URL.
This document records recommendations from the Meat Master character-asset integration performed on 2026-07-31. It is an API roadmap, not a claim that the target contracts are already implemented.
See Agent-Friendly API Implementation Plan for the current-state gap analysis, phased delivery sequence, workstream scopes, and verification gates.
The repository-level API contract was understandable after reading the
content, storage, and gateway modules, but the deployed contract was not
discoverable from the public URL:
https://geesome.microwavedev.io/served the frontend.GET /v1andGET /.well-known/openapi.jsonreturned nginx 404 responses.GET /api/v1returned the API discovery document.- Authenticated upload therefore used
POST /api/v1/user/save-file. - Immutable reads used the separate public route
GET /ipfs/<storageId>. - Raw image storage required the non-obvious multipart field
driver={"raw":true}to avoid unnecessary preview processing. - Upload responses may be synchronous content records or asynchronous operation handles. A caller must understand both before it can safely obtain a CID.
- Invalid gateway identifiers can return status codes and bodies that do not explain the error as a stable machine-readable API problem.
The API has the necessary capabilities. The main problem is that deployment routing and operation semantics are implicit instead of self-describing.
Every deployment should expose this document at a conventional route that the frontend proxy cannot shadow:
GET /.well-known/geesome
Content-Type: application/jsonRecommended response:
{
"schemaVersion": 1,
"product": "geesome",
"apiVersion": "v1",
"apiBaseUrl": "https://geesome.example/api/v1",
"gatewayBaseUrl": "https://geesome.example",
"openapiUrl": "https://geesome.example/api/v1/openapi.json",
"docsUrl": "https://geesome.example/api/v1/docs",
"healthUrl": "https://geesome.example/api/v1/health",
"capabilities": {
"contentUpload": true,
"rawContentUpload": true,
"asyncOperations": true,
"batchContentUpload": false
}
}Requirements:
- Serve the same response from the site root, API service, and documented reverse-proxy topology.
- Use absolute URLs so clients do not have to combine
/api,/v1, gateway, and frontend paths. - Add
Linkheaders for discovery and OpenAPI to responses from/,/api, and/api/v1. - Make deployment startup fail when advertised discovery URLs do not resolve through the configured public origin.
- Add an external black-box test against the nginx entry point, not only the Express application.
All API and gateway errors should use application/problem+json:
{
"type": "https://docs.geesome.example/problems/content-not-found",
"title": "Content not found",
"status": 404,
"code": "content_not_found",
"detail": "No readable content exists for the supplied storageId.",
"requestId": "req_01...",
"docsUrl": "https://docs.geesome.example/api/content#get-by-storage-id"
}Use conventional meanings consistently:
400for malformed CIDs, multipart bodies, and unsupported options.401for missing or invalid credentials.403for valid credentials without the required scope.404for absent content.409for idempotency or path conflicts that require caller action.413for upload limits, with the accepted maximum in problem details.422for valid syntax that violates content policy.429withRetry-Afterfor rate limits.502or503for unavailable storage backends.
Never return an nginx HTML error for a documented API route. Preserve a stable
requestId through nginx, API logs, async jobs, storage calls, and responses.
Keep the general content API, but add a small, explicit contract for application assets. The caller should not need to know driver internals or database content models.
POST /v1/assets
Authorization: Bearer <api-key>
Idempotency-Key: meat-master:runtime:velora:idle:<sha256>
Content-Type: multipart/form-data
file=<binary>
expectedSha256=<lowercase hex>
logicalPath=games/meat-master/characters/velora/idle.webpRecommended synchronous response:
{
"schemaVersion": 1,
"assetId": "asset_01...",
"storageId": "bafkrei...",
"sha256": "0123456789abcdef...",
"bytes": 84217,
"mimeType": "image/webp",
"created": true,
"pinStatus": "pinned",
"urls": {
"content": "https://geesome.example/ipfs/bafkrei...",
"metadata": "https://geesome.example/api/v1/assets/bafkrei..."
}
}Behavior:
- Treat raw immutable storage as the default for this endpoint.
- Verify
expectedSha256while streaming and reject mismatches before publication. - Return the existing record with
created: falsewhen the same user uploads the same bytes with the same idempotency key. - Return both CID and SHA-256. CID is the storage identity; SHA-256 verifies bytes in caches and build pipelines without requiring every client to decode UnixFS/DAG details.
- Include pin/replication status so a successful database write is not mistaken for durable availability.
- Make
logicalPathoptional metadata. It must not change immutable identity. - Keep generated previews opt-in through an explicit
previewPolicy, rather than an encodeddriverJSON string.
Support both GET and HEAD on immutable content and return:
ETag: "bafkrei..."
Digest: sha-256=<RFC-compliant digest>
Content-Length: 84217
Content-Type: image/webp
Cache-Control: public, max-age=31536000, immutable
Accept-Ranges: bytes
X-Geesome-Storage-Id: bafkrei...
X-Request-Id: req_01...Document whether the gateway can serve content immediately after upload and whether callers should poll pin status. Preserve CORS for public browser assets and do not require authorization for content explicitly published as public.
Do not return two unrelated success shapes from one request. Use:
201 Createdwith the final asset representation for synchronous completion.202 AcceptedwithLocation,Retry-After, and one operation resource for asynchronous completion.
{
"schemaVersion": 1,
"operationId": "op_01...",
"status": "pending",
"statusUrl": "https://geesome.example/api/v1/operations/op_01..."
}The operation resource should have stable pending, running, succeeded,
failed, and cancelled states. On success it should embed or link the same
asset response returned by the synchronous route. On failure it should embed
the standard problem document.
- Give API keys explicit scopes such as
assets:write,assets:read-private,content:write, andoperations:read. - Provide key name, creation time, last-used time, expiry, and revocation.
- Return required scopes in
403problem details without exposing secrets. - Support short-lived integration tokens for CI when practical.
- Never accept secrets in query strings or return them in discovery, errors, or logs.
- Document upload ownership, retention, deletion, and garbage-collection implications for immutable CIDs.
Game releases commonly publish dozens or hundreds of files. Add a batch flow that is resumable and idempotent:
POST /v1/asset-batcheswith logical IDs, sizes, MIME types, and SHA-256.- The server returns which hashes already exist and which require upload.
- The client uploads missing files with per-item idempotency keys.
POST /v1/asset-batches/<id>/completeverifies every item and returns a signed/hash-bound manifest.
The final manifest should contain stable logical IDs, CIDs, SHA-256, sizes, MIME types, public URLs, and pin status. Partial retries must not create duplicate library rows or folder entries.
The public OpenAPI document should describe:
- The externally reachable
/api/v1server URL from deployment config. - Multipart
filefields astype: string,format: binary. - Bearer authentication and required scopes per route.
- Sync and async responses with discriminators or distinct status codes.
- Standard problem responses and rate-limit headers.
- CID and SHA-256 formats, examples, and maximum lengths.
- Upload limits and supported MIME types.
Provide tested examples for curl and modern Node.js fetch. Every example
should begin with discovery, avoid hardcoded /api, verify returned bytes, and
redact credentials. Run examples in CI against a disposable node and through
the same reverse proxy used in production.
- Include deployment version, API version, and capability flags in discovery.
- Add deprecation and sunset headers before removing fields or routes.
- Keep additive response changes safe for strict clients.
- Publish a compact changelog link and migration notes in discovery.
- Expose storage backend characteristics without leaking infrastructure: CID type, maximum object size, immediate-read guarantee, pin policy, and range support.
An agent integrating GeeSome should be able to follow this deterministic path:
- Fetch
/.well-known/geesome. - Fetch the advertised OpenAPI document.
- Check
capabilities.contentUploadorcapabilities.rawContentUpload. - Validate credentials with a non-mutating endpoint that reports scopes.
- Upload with SHA-256 and an idempotency key.
- Resolve a
201asset or poll a202operation. HEADandGETthe advertised content URL.- Verify digest and byte count.
- Persist CID plus SHA-256 in the consuming repository manifest.
Repo documentation should route API tasks here from docs/README.md and
docs/agent-map.md. Module details remain in the owning module docs; this file
defines the cross-module public integration experience.
- Public
/.well-known/geesomeworks through nginx. - Every advertised absolute URL is tested from outside the container.
- OpenAPI describes the deployed prefix and multipart upload correctly.
- Raw asset upload requires no driver-specific knowledge.
- Upload supports SHA-256 verification and idempotency.
- Sync and async responses have deterministic status codes and schemas.
- Gateway
HEADexposes immutable cache and digest headers. - Errors are JSON problem documents with stable codes and request IDs.
- Integration API keys use minimal scopes and can be revoked.
- A 50-file interrupted batch resumes without duplicates.
- Curl and Node examples run in CI through the production-shaped proxy.
- The Meat Master asset publish/hydrate contract passes against the public deployment without endpoint-prefix heuristics.