Layers

POST /v1/content/:containerId/notify-device

Send a content container's media + caption + posting instructions to a phone via iMessage / SMS.

View as Markdown
POST/v1/content/:containerId/notify-device
Phase 1stableidempotent
Auth
Bearer
Scope
publish:write

Mirror of the Layers UI's "Text me this post" / Elle SMS device handoff. Sends three messages over iMessage / SMS to a target phone:

  1. The container's media (images / video).
  2. The caption (copy-paste-ready).
  3. Friendly posting instructions generated by Elle (the Layers AI agent).

Use this when a creator needs the assets on their phone so they can publish manually inside the native TikTok / Instagram app — typical when the creator hasn't connected their account via OAuth or wants final visual review before posting.

This is a content delivery path, not a scheduling path. There is no scheduled_posts row and no future scheduledFor field. Messages are dispatched immediately. To push a draft into the platform-native inbox (TikTok inbox / Instagram SMS draft) at a future time, use mode: "draft" on /schedule instead.

Phone-number resolution

Partner API keys are organization-scoped — there is no end-user session. The destination phone is resolved in this order:

  1. Explicit phoneNumber in the body. E.164 format only (+15551234567). Required for sending to a managed creator's device.
  2. Fallback to the API key owner. If phoneNumber is omitted, Layers reads the phone_number of the user who minted the API key. The user must have a verified phone (phone_verified = true); if not, you'll get OWNER_PHONE_UNVERIFIED.
  3. PHONE_REQUIRED — if neither resolves.

The fallback exists for the common case where a partner is sending content to themselves to QA. For production creator-handoff flows, always pass phoneNumber explicitly.

Path
  • containerId
    stringrequired
    Completed content container id (cnt_<UUID>).
Headers
  • Idempotency-Key
    string (UUID)optional
    Same key + same body replays the cached response. Recommended — accidental retries spam the destination phone.
Body
  • phoneNumber
    string (E.164)optional
    Destination phone number, e.g. `+15551234567`. Optional — falls back to API key owner. 422 VALIDATION if malformed.

Example request

curl https://api.layers.com/v1/content/cnt_8f1d6c3e-4b2a-4a18-9e4f-c2d7a1b0e999/notify-device \
  -H "Authorization: Bearer lp_..." \
  -H "Idempotency-Key: 4f2a1b8c-7d3e-4c5a-9b6f-1e2d3c4b5a67" \
  -H "Content-Type: application/json" \
  -d '{ "phoneNumber": "+15551234567" }'
const result = await layers.publishing.notifyDevice({
  containerId: "cnt_8f1d6c3e-4b2a-4a18-9e4f-c2d7a1b0e999",
  phoneNumber: "+15551234567",
});
result = layers.publishing.notify_device(
    container_id="cnt_8f1d6c3e-4b2a-4a18-9e4f-c2d7a1b0e999",
    phone_number="+15551234567",
)

Response

200Sent
{
  "containerId": "cnt_8f1d6c3e-4b2a-4a18-9e4f-c2d7a1b0e999",
  "deliveryStatus": "sent",
  "phoneNumberLast4": "4567",
  "providerChatId": "linq_chat_5f3a...",
  "mediaCount": 2
}

phoneNumberLast4 is the last 4 digits of the destination phone in E.164 trailing form — included so partner UIs can render "sent to ****4567" without round-tripping the full number.

providerChatId is the Linq chat id for the conversation. It's stable across resends to the same phone, so subsequent calls land in the same iMessage thread.

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing or invalid key.
403FORBIDDEN_SCOPEKey lacks publish:write.
404NOT_FOUNDContainer not in your organization.
409CONFLICT (details.reason: "CONTENT_NOT_READY")Container statuscompleted. Wait for generation to finish.
422VALIDATION (E.164 regex)phoneNumber malformed.
422VALIDATION (details.reason: "PHONE_REQUIRED")No phoneNumber and no resolvable API key owner.
422VALIDATION (details.reason: "OWNER_PHONE_UNVERIFIED")Fallback owner has unverified phone.
422VALIDATION (details.reason: "NO_MEDIA")Container has zero media URLs.
502PLATFORM_ERROR (details.reason: "PROVIDER_REJECTED")The SMS provider rejected one or more parts. details.providerError carries the upstream message.
503PLATFORM_ERROR (details.reason: "SMS_PROVIDER_UNAVAILABLE")The SMS provider is not configured for this Layers deployment. Retry later.

See also

On this page