POST /v1/content/:containerId/notify-device
Send a content container's media + caption + posting instructions to a phone via iMessage / SMS.
/v1/content/:containerId/notify-device- 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:
- The container's media (images / video).
- The caption (copy-paste-ready).
- 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:
- Explicit
phoneNumberin the body. E.164 format only (+15551234567). Required for sending to a managed creator's device. - Fallback to the API key owner. If
phoneNumberis omitted, Layers reads thephone_numberof the user who minted the API key. The user must have a verified phone (phone_verified = true); if not, you'll getOWNER_PHONE_UNVERIFIED. 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.
containerIdstringrequiredCompleted content container id (cnt_<UUID>).
Idempotency-Keystring (UUID)optionalSame key + same body replays the cached response. Recommended — accidental retries spam the destination phone.
phoneNumberstring (E.164)optionalDestination 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
{
"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
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing or invalid key. |
| 403 | FORBIDDEN_SCOPE | Key lacks publish:write. |
| 404 | NOT_FOUND | Container not in your organization. |
| 409 | CONFLICT (details.reason: "CONTENT_NOT_READY") | Container status ≠ completed. Wait for generation to finish. |
| 422 | VALIDATION (E.164 regex) | phoneNumber malformed. |
| 422 | VALIDATION (details.reason: "PHONE_REQUIRED") | No phoneNumber and no resolvable API key owner. |
| 422 | VALIDATION (details.reason: "OWNER_PHONE_UNVERIFIED") | Fallback owner has unverified phone. |
| 422 | VALIDATION (details.reason: "NO_MEDIA") | Container has zero media URLs. |
| 502 | PLATFORM_ERROR (details.reason: "PROVIDER_REJECTED") | The SMS provider rejected one or more parts. details.providerError carries the upstream message. |
| 503 | PLATFORM_ERROR (details.reason: "SMS_PROVIDER_UNAVAILABLE") | The SMS provider is not configured for this Layers deployment. Retry later. |
See also
POST /v1/content/:containerId/publish— publish-now via the connected platform (TikTok / Instagram OAuth)POST /v1/content/:containerId/schedule— schedule a future direct publish or platform-native draft (mode: "draft")