Week of October 19

Updated APIBreaking

wrong_credential

A real credential of the wrong kind now answers 403 wrong_credential, with a message that names what to send: your secret key on an endpoint that acts for a person (carts, places, menus, images, the profile), or a build grant on an endpoint that takes your secret key (/v1/users, /v1/events, /v1/usage). It used to be 401 unauthorized. A credential Layout does not recognise is still 401 unauthorized. See Every error code.

grant_expired

An expired build grant now answers 401 with error.code grant_expired, and WWW-Authenticate carries error_description="grant_expired". Mint a new grant with POST /v1/users/:id/grant. A revoked grant still answers 401 unauthorized. mcp.layout.link answers the same way. See Refusals.

Expired carts

A ready cart nobody confirmed before expiresAt now ends on its own. The cart reads expired with failure.code CART_EXPIRED, and its order reads failed with failure_code CART_EXPIRED, where it was OUR_TIMEOUT. Its confirm is 409 cart_closed, and nothing is charged. You need not cancel it. Build again with a new key. See GET /v1/carts/:id.

Store names

  • On POST /v1/carts and /answer, every word of restaurantName must appear in the store's name or address. A word the store does not carry, such as another branch, is 409 store_mismatch.
  • A name that matches no store is 409 store_not_found, not store_ambiguous. Its candidates are other stores; send one only if the person says it is the one they meant.
  • After store_ambiguous, send the placeId the person picked with the name you first sent. It is never store_mismatch.

See POST /v1/carts.

Answered carts

Once a cart's question is answered, that cart reads closed with replacedBy, the cart the answer started. An answer under a second key is 409 answer_not_needed and starts nothing. Confirming the answered cart is 409 cart_closed with error.replacedBy, where it was cart_not_ready. See POST /v1/carts/:id/answer.

A real wait on every 429

Every per-minute or per-hour 429 now carries Retry-After and the same wait as error.retryInSeconds. A cart that failed with retry_blocked carries failure.retryInSeconds. A cancel that releases a cart is never refused for rate. See Handling a 429.

provisioned_to_another_app

POST /v1/users for a number another of your applications already holds, in the same environment, now answers 409 provisioned_to_another_app, where it was 409 invalid_request. See Users, sessions and texts.

Stricter request checks

  • POST /v1/users answers 400 invalid_request for a body that is not a JSON object, a name, phone, label or email that is not a string, and a phone with letters in it. See Fields.
  • GET /v1/events answers 400 invalid_request for a cursor it never wrote and a limit of 0 or a non-number. With a sandbox key, an unknown parameter is 400 too. See GET /v1/events.

The standard 404

A path no endpoint handles now answers 404 in the standard error shape, { "error": { "code": "not_found", "message": "…" } }, with X-Request-Id. It was a flat body with error as a string. See Error shape.

Pickup details on order.updated

order.updated now carries order.ready_eta and order.fulfillment, as GET /v1/orders/:id returns them. While a payment waits on the person approving Layout's texted link, GET /v1/orders/:id carries "challenge": { "sms_sent": true }. See Example payload.

fee_not_included

A confirm whose expectedTotalMinor left out Layout's service fee now carries error.reason: "fee_not_included". Confirm with the cart's totalMinor.

Sandbox codes are limited

Sandbox now applies production's code limits: verify/start spacing and hourly cap, four codes per cart at test_place_code, and 429 code_attempts_exceeded after 8 wrong codes in 15 minutes. The sandbox test menu also reads quantities and options from plain words, such as "an iced latte, large, with oat milk" or "two lattes". See the test restaurants.

Breaking changes

  • Your secret key on a person endpoint now gets 403 wrong_credential, not 401.
  • An expired build grant now gets grant_expired. The status is still 401.
  • A cart past expiresAt can no longer be confirmed, and its order reads CART_EXPIRED, not OUR_TIMEOUT.
  • A restaurantName with a word the store does not carry is now store_mismatch.
  • Confirming an answered cart now gets cart_closed, not cart_not_ready.
  • A number another of your applications holds now gets provisioned_to_another_app.
  • Loosely formed POST /v1/users bodies and GET /v1/events queries are now 400.
  • A 404 body's error is now an object.
  • Sandbox tests that resend codes quickly can now get 429, and a sandbox request without items can build different lines than before.

All changes