Docs / built-apps / getAppSource

getAppSource

utilitysince 0.2.7not for built apps

Client function: fetch a version's source files as a { path: content } map (live version by default).

import { getAppSource } from 'flowstack-sdk'

Non-React client function. Returns the source tree for a site version. Omit version for the live version. GET /api/v1/sites/{siteId}/source?version={n}.

Signature

getAppSource(credentials, siteId, version?, config?): Promise<ApiResponse<AppSource>>

Parameters

ParamTypeNotesDescription
credentialsFlowstackCredentialsrequiredThe app owner's credentials (owner-scoped JWT).
siteIdstringrequiredThe site/app id to operate on.
versionnumberSpecific version to fetch. Defaults to the live version.
configFlowstackClientConfigsince 0.2.7Client config (baseUrl, appScope, tenantId as needed).

Returns

FieldTypeDescription
Promise<ApiResponse<AppSource>>AppSource: { site_id, version, files: Record<string, string> } (version is null for legacy unversioned sites).

Examples

Read the live source
const res = await getAppSource(credentials, siteId, undefined, { appScope });
if (res.ok) for (const [p, content] of Object.entries(res.data.files)) console.log(p, content.length);
WarningOwner/management operation — call it with the app owner's credentials from a builder/dashboard/server context, not from inside the generated app's end-user runtime. builtAppSafe is false.

See also

stageFiles · useSiteVersions

Source: src/api/client.ts (Site Ops, P0-156) · Also available in llms-full.txt and registry.json.