Layers
Partner APIAPI referenceSDK apps

GET /v1/projects/:projectId/sdk-apps/:appId/install-spec

Deterministic install snippet per platform — dependency, env vars, init code, files to create.

View as Markdown
GET/v1/projects/:projectId/sdk-apps/:appId/install-spec
Phase 1stable
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.

Path
  • projectId
    stringrequired
    Project ID.
  • appId
    stringrequired
    SDK app ID.
Query
  • platforms
    stringoptional
    Comma-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

200OK
{
  "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

StatusCodeWhen
422VALIDATION:projectId is not a UUID, or unknown platform in platforms.
401UNAUTHENTICATEDMissing or invalid key.
403FORBIDDEN_SCOPEKey lacks projects:read.
404NOT_FOUNDProject or SDK app does not exist.
429RATE_LIMITEDRead budget exhausted.

See also

On this page