Codes on first orders

Updated API

Update 2026-10-21: From 2026-10-03, connecting your application is the person's agreement, so the first-order code applies only to people who connected before then. See Connecting is agreeing. There is no per-person code setting. On build_only, a person who has not verified answers verify_required, and a person you provisioned gets no url on card_required: mint a card link. See Every error code.

What changed

  • With a build grant, a person's first live order through your application needs the code Layout texts them. That code is their agreement to let your application order for them. After it, the confirm asks for a code exactly when ordering anywhere else in Layout would. See When a code is due.
  • codeRequired on a build grant's cart follows the same rule. resend-code on a cart that needs no code answers 409 code_not_needed and texts nothing.
  • A 403 build_only confirm now carries error.next: step is sign_up_required, connect_required, link_expired, phone_required or card_required, and url, when present, is the Layout page where the person finishes it. The MCP confirm result carries the same next.
403 {
  "error": {
    "code": "build_only",
    "message": "This person has not finished joining Layout, so the cart cannot be confirmed yet. They need to sign up to Layout with this number and add a card, then you confirm again. Nothing was charged.",
    "orderId": "ord_7c21e4b9a0d3",
    "next": { "step": "sign_up_required", "url": "https://account.layout.link/join" }
  }
}

Why it matters

A second small order no longer needs a text, the same as in the Layout app. And your code can tell the person what to do next without reading the message.

What to do

Call confirm with no code first, and handle code_required on every confirm: the confirm decides. On build_only, switch on error.next.step, and send the person error.next.url when there is one. See Confirming with a build grant.

Breaking changes

None for a confirm that already handles code_required and 202 placing. On MCP, a grant's build_only confirm result used to carry next as the string "connect" or "provision"; it is now the object above.

All changes