GET /v1/projects/:projectId/sdk-apps/:appId/install-spec
Deterministic install snippet per platform — dependency, env vars, init code, files to create.
/v1/projects/:projectId/sdk-apps/:appId/install-spec- Auth
- Bearer
- Scope
- projects:read
Returns the exact dependency line, environment variables, init snippet, and any files your user should create to install the Layers SDK by hand. This is the same information the GitHub ingest flow uses to generate its PR — you can read it to render a "copy-paste install" UI when the user isn't using the Git-based flow.
The spec is deterministic: same SDK app + same requested platforms always produces the same snippet, so you can diff it against what the user has in-repo and detect drift. Platforms the SDK app was created for are returned by default; pass ?platforms= to restrict.
projectIdstringrequiredProject ID.appIdstringrequiredSDK app ID.
platformsstringoptionalComma-separated list of platforms to return specs for. Defaults to all platforms the SDK app was created for.One of:ios,android,web,react-native,flutter,expo
Example request
curl "https://api.layers.com/v1/projects/9cb958b5-11b5-4e30-8675-5d075d52da7c/sdk-apps/app_8ffb9410eb0eb848264f8a65/install-spec?platforms=ios" \
-H "Authorization: Bearer lp_live_01HX9Y6K7EJ4T2_4QZpN..."const spec = await layers.sdkApps.installSpec(
"9cb958b5-11b5-4e30-8675-5d075d52da7c",
"app_8ffb9410eb0eb848264f8a65",
{ platforms: ["ios"] }
);spec = layers.sdk_apps.install_spec(
project_id="9cb958b5-11b5-4e30-8675-5d075d52da7c",
app_id="app_8ffb9410eb0eb848264f8a65",
platforms=["ios"],
)Response
{
"appId": "app_8ffb9410eb0eb848264f8a65",
"platforms": [
{
"platform": "ios",
"dependency": {
"manager": "spm",
"url": "https://github.com/layers-os/layers-sdk-ios",
"from": "1.4.0"
},
"envVars": [
{ "name": "LAYERS_APP_ID", "value": "app_8ffb9410eb0eb848264f8a65" },
{ "name": "LAYERS_INGEST_ENDPOINT", "value": "https://in.layers.com/l/events" }
],
"initSnippet": "import Layers\n\nLayers.configure(\n appId: \"app_8ffb9410eb0eb848264f8a65\",\n endpoint: URL(string: \"https://in.layers.com/l/events\")!\n)"
}
]
}dependency.manager values: spm, cocoapods, gradle, maven, npm, yarn, pnpm, pub, expo. SPM and CocoaPods entries carry url + from; Gradle/npm/Pub/Expo entries carry version. filesToCreate is omitted when no boilerplate files are needed (current iOS, Android, web, react-native, flutter, expo specs).
Errors
| Status | Code | When |
|---|---|---|
| 422 | VALIDATION | :projectId is not a UUID, or unknown platform in platforms. |
| 401 | UNAUTHENTICATED | Missing or invalid key. |
| 403 | FORBIDDEN_SCOPE | Key lacks projects:read. |
| 404 | NOT_FOUND | Project or SDK app does not exist. |
| 429 | RATE_LIMITED | Read budget exhausted. |
See also
POST /v1/projects/:id/ingest/github— automated install via PRPOST /v1/projects/:projectId/sdk-apps— provision an SDK app