youfoundron API

Version 0.1.0 · OpenAPI 3.1.0 · openapi.json · https://api.youfoundron.com

The personal-website API: the blog's public feed and slug resolution, the editor's post and revision lifecycle — on the public blog realm and the operator's private journal alike — the tag index each realm filters by, the vendor consent flows this server custodies, and the scheduler's run history.

Authentication

session Set by POST /auth/session against a mailed code. httpOnly, so nothing but the browser ever holds it.

Published

The blog's public read surface.

GET/blog/publishedList published postsopen

Parameters

NameInTypeDescription
includequery{"type":"string","enum":["html"]}Pass html to include each post's rendered body.
limitquery{"type":"integer","minimum":1}Return at most this many posts.

Responses

StatusDescription
200{ posts: PublishedPostView[] }
400limit is not a positive integer.
GET/blog/published/{slug}Resolve a public slugopen

The whole public lookup in one round trip: the rendered post when the slug is current, the canonical slug to redirect to when it was retired, or gone when the post was archived.

Parameters

NameInTypeDescription
slug requiredpath{"type":"string"}Public slug (lowercase letters, digits, hyphens).

Responses

StatusDescription
200SlugResolution
404No post answers to this slug.
GET/blog/siteThe whole public site, for the static generatoropen

Every read the blog's build needs in one round trip: the index and tag lists, the feed entries, the full detail views, the retired slugs that redirect, and the archived slugs that are gone. Public for the same reason the pages it builds are — this is the site itself, a request ahead of publication.

Parameters

NameInTypeDescription
feedLimitquery{"type":"integer","minimum":1}Cap feedViews at this many entries. How long a feed runs is the consumer's policy; uncapped when omitted.

Responses

StatusDescription
200SiteSnapshot
400feedLimit is not a positive integer.

Auth

Passwordless sign-in: a one-time code by email, traded for a session cookie. Non-2xx responses are AuthApiError ({ error, code? }).

POST/auth/codeMail a sign-in codeopen

Sends a 6-digit code that expires in 10 minutes and signs in once. Answers 202 whether or not the address has an account: which addresses exist, and how recently one asked, are not facts this endpoint hands out.

Request body

application/json required

{
  "type": "object",
  "required": [
    "email"
  ],
  "properties": {
    "email": {
      "type": "string",
      "format": "email"
    }
  }
}

Responses

StatusDescription
202{ sent: true } — see above; this is not a delivery receipt.
400code: "invalid-email" — the field was not an address at all.
GET/auth/sessionWho the cookie belongs torequires session

How the admin app decides between its screens and its sign-in form.

Responses

StatusDescription
200SessionResponse
401code: "unauthorized" — no cookie, or it no longer resolves.
POST/auth/sessionSign in with a codeopen

Trades a mailed code for a session cookie: httpOnly, SameSite=Lax, absolute expiry, revocable server-side. The code is spent either way — a wrong guess costs an attempt against every code the address is holding.

Request body

application/json required

{
  "type": "object",
  "required": [
    "email",
    "code"
  ],
  "properties": {
    "email": {
      "type": "string",
      "format": "email"
    },
    "code": {
      "type": "string",
      "description": "6 digits."
    }
  }
}

Responses

StatusDescription
200SessionResponse, plus the session cookie.
400Body is not JSON, or email/code are missing.
401code: "invalid-code" — wrong, expired, spent, or out of attempts. Which one is deliberately not said.
DELETE/auth/sessionSign outrequires session

Deletes the session row and clears the cookie. Idempotent — signing out without a session is a 204 too.

Responses

StatusDescription
204Signed out; no body.

Posts

The blog editor's post lifecycle — every route an admin session. Non-2xx responses are BlogApiError ({ error, code?, version? }); code marks the failures a client can branch on.

GET/blog/tagsList this realm's tagsrequires session

Every tag attached to at least one of this realm's posts, most-used first — drafts included, since tags mirror the current draft. Tags used only in the other realm do not appear.

Parameters

NameInTypeDescription
qquery{"type":"string"}Narrow to tags whose name starts with this prefix.

Responses

StatusDescription
200{ tags: TagView[] }
GET/blog/postsList all postsrequires session

Drafts, published, and archived alike — the admin index.

Parameters

NameInTypeDescription
tagquery{"type":"string"}Only posts whose draft carries this tag.

Responses

StatusDescription
200{ posts: AdminPostView[] }
POST/blog/postsCreate a postrequires session

Starts as an untitled scaffold draft.

Responses

StatusDescription
201{ post: EditorPostView }
GET/blog/posts/{id}Fetch a post for editingrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post.
DELETE/blog/posts/{id}Delete a post permanentlyrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
204Deleted; no body.
404No such post.
PUT/blog/posts/{id}/contentAutosave draft contentrequires session

Optimistic concurrency: baseVersion is the version the edit was based on; a mismatch means the post changed elsewhere and comes back as a 409 carrying the version the server holds.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Request body

application/json required

{
  "type": "object",
  "required": [
    "content",
    "baseVersion"
  ],
  "properties": {
    "content": {
      "type": "string",
      "description": "Full draft source."
    },
    "baseVersion": {
      "type": "integer"
    }
  }
}

Responses

StatusDescription
200SaveDraftResponse
400Body is not JSON, or content/baseVersion are missing.
404No such post.
409code: "conflict" — version is what the server holds.
GET/blog/posts/{id}/previewPreview the draftrequires session

The draft rendered exactly as it would publish.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ preview: DraftPreview }
404No such post.
PUT/blog/posts/{id}/slugChange a post's slugrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Request body

application/json required

{
  "type": "object",
  "required": [
    "slug"
  ],
  "properties": {
    "slug": {
      "type": "string",
      "description": "Lowercase letters, digits, single hyphens (max 80 chars)."
    }
  }
}

Responses

StatusDescription
200{ post: EditorPostView }
400code: "invalid-slug" | "reserved-slug".
404No such post.
409code: "slug-taken" — another post uses or redirects from it.
POST/blog/posts/{id}/publishPublish the draftrequires session

Requires a title: "title:" frontmatter or a leading "# heading" in the draft.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
400code: "title-required".
404No such post.
POST/blog/posts/{id}/unpublishUnpublish a postrequires session

Back to a draft; its public page disappears.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post.
POST/blog/posts/{id}/archiveArchive a postrequires session

Deliberate removal: the public slug starts answering gone.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post.
POST/blog/posts/{id}/unarchiveUnarchive a postrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post.

Revisions

Autosave and publish snapshots of a blog post's content. Admin session, as above.

GET/blog/posts/{id}/revisionsList a post's revisionsrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ revisions: RevisionSummaryView[] }
404No such post.
GET/blog/posts/{id}/revisions/{revisionId}Fetch one revisionrequires session

The summary plus the revision's full content.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.
revisionId requiredpath{"type":"string"}Revision id, as listed by GET /blog/posts/{id}/revisions.

Responses

StatusDescription
200{ revision: RevisionView }
404No such post or revision.
POST/blog/posts/{id}/revisions/{revisionId}/restoreRestore a revisionrequires session

Makes the revision's content the current draft.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.
revisionId requiredpath{"type":"string"}Revision id, as listed by GET /blog/posts/{id}/revisions.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post or revision.

Journal

The journal's entries — the same lifecycle as Posts on the operator's private realm, where publishing reads as logging. No public surface exists: every route, reads included, requires the admin session. The one way out is promotion: an entry copied onto the blog as a draft, which by itself publishes nothing.

GET/journal/tagsList this realm's tagsrequires session

Every tag attached to at least one of this realm's posts, most-used first — drafts included, since tags mirror the current draft. Tags used only in the other realm do not appear.

Parameters

NameInTypeDescription
qquery{"type":"string"}Narrow to tags whose name starts with this prefix.

Responses

StatusDescription
200{ tags: TagView[] }
GET/journal/postsList all postsrequires session

Drafts, published, and archived alike — the admin index.

Parameters

NameInTypeDescription
tagquery{"type":"string"}Only posts whose draft carries this tag.

Responses

StatusDescription
200{ posts: AdminPostView[] }
POST/journal/postsCreate a postrequires session

Starts as an untitled scaffold draft.

Responses

StatusDescription
201{ post: EditorPostView }
GET/journal/posts/{id}Fetch a post for editingrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post.
DELETE/journal/posts/{id}Delete a post permanentlyrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
204Deleted; no body.
404No such post.
PUT/journal/posts/{id}/contentAutosave draft contentrequires session

Optimistic concurrency: baseVersion is the version the edit was based on; a mismatch means the post changed elsewhere and comes back as a 409 carrying the version the server holds.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Request body

application/json required

{
  "type": "object",
  "required": [
    "content",
    "baseVersion"
  ],
  "properties": {
    "content": {
      "type": "string",
      "description": "Full draft source."
    },
    "baseVersion": {
      "type": "integer"
    }
  }
}

Responses

StatusDescription
200SaveDraftResponse
400Body is not JSON, or content/baseVersion are missing.
404No such post.
409code: "conflict" — version is what the server holds.
GET/journal/posts/{id}/previewPreview the draftrequires session

The draft rendered exactly as it would publish.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ preview: DraftPreview }
404No such post.
PUT/journal/posts/{id}/slugChange a post's slugrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Request body

application/json required

{
  "type": "object",
  "required": [
    "slug"
  ],
  "properties": {
    "slug": {
      "type": "string",
      "description": "Lowercase letters, digits, single hyphens (max 80 chars)."
    }
  }
}

Responses

StatusDescription
200{ post: EditorPostView }
400code: "invalid-slug" | "reserved-slug".
404No such post.
409code: "slug-taken" — another post uses or redirects from it.
POST/journal/posts/{id}/publishPublish the draftrequires session

Requires a title: "title:" frontmatter or a leading "# heading" in the draft.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
400code: "title-required".
404No such post.
POST/journal/posts/{id}/unpublishUnpublish a postrequires session

Back to a draft; its public page disappears.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post.
POST/journal/posts/{id}/archiveArchive a postrequires session

Deliberate removal: the public slug starts answering gone.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post.
POST/journal/posts/{id}/unarchiveUnarchive a postrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post.
POST/journal/posts/{id}/promotePromote a post into the blogrequires session

Copies this post's working draft into the blog realm as a new draft — body, title, and tags exactly as its frontmatter yields them. A copy and not a move: this post is untouched, the copy is its own post from here on, and nothing is published on either side. Promoting a second time makes a second copy, which is why the copies a post already has ride along on EditorPostView.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
201{ copy: PromotedCopyView } — the draft just created.
404No such post.

Journal revisions

Autosave and log snapshots of a journal entry's content. Admin session, as above.

GET/journal/posts/{id}/revisionsList a post's revisionsrequires session

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.

Responses

StatusDescription
200{ revisions: RevisionSummaryView[] }
404No such post.
GET/journal/posts/{id}/revisions/{revisionId}Fetch one revisionrequires session

The summary plus the revision's full content.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.
revisionId requiredpath{"type":"string"}Revision id, as listed by GET /journal/posts/{id}/revisions.

Responses

StatusDescription
200{ revision: RevisionView }
404No such post or revision.
POST/journal/posts/{id}/revisions/{revisionId}/restoreRestore a revisionrequires session

Makes the revision's content the current draft.

Parameters

NameInTypeDescription
id requiredpath{"type":"string"}Post id.
revisionId requiredpath{"type":"string"}Revision id, as listed by GET /journal/posts/{id}/revisions.

Responses

StatusDescription
200{ post: EditorPostView }
404No such post or revision.

Oura

The youfoundron_oura application's public half: the operator's consent flow (connect → Oura → redirect), the chain's status, the registration's legal texts, and the webhook receiver that keeps the local sleep store current. This server is the token custodian — tokens live in its database and never in a response, and no endpoint returns or force-refreshes them. The worker-facing sleep feed answers from the local store on the private-network listener, outside this spec.

GET/oura/connectStart (re)consentrequires session

Mints a single-use state and bounces the operator's browser to Oura's consent screen. The bootstrap, and the recovery path whenever the refresh chain breaks (status: reconnect_required).

Responses

StatusDescription
302Redirect to Oura's authorize URL.
GET/oura/redirectOAuth2 redirect endpointopen

Where the Oura consent screen sends the browser back. Validates the single-use state, exchanges the code server-side, and stores the tokens — then hands the browser to the admin app's connect screen with a bare outcome name and expiry in the URL fragment, never token material of any kind.

Parameters

NameInTypeDescription
codequery{"type":"string"}Authorization code — consumed here, shown nowhere.
statequery{"type":"string"}Must match a stored, unexpired, unused state.
errorquery{"type":"string"}OAuth2 error code, when consent was denied or failed.
error_descriptionquery{"type":"string"}Human-readable detail accompanying error.

Responses

StatusDescription
302Redirect to the admin's connect outcome screen, every outcome.
GET/oura/webhookWebhook callback verificationopen

Answers Oura's one-time subscription check: when the verification_token matches the configured one, the challenge is echoed back. Absent configuration, the path answers 404 — the receiver does not exist. Dialed by Oura, never by a browser.

Responses

StatusDescription
200{ challenge }, echoed.
POST/oura/webhookWebhook event deliveryopen

Where Oura posts event notifications, HMAC-signed with the application's client secret over timestamp + body. The delivery is acknowledged immediately and treated as a hint: ingestion re-fetches the named document with this server's own token and upserts (or, on a confirmed 404, deletes) the stored copy — then asks for a readme republish when something actually changed. Absent configuration, the path answers 404.

Responses

StatusDescription
200Acknowledged; ingestion proceeds asynchronously.
GET/oura/statusChain and store healthrequires session

Connection status, access-token expiry, last update, the store's size and newest day, and the worker routes' last audit entries. No token material — there is no endpoint that returns or force-refreshes tokens, by design.

Responses

StatusDescription
200{ status, accessExpiresAt, updatedAt, lastAuditAt, lastAuditOutcome, storeDocuments, storeLatestDay, lastSyncAt, lastSyncOutcome, lastWebhookAt, lastWebhookOutcome }
GET/oura/privacy.txtPrivacy policyopen

The registration's privacy policy, as plain text.

Responses

StatusDescription
200Plain text.
GET/oura/toc.txtTerms of serviceopen

The registration's terms of service, as plain text.

Responses

StatusDescription
200Plain text.

Strava

The Strava application's public half, on the same custody terms as Oura above: the operator's consent flow (connect → Strava → redirect), the chain's status, and the webhook receiver that keeps the local activity store current — tokens in the database and never in a response. Consent asks for activity:read_all and a grant that comes back without it is refused outright. The worker-facing activities feed answers from the local store on the private-network listener, outside this spec.

GET/strava/connectStart (re)consentrequires session

Mints a single-use state and bounces the operator's browser to Strava's consent screen, asking for activity:read_all. The bootstrap, and the recovery path whenever the refresh chain breaks (status: reconnect_required) or the grant came back short of the scope.

Responses

StatusDescription
302Redirect to Strava's authorize URL.
GET/strava/redirectOAuth2 redirect endpointopen

Where the Strava consent screen sends the browser back. Validates the single-use state, checks the granted scope, exchanges the code server-side, and stores the tokens — then hands the browser to the admin app's connect screen with a bare outcome name and expiry in the URL fragment, never token material of any kind. A grant without activity:read_all is refused and nothing is stored.

Parameters

NameInTypeDescription
codequery{"type":"string"}Authorization code — consumed here, shown nowhere.
statequery{"type":"string"}Must match a stored, unexpired, unused state.
scopequery{"type":"string"}Comma-separated scopes the athlete actually granted. Must include activity:read_all or the run is refused.
errorquery{"type":"string"}OAuth2 error code, when consent was denied or failed.

Responses

StatusDescription
302Redirect to the admin's connect outcome screen, every outcome.
GET/strava/webhookWebhook callback validationopen

Answers Strava's one-time subscription check: when hub.mode is subscribe and hub.verify_token matches the configured one, hub.challenge is echoed back within Strava's two-second deadline. Absent configuration, the path answers 404 — the receiver does not exist. Dialed by Strava, never by a browser.

Responses

StatusDescription
200{ "hub.challenge" }, echoed.
POST/strava/webhookWebhook event deliveryopen

Where Strava posts event notifications. The delivery is acknowledged immediately (Strava's two-second deadline) and treated as a hint: it must name the registered subscription, and ingestion re-fetches the named activity with this server's own token and upserts (or, on a confirmed 404, deletes) the stored copy — then asks for a readme republish when something actually changed. An athlete event with authorized: "false" marks the chain reconnect_required. Absent configuration, the path answers 404.

Responses

StatusDescription
200Acknowledged; ingestion proceeds asynchronously.
GET/strava/statusChain and store healthrequires session

Connection status, the granted scope, access-token expiry, last update, the store's size and newest start instant, and the worker routes' last audit entries. No token material — there is no endpoint that returns or force-refreshes tokens, by design.

Responses

StatusDescription
200{ status, scope, accessExpiresAt, updatedAt, lastAuditAt, lastAuditOutcome, storeActivities, storeLatestStartDate, lastSyncAt, lastSyncOutcome, lastWebhookAt, lastWebhookOutcome }

Cron

The scheduler's calendar and run history — the admin's cron section reads through here. The api stores none of it: the cron app's own sqlite is the record, proxied read-only over the private network.

GET/cron/summaryThe scheduler's calendar and run historyrequires session

Schedules and their recorded runs — status, exit code, timestamps, and each run's own stdout/stderr — read live from the scheduler's store. The api holds none of it; a missing or unreachable scheduler is a 503, which local environments always are.

Responses

StatusDescription
200{ schedules: CronSchedule[], jobs: CronJob[] }
503{ error: "scheduler_unreachable" } — no scheduler to read.

Meta

Service plumbing.

GET/healthHealth checkopen

Responses

StatusDescription
200{ status: "ok" }