Skip to main content

๐Ÿ”Œ API Reference

The deployed Cloud Functions, callable contracts, REST routes, and MCP boundary.

:::info Verification scope This page verifies the TypeScript/Firebase surface in acesense-auth-function and the rewrites in acesense-api-hosting. GPU-provider wire details are deliberately omitted from this non-GPU audit. :::

Runtimeโ€‹

  • Firebase project: acesense-prod
  • Region: europe-west1
  • Runtime: Node.js 22
  • Function entry point: acesense-auth-function/index.ts

Mobile upload callablesโ€‹

requestUploadPathโ€‹

Authenticated callable with App Check policy from shared/app-check.ts. It requires durable AI consent, an active trial/paid entitlement, available monthly budget, and available daily/concurrent quota.

interface VideoMetadata {
fileName: string;
fileSize: number;
duration: number;
width: number;
height: number;
format: string;
codec?: string;
}

interface UploadPathResponse {
uploadPath: string;
resultPath: string;
jobId: string;
sessionId: string;
expiresAt: number;
quota: {
plan: string;
uploadsToday: number;
uploadsPerDay: number;
concurrent: number;
concurrentLimit: number;
resetsAt: number;
};
}

The server ignores client session identifiers and generates its own. Paths are:

videos/{uid}/{sessionId}/{sessionId}_chunk_001.mp4
results/{uid}/{sessionId}/{sessionId}_combined.json

Limits from shared/config.ts: 2 GiB, 2 hours, and mp4, mov, avi, or mkv metadata. Current Storage rules permit owner uploads only when the object is video/mp4, so mobile uploads use the generated .mp4 path.

reportUploadFailureโ€‹

Request: { jobId: string, errorMessage?: string }.

Only the owner may report failure, and only while the job remains pending. It fails the job and releases the reserved concurrency slot. A late report cannot cancel processing that already started.

checkJobStatusโ€‹

Authenticated status reconciliation for a job owned by the caller. The client uses it as a backend-authoritative status refresh; Firestore remains the live UI source.

mergeChunkResultsโ€‹

Authenticated compatibility callable accepting { sessionId: string, totalChunks: number }. The shipped client uploads one file, but the server retains this contract for legacy/deferred chunking.

User and account callablesโ€‹

FunctionPurpose
createUserDocumentAuth-create trigger; seeds trial/profile state
deleteUserDocumentAuth-delete trigger; cascades user data
markEmailVerifiedRecords verified-email state and welcome workflow
sendPasswordResetCustomSends the custom reset flow
exportUserDataCreates a user data export
requestAccountDeletionStarts account deletion
deleteSessionDeletes a job and its Storage artifacts

Coach callablesโ€‹

becomeCoach, createCoachLink, respondToCoachLink, listCoachLinks, addCoachNote, and listCoachNotes implement two-sided coach/player consent. All are authenticated v2 callables in europe-west1.

Admin callablesโ€‹

Admin functions use the shared requireAdmin guard. They include retry/status, user, plan, suspension, API-key balance/revocation, moderation, impersonation, Storage browsing, and purge operations. bootstrapAdminClaims self-heals the custom claim for a verified allowlisted admin.

Public REST APIโ€‹

Firebase Hosting preserves the /v1/** path and rewrites it to apiServer.

MethodRouteAuth
GET/v1/healthzNone
GET/v1/pricingNone
POST/v1/jobsAPI key
GET/v1/jobs/:jobIdOwning API key
GET/v1/jobs/:jobId/resultOwning API key
GET/v1/usageAPI key

API keys are created and revoked through Firebase callables: createApiKey, listApiKeys, and revokeApiKey. See Agent API + MCP for billing and key details.

MCPโ€‹

https://api.acesense.io/mcp rewrites to mcpServer. GET returns endpoint metadata; POST uses streamable HTTP with MCP protocol 2025-06-18.

Scheduled and event functionsโ€‹

FunctionTrigger
processVideoOnUploadStorage finalize under videos/
onResultUploadedStorage finalize under results/
reconcileStuckJobsEvery 60 minutes
purgeExpiredSessionsEvery 24 hours
generateSessionInsightsCombined-result Storage finalize
syncTierToPlanusers/{uid} write
onFeedbackCreated, onDocsFeedbackCreatedFirestore create