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,nextjs,vite,react-router
Example request
curl "https://api.layers.com/v1/projects/prj_9cb958b5-11b5-4e30-8675-5d075d52da7c/sdk-apps/app_8ffb9410eb0eb848264f8a65/install-spec?platforms=ios" \
-H "Authorization: Bearer lp_..."const spec = await layers.sdkApps.installSpec(
"9cb958b5-11b5-4e30-8675-5d075d52da7c",
"app_8ffb9410eb0eb848264f8a65",
{ platforms: ["ios"] }
);spec = layers.sdk_apps.install_spec(
project_id="prj_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. For framework-targeted specs (nextjs, vite, react-router) the response also carries filesToCreate — boilerplate files such as app/layers-provider.tsx (Next.js App Router), vite.config.ts patches, or <LayersProvider> wrapper for React Router data routers. See the platform-specific SDK guides (Next.js, Vite, React Router) for the full snippet shape per framework.
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/:projectId/sdk-apps- provision an SDK app
PATCH /v1/projects/:projectId/sdk-apps/:appId
Update SDK-app config, enable CAPI for a platform, or rotate the API key.
POST /v1/projects/:projectId/sdk-apps/:appId/verify-tracking
Active probe — sends a synthetic test event tagged `test_event_code`; returns whether tracking is healthy and which platforms would forward it.