LumenClip Docs
LumenClip Docs
LumenClip engineering documentation
Data dictionaryPersistence and physical recordsWorkspace, collections, and assetsTemplate definitionsGeneration runs and outputsPublishing, calendar, and analyticsOperations and accessBackend architectureRailway runtimeBackend endpoints
Data

Backend endpoints

Canonical inventory of the internal Next.js route-handler API under app/api. This is an application API for the LumenClip browser client and workers; it is not a versioned public API.

Inventory verified against the working tree on 2026-08-06: 76 route files.

Global contract

  • proxy.ts initializes Clerk for every application and API request. Private APIs require a Clerk session; documented public APIs remain explicitly allowlisted.
  • Sign-in, sign-up, verification, recovery, and logout are Clerk flows. The app has no custom /api/auth/** endpoints.
  • JSON is the default request/response format. Upload endpoints use multipart/form-data; demo and asset-view endpoints may return bytes.
  • Success responses use named top-level fields such as { automation }, { collections }, or { runs }. There is no universal success envelope.
  • Failures use { error: string } unless a binary endpoint returns a plain Response.
  • withHandler() maps ApiError to its declared status and hides unexpected errors behind a generic 500. Routes not yet using it contain local error mapping.
  • Provider-backed routes may return 502/503 for upstream or missing-provider failures. Generation calls can be slow and are not uniformly job-backed yet.
  • IDs in a dynamic path are URL encoded. Date/time inputs are ISO 8601 unless a route explicitly says otherwise.

Legend:

  • Current — used by a current UI or worker flow.
  • Internal — operational/debug surface; not a normal product API.
  • Legacy — retained compatibility path with a newer canonical replacement.
  • Broken — route exists but cannot currently compile or execute as written.

Documentation search

Method and pathInputResponse / behaviorState
GET /api/searchQuery queryPublic read-only Orama index generated from docs/**/*Current

Automations and templates

Method and pathInputResponse / behaviorState
GET /api/automation-templatesNoneTemplate records, summaries, example runs, and schema mapCurrent
POST /api/automation-templatesJSON array or { templates } / { automations } containing ReelFarm-shaped exportsImports normalized templates; 201Current
GET /api/automationsNone{ records, automations }Current
POST /api/automationsJSON { name?, automationKind?, schema?, template?, overrides? }Creates a local automation; raw imports are rejected; 201Current
PATCH /api/automationsJSON { id, name?, status?, favorite?, schema? }{ record, automation }; 409 when a published hook is removed or renamedCurrent
DELETE /api/automations/[id]Path IDCascades through runs, slideshow results, and local publication recordsCurrent
POST /api/automations/hooksJSON { automationId }Generates and persists a fresh hook set; rejects missing/exhausted inputsCurrent
POST /api/automations/video-copyJSON { automationId, template?, hook?, items?, segmentRoles? }Generated/fallback title, caption, hashtags, substitutions, and per-item textCurrent
POST /api/automations/runJSON { automationId, force: true, now?, requestId? }Runs one interactive generation and returns created/results/skippedCurrent
GET /api/automations/runsQuery automationId?, limit?Unified run views, including generated-video-backed runsCurrent
GET /api/automations/[id]/hook-analyticsPath automation IDPublished hook lock state and aggregated metric rowsCurrent

An interactive /automations/run call is the manual generation path. Scheduled execution is driven by the scheduler/worker and is not exposed as a browser endpoint.

Slideshows, results, and generated videos

Method and pathInputResponse / behaviorState
GET /api/slideshowsQuery id?, limit?{ slideshows, slideshowsCount, videosCount } derived from result outputsCurrent
POST /api/slideshowsCreateSlideshowInput JSONCreates a slideshow-compatible ResultRecord; 201 { slideshow, result }Current
GET /api/slideshows/[id]Path slideshow IDImages available from the automation's configured collectionsCurrent
PATCH /api/slideshows/[id]Action JSON: removeSlide, replaceImage, updateMetadata, or markPublishedUpdated slideshow/run; blocks edits to scheduled/published contentCurrent
DELETE /api/slideshows/[id]Path slideshow IDDeletes eligible result/run/publication records; blocks scheduled/published contentCurrent
GET /api/public/slideshows/[id]/download?token=…Signed output-scoped tokenLogin-free ZIP download of every rendered slide; 404 invalid token, 409 emptyCurrent
GET /api/resultsQuery id?, automationId?, runId?, limit?{ results, resultsCount }Current
GET /api/generated-videosQuery type?, automationId?, limit?{ exports } plus deletion-block reasonCurrent
POST /api/generated-videosJSON generated-video create payloadCreates queued/ready export; 201Current
PATCH /api/generated-videosJSON { id, status, previewUrl?, videoUrl?, error? }Updates processing stateCurrent
PATCH /api/generated-videos/[id]JSON { action: "markPublished" }Records manual publication timeCurrent
DELETE /api/generated-videos/[id]Path IDDeletes unless scheduled or publishedCurrent

Collections and reusable assets

Method and pathInputResponse / behaviorState
GET /api/image-collectionsNone{ collections }Current
POST /api/image-collectionsStoredImageCollection JSONUpserts by normalized collection name; 201Current
POST /api/image-collections/delete-previewJSON { collections: [{ name, created_at }] }Counts media and lists dependent automations/templatesCurrent
DELETE /api/image-collectionsJSON { collections: [{ name, created_at }] }Soft-deletes for 30 days; unreferenced files purge after expiryCurrent
POST /api/image-collections/importJSON { collectionName?, collectionCreatedAt?, mediaType?, images[] }Downloads, hashes, deduplicates, and adds up to 80 items; 201Current
POST /api/image-collections/captionsCollection JSON plus optional image_indexCaptions one/all images through OpenRouter and saves collectionCurrent
POST /api/image-collections/image-actionsJSON { mode, imageUrl, prompt?, upscaleFactor? }; mode is edit or upscaleKIE edit/upscale resultCurrent
GET /api/product-collectionsNone{ collections }Current, read-only
GET /api/word-collectionsNone{ collections }Current
POST /api/word-collectionsJSON { id?, name, description?, words?, source? }Upserts variable collection; 201Current
DELETE /api/word-collections/[id]Path ID{ collection }Current
GET /api/assetsQuery scope?, category?, kind?{ assets }Current
POST /api/assets/uploadMultipart file, optional scope, category, namePersists asset metadata/file; 201Current
POST /api/assets/captionJSON { id, caption }Updates asset captionCurrent
GET /api/media-libraryNoneRuntime media-library assets from loadRealFarmData()Current
POST /api/local-assets/uploadMultipart MP3/WAV fileStores audio and registers a media-library entryCurrent
GET /api/local-assets/[...assetPath]Asset path; optional HTTP Range headerStreams deterministic Railway Storage objectCurrent

The former /api/assets/reference-import and /api/characters/** families were removed with the character/UGC workspace. They are intentionally absent from the current inventory.

Discovery and media proxying

Method and pathInputResponse / behaviorState
GET /api/pexels/searchQuery query, limit? (max 80)Pexels results or deterministic fallback resultsCurrent
POST /api/pexels/searchJSON { query } (or first array item), query limit?Same as GETCurrent
GET /api/pinterest/searchQuery query, limit? (max 100)Pinterest import resultsCurrent
POST /api/pinterest/searchJSON { query, mode? } (or first array item), query limit?Pinterest import resultsCurrent
GET /api/image-proxyQuery urlSSRF-guarded image bytes; supported image MIME only, redirect and size capsCurrent

Calendar and analytics

Method and pathInputResponse / behaviorState
GET /api/calendarQuery from?, to?, repeated/comma filters: accounts, platforms, statuses, automations, sourceTypeMerged projections, jobs, local publications, and PostFast posts plus summaryCurrent
PATCH /api/calendar/items/[id]Local post ID and { scheduledAt } future ISO timestampRecreates the remote schedule from the stored publication snapshotCurrent
DELETE /api/calendar/items/[id]Local post ID or postfast:<remoteId>Cancels scheduled PostFast post and deletes local publication recordCurrent
GET /api/calendar/summaryNone{ summary: { needsAction, failed } } for sidebar pollingCurrent
GET /api/analytics/reportQuery days? (1–365), comma-separated integrationIds?Integrations, metric snapshots, follower snapshots, capability mapCurrent
POST /api/analytics/reportJSON { integrationIds?: string[], days? }Triggers analytics synchronization for selected/all accountsCurrent
GET /api/tiktok-studio-analyticsQuery importId or batchIdPolls an owner-scoped Studio capture or account-wide batchCurrent
POST /api/tiktok-studio-analyticsstart, linked-post batch input, or start_discovered_batch with one connected account and companion-discovered Studio postsCreates missing publications, queues private analytics capture, and returns a device connection payloadCurrent
GET /api/tiktok-studio-analytics/captureBearer device credentialReturns the newest pending, explicitly allowlisted capture manifestCurrent
`OPTIONSPOST /api/tiktok-studio-analytics/capture`Bearer device credential plus { captureId, studioUrl, payload }; maximum 2.5 MBChrome-companion CORS intake; job allowlist, URL, and returned ID must match

PostFast accounts and publishing

Method and pathInputResponse / behaviorState
GET /api/postfast/connect-urlQuery expiryDays? (1–30){ url } for PostFast account connectionCurrent
GET /api/postfast/integrationsNoneActive and locally disconnected integrations; tokens omittedCurrent
DELETE /api/postfast/integrationsJSON { integrationId }Locally disconnects account and removes it from automationsCurrent
POST /api/postfast/integrationsJSON { integrationId }Restores a locally disconnected accountCurrent
GET /api/postfast/postsQuery startDate?, endDate?, page?, limit?Enriched PostFast posts; returns configured:false when key is absentCurrent
POST /api/postfast/postsJSON { sourceType, sourceId, integrationId, provider, content, media?, type?, date?, releaseUrl?, settings? }Creates draft/schedule/now post, manual reminder, or manual-published evidenceCurrent
POST /api/postfast/uploadMultipart file or JSON { url }Uploads image/video to PostFast signed storage; returns { upload }Current

type for post creation is draft | schedule | now | manual | manual_posted. Manual and manual-posted records are stored as output publications without calling PostFast's create-post endpoint.

X and Threads automation

Method and pathInputResponse / behaviorState
GET /api/x-automationsNone{ automations }Current
POST /api/x-automationsJSON { name?, platform? }; platform is x or threadsCreates automation; 201Current
PATCH /api/x-automationsFull automation or { automation }Normalizes and upserts automationCurrent
DELETE /api/x-automations/[id]Path ID{ deleted }Current
POST /api/x-automations/[id]/derive-briefPath IDDerives niche strategy and persists itCurrent
POST /api/x-automations/discoverJSON { automationId, query?, source? }Trend candidates from configured discovery sourceCurrent
GET /api/x-automations/generateQuery automationId?{ runs }Current
POST /api/x-automations/generateJSON { automationId, topic?, sourceCandidate? }Generates and persists a draft run; 201Current
DELETE /api/x-automations/generateQuery automationIdDeletes runs and resets recent-use memoryCurrent
POST /api/x-automations/imageJSON { runId, prompt?, aspectRatio? }Generates a KIE image, persists it in Storage, and attaches it to the run; 201Current
POST /api/x-automations/publishJSON { runId }Publishes through configured integration(s) and updates run statusCurrent

Settings and team data

Method and pathInputResponse / behaviorState
GET /api/settings/demosNone{ demos } for current ownerCurrent
POST /api/settings/demosMultipart video file, optional title; max 250 MBStores demo and metadata; 201Current
GET /api/settings/demos/[id]Path IDPrivate video bytes for ownerCurrent
GET /api/settings/teamNone{ members } for current workspace ownerCurrent
POST /api/settings/teamJSON { email }Sends invitation and creates membership record; 201Current
POST /api/settings/team/acceptJSON { teamId, membershipId, userId, secret }Accepts Railway team invitationCurrent

Backend-only and development endpoints

Method and pathInputResponse / behaviorState
POST /api/linkedin-automations/generateJSON containing niche plus optional brief/persona/plan/model/count inputsStateless LinkedIn generation; no persistence or schedulerInternal preview
POST /api/debug/automation-previewAutomation/schema JSON plus optional now, textModelProduces an automation plan without saving a runInternal; environment-gated, NOT authenticated
POST /api/debug/dumpJSON { name, data }Writes JSON to OS temp directory and returns local pathInternal; environment-gated, NOT authenticated
GET /api/temp/testing-center/modelsNoneCached OpenRouter structured-output model listInternal testing center
POST /api/temp/testing-center/generateJSON { automationId, model, systemPrompt?, promptInstructions? }Runs template text generation and returns plan/debug resultInternal testing center

Development routes should not be treated as stable integrations. Before public deployment, the two /api/debug/** handlers should be explicitly disabled in production or restricted to an administrative capability.

Maintaining this inventory

When adding, changing, or deleting a route:

  1. Update this file in the same change.
  2. Update Data structures if request handling creates a new persistent shape or changes lifecycle semantics.
  3. Update backend-architecture.md if a physical table, source_key, bucket, worker, or provider boundary changes.
  4. Update the relevant docs/tabs/** file when the browser workflow changes.
  5. Put unshipped endpoint designs in docs/roadmap/**; do not describe them here as current behavior.

Railway runtime

Previous Page

UI field guide

Current CFarm destinations, interaction states, and shared interface rules.

On this page

Global contractDocumentation searchAutomations and templatesSlideshows, results, and generated videosCollections and reusable assetsDiscovery and media proxyingCalendar and analyticsPostFast accounts and publishingX and Threads automationSettings and team dataBackend-only and development endpointsMaintaining this inventory