Quickstart
Place your first sandbox order in a few minutes: provision a user, build a cart, and hand off the confirmation link.
1. Get your credentials
Create an application in the console and copy its client id and secret from the Credentials page. Keep the secret server-side — never ship it in a browser or an app binary.
export LAYOUT_CLIENT_ID="lp_test_9c2f8a1b7d3e" export LAYOUT_SECRET="sk_test_…"
2. Provision a user
A name and a phone number is all it takes. Nothing that can spend is minted — you get a build-only session back.
curl https://api.layout.link/v1/users \
-H "Authorization: Bearer $LAYOUT_SECRET" \
-H "Content-Type: application/json" \
-d '{ "firstName": "Dana", "lastName": "Whitfield", "phone": "+19165550142" }'
3. Build a cart
Reference a store by placeId and describe what the person wants. Layout resolves the store, builds the cart, and prices it.
curl https://api.layout.link/v1/orders \
-H "Authorization: Bearer $LAYOUT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"userId": "usr_4b8e",
"placeId": "plc_sweetgreen_market",
"query": "harvest bowl, no onion, and a lemonade"
}'
4. Hand off the link
The order comes back building, then an order.carted webhook carries the priced cart and a hosted confirmation link. Show your user the total verbatim and send them to the link — they add a card if needed and confirm.
5. Get the outcome
When the person confirms, an order.placed webhook fires with evidence. If it can't be placed you get order.failed; if placement is genuinely uncertain you get order.unconfirmed — never treat that as failed.