Customer accounts

Sign in with one-time codes and manage the signed-in customer's profile, addresses, and orders.

POST /account/addresses/create
{% form 'address_create' %}

Logged-in only. Adds a saved address; is_default promotes it for its type.

Form fields

address_type Required

shipping or billing.

first_name Required

Recipient first name.

last_name Required

Recipient last name.

address1 Required

Street address.

address2 Optional

Apartment, suite, or additional address line.

district Optional

District, suburb or neighbourhood, only for countries whose address form has one (customer.address_form).

city Optional

City/locality; required where the country's address form requires it.

country_code Required

ISO country code.

province_code Optional

Province, state or prefecture as its ISO 3166-2 code from customer.address_form (e.g. IN-HR). Only for countries whose addresses name one; required where the country requires it.

postal_code Optional

Required where the country requires it; validated against the country's postal rules and stored in its standard written form.

company Optional

Company or organization name.

phone Optional

Delivery/contact phone.

is_default Optional

true, 1, or on makes this the default for its type.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

Logged-in customer only; address_type is shipping or billing. The country must exist; the country's required fields must be present (ADDRESS_FIELD_REQUIRED); the postal code must be one of the country's (POSTAL_CODE_INVALID) and is stored in its standard form; province_code must be one of the country's codes (a retired code is stored as its successor), else SUBDIVISION_INVALID.

Limits

250 addresses/customer; names 100; address lines 255; city 100; company 100; postal code 20. Phone must be valid for the selected country and is stored as E.164. The same address submitted again within 30 seconds returns the address already saved instead of a second copy. Address creates, edits and deletes are limited per customer and per visitor address; past the limit the action returns CHECKOUT_TOO_MANY_ATTEMPTS until the budget refills.

Response

{
  success,
  response,
  user_errors
}

response contains the created address.

POST /account/addresses/delete
{% form 'address_delete' %}

Logged-in only. Removes the saved address.

Form fields

address_id Required

Address to remove.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

Logged-in customer and owned address only.

Limits

Address creates, edits and deletes are limited per customer and per visitor address; past the limit the action returns CHECKOUT_TOO_MANY_ATTEMPTS until the budget refills.

Response

{
  success,
  response,
  user_errors
}
POST /account/addresses/set-default
{% form 'address_set_default' %}

Logged-in only. Promotes the address to default for its type.

Form fields

address_id Required

Address to make the default for its type.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

Logged-in customer and owned address only; promotes the address within its shipping/billing type.

Limits

Exactly one default per customer and address type. Address creates, edits and deletes are limited per customer and per visitor address; past the limit the action returns CHECKOUT_TOO_MANY_ATTEMPTS until the budget refills.

Response

{
  success,
  response,
  user_errors
}
POST /account/addresses/update
{% form 'address_update' %}

Logged-in only. PATCH semantics on the supplied fields.

Form fields

address_id Required

Address being edited.

address_type Optional

shipping or billing; unchanged when omitted.

first_name Optional

Unchanged when omitted.

last_name Optional

Unchanged when omitted.

address1 Optional

Street address; unchanged when omitted.

address2 Optional

Apartment, suite, or additional address line; unchanged when omitted.

district Optional

District, suburb or neighbourhood, only for countries whose address form has one; unchanged when omitted.

city Optional

Unchanged when omitted.

country_code Optional

ISO country code; unchanged when omitted.

province_code Optional

Province, state or prefecture as its ISO 3166-2 code from customer.address_form (e.g. IN-HR). Only for countries whose addresses name one; required where the country requires it.

postal_code Optional

Validated for the resulting country; unchanged when omitted.

company Optional

Company or organization name; unchanged when omitted.

phone Optional

Delivery/contact phone; unchanged when omitted.

is_default Optional

true, 1, or on makes this the default for its type; unchanged when omitted.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

Logged-in customer and owned address only; PATCH semantics. A changed country must exist and clears the saved province_code unless a new one is sent; the resulting address is validated as on create (required fields, province_code, postal code) and a changed phone against the resulting country. Postal updates are trimmed and length-checked.

Limits

Names 100; address lines 255; city 100; company 100; postal code 20. Phone is stored as E.164. Omitted fields remain unchanged; an edit that changes nothing saves nothing and sends no customer_addresses/update webhook. Address creates, edits and deletes are limited per customer and per visitor address; past the limit the action returns CHECKOUT_TOO_MANY_ATTEMPTS until the budget refills.

Response

{
  success,
  response,
  user_errors
}

response contains the updated address.

POST /auth/code
{% form 'auth_code_send' %}

Step one of every flow. The answer is the same whether or not the email or phone has an account, so it never tells anyone which contacts have accounts; mode only says which page the form was sent from. The code is the only credential. Phone requires an active SMS/WhatsApp provider.

Form fields

provider Optional

email or phone; inferred from phone_number when omitted, otherwise email.

email Optional

Required when provider is email.

phone_number Optional

Required when provider is phone.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

provider is email or phone when supplied; otherwise phone is inferred from phone_number and email is the default. Email is normalized and validated, phone is normalized to E.164 and provider availability is checked. Whether the contact has an account, whether that account is disabled and whether the store allows sign-up are decided only after the code is verified (login, register), so this step answers every contact the same way.

Limits

Code expires after 5 minutes; 3 verification attempts; 5 sends/identifier/hour; 10 sends/client address/store/hour (IPv6 counted by /64), with further per-address, per-store and per-country limits. A new code invalidates the previous active code.

Response

{
  success:true,
  mode,
  expires_at,
  expiry_minutes,
  response,
  user_errors
}

form mode renders the verification step on the page the form was sent from. mode is register when the form was sent from the sign-up page and the store allows sign-up, otherwise login; it never depends on whether an account exists. With the bridge, the theme shows its own verification step from tf:action-success: mode says whether to show the sign-up fields (names, marketing consent) with the code, and response.message is the notice to show. Either verification action signs in to an existing account or creates a new one.

POST /account/email/add
{% form 'email_add' %}

Logged-in only. Attaches an email to a phone-only account as contact-of-record, or confirms the account's own email while customer.email_verified is false (a code is emailed to it, whether or not email sign-in is on); login identities are only created by a completed auth-code challenge. When the email belongs to a customer record nobody has signed in to (for example from a guest checkout), a code is sent to it first, and the email joins the account, verified, once that code is posted back; the record's orders move to the account.

Form fields

email Required

Email to attach as contact-of-record. Send the same email again with code to finish a verification step.

code Optional

6-digit code sent to the email when the first request answered requires_verification: true.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

Logged-in customer only; the email must be valid. An account that already carries an email takes only that same email, and only while it is not confirmed (customer.email_verified false): a code is sent to it (requires_verification: true), whether or not email sign-in is on, and posting it with the code confirms it; any other email is refused with STOREFRONT_CUST_ALREADY_HAS_EMAIL. An email no other customer holds is added unverified. An email held by a customer record nobody has signed in to sends a code to that email instead (requires_verification: true); post the same email with code to add it verified and merge that record, with its orders, into the account. An email held by a customer who has signed in, or by a record with merchant-managed data (a note, tags, metafields, saved addresses, store credit, manual groups or discount eligibility), is refused with STOREFRONT_CUST_EMAIL_EXISTS. A wrong or expired code returns STOREFRONT_CUST_INVALID_EXPIRED_CODE.

Limits

One email per account. The code has 6 digits, is bound to the visitor session, and uses the sign-in code expiry, attempt and send limits.

Response

{
  success,
  response,
  requires_verification,
  user_errors
}

requires_verification is true when a code was sent and nothing was added yet; response.message then says where the code went. Show a code field and post the action again with email and code; requires_verification is false once the email is added. The code step needs the JSON response: a form submission redirects to the account page either way.

POST /login
{% form 'login' %}

Completes sign-in with the code — same flow for email and phone. Signs in to the contact's account, or creates one (without names) when it has none and the store allows sign-up.

Form fields

provider Optional

email or phone; inferred from phone_number when omitted, otherwise email.

code Required

The code from auth_code_send.

email Optional

Required when provider is email.

phone_number Optional

Required when provider is phone.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

Valid unconsumed code bound to store, provider, normalized identifier and session. With the code verified: an existing active account signs in; a contact without an account gets a new one (without names, which the customer can add on the account page) when self-registration is enabled, otherwise STOREFRONT_CUST_REGISTRATION_DISABLED; a disabled account is refused with STOREFRONT_CUST_ACCOUNT_DISABLED.

Limits

Code expires after 5 minutes with 3 attempts; code checks are also limited per client address.

Response

{
  success:true,
  redirect,
  user_errors
}

hosted mode establishes the customer session under a new session cookie. The cart and checkout carry on; forms rendered before sign-in need the next page's CSRF token. redirect is the account page in the shopper's language, or the cart or checkout recovery link the shopper was asked to sign in for (a recovery link restores a cart saved to an account only for that customer); the bridge navigates there.

POST /logout
{% form 'logout' %}

Ends the customer session.

This action has no form fields beyond the CSRF token emitted by the form tag.

Validation

Ends the current customer authentication state without destroying the visitor session. An unpaid order from the shopper's open checkout is cancelled first, as signing out in checkout does. While that order is being created, or when it cannot be cancelled safely, sign-out is refused and the shopper stays signed in.

Limits

Idempotent; no action-specific numeric limit.

Response

{
  success,
  redirect
}

JSON returns the localized home route, or the localized sign-in route while the shopper is switching account to open a cart or checkout recovery link. Native form mode clears customer authentication and redirects there with HTTP 303. A refused sign-out returns {success:false, user_errors} in JSON and re-renders the account page with the message in form mode; retrying shortly after succeeds.

POST /account/orders/cancel
{% form 'order_cancel' %}

Logged-in only. Opens the order's status page at its Cancel order form, where the shopper gives a reason and confirms; nothing is cancelled by this action itself.

Form fields

order_id Required

The customer's own order whose Cancel order form to open.

Validation

Only redirects; it changes nothing. A signed-in customer's own order 303s to its status page at the Cancel order form (the same place as order.cancel_url). Signed out or not the customer's order: 303 to /account/orders/<order_id>; no order_id: 303 to /account/orders. The cancellation itself happens when the shopper submits that form: the store's cancellation rules must allow it (an order with shipped or delivered goods never is), and captured money is refunded on the original payment rail.

Limits

No action-specific limit; the Cancel order form on the status page carries its own reason, confirmation and CSRF checks.

Response

Always HTTP 303, never JSON. Link to order.cancel_url instead when no form is needed.

POST /account/phone/add
{% form 'phone_add' %}

Logged-in only. Adds a phone number to an email-only account, or confirms the account's own number while customer.phone_verified is false, once the customer enters the code texted to it. Offered whenever customer_settings.phone_add_available is true; the number also signs them in when phone sign-in is on.

Form fields

phone_number Required

E.164 phone number to add. The first request texts a code to it and answers requires_verification: true; send the same number again with code to add it.

code Optional

6-digit code texted to the phone by the first request.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

Logged-in customer only. An account that already carries a phone number takes only that same number, and only while it is not confirmed (customer.phone_verified false): a code is texted to it and posting it with the code confirms it; any other number is refused with STOREFRONT_CUST_ALREADY_HAS_PHONE. E.164 format, and the store must be able to text codes (customer_settings.phone_add_available); phone sign-in does not need to be on. The number is always confirmed by a code texted to it. A number another customer in the store holds is refused with STOREFRONT_CUST_PHONE_EXISTS, except a record nobody has signed in to without merchant-managed data (a checkout guest), which the confirmed number merges into the account.

Limits

One phone number per account. The code has 6 digits, is bound to the visitor session, and uses the sign-in code expiry, attempt and send limits.

Response

{
  success,
  response,
  requires_verification,
  user_errors
}

requires_verification and the code step work as for email_add.

POST /account/profile
{% form 'profile_update' %}

Logged-in only. PATCH semantics: only supplied fields change. The sign-in email address and phone number cannot be changed here.

Form fields

first_name Optional

Only supplied fields change (PATCH semantics).

last_name Optional

Only supplied fields change.

accepts_marketing Optional

true/false; only applied when supplied. An unchecked checkbox submits nothing, so place a hidden false field before it so that opting out can be submitted.

accepts_text_marketing Optional

true/false: gives or withdraws SMS and WhatsApp marketing consent for the account's phone (customer.phone), on both channels; only applied when supplied. Needs customer.phone. Place a hidden false field before the checkbox, as for accepts_marketing.

date_of_birth Optional

YYYY-MM-DD; empty clears it. Only applied when supplied.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

Logged-in customer only; PATCH semantics for first_name, last_name, accepts_marketing, and date_of_birth. A future date of birth is rejected. Login email and phone identities cannot be changed here. Marketing opt-in follows the store's consent and double-opt-in settings.

Limits

First name and last name are each limited to 100 characters.

Response

{
  success,
  response,
  user_errors
}
POST /register
{% form 'register' %}

Completes sign-in with the code and the optional names: signs in to the contact's account, or creates one when it has none and the store allows sign-up. Guest state and guest orders on this email attach automatically.

Form fields

provider Optional

email or phone; inferred from phone_number when omitted, otherwise email.

code Required

The code from auth_code_send.

email Optional

Required when provider is email.

phone_number Optional

Required when provider is phone.

first_name Optional

Optional customer first name.

last_name Optional

Optional customer last name.

accepts_marketing Optional

Marketing consent; shown when the store collects it (collect_marketing_consent). Any non-empty value = consented.

accepts_text_marketing Optional

SMS and WhatsApp marketing consent when registering with a phone number; shown when the store collects it (collect_text_marketing_consent). true/1/on = consented.

_format Optional

Set to json when submitting with fetch; omit for the normal browser redirect.

Validation

Valid unconsumed code bound to store, provider, normalized identifier and session. With the code verified: an existing active account signs in (names are ignored); a contact without an account gets a new one when self-registration is enabled, otherwise STOREFRONT_CUST_REGISTRATION_DISABLED; a disabled account is refused with STOREFRONT_CUST_ACCOUNT_DISABLED.

Limits

Code expires after 5 minutes with 3 attempts; code checks are also limited per client address; first and last names are each limited to 100 characters.

Response

{
  success:true,
  redirect,
  response,
  user_errors
}

hosted mode also establishes the customer session under a new session cookie and attaches eligible guest state/orders. The cart and checkout carry on; forms rendered before sign-in need the next page's CSRF token. redirect is the account page in the shopper's language, or the cart or checkout recovery link the shopper was asked to sign in for (a recovery link restores a cart saved to an account only for that customer); the bridge navigates there.

After login, guest state follows the customer: the cart, wishlist, consent choices, pending review photos — and the guest ORDERS placed with the email or phone they just verified — become theirs. The visitor cart and the account's saved cart are combined: every line of both, and the same line (product, variant, properties, artifacts) once with the quantities added. The visitor wishlist joins the account wishlist with each product (and variant and properties) once. Nothing is removed to fit the cart line limit or the store's wishlist limit: a cart or wishlist over its limit refuses further adds until lines are removed. Lines whose line artifact is no longer leased (an expired upload) are removed, and the next page shows STOREFRONT_CART_EXPIRED_UPLOAD_LINES_REMOVED as the form notice. STOREFRONT_CUST_INVALID_EXPIRED_CODE means only a wrong or expired code; when sign-in fails after the code was accepted, the response is STOREFRONT_RUNTIME_INTERNAL and the same code still signs the shopper in. Auth pages are themed surfaces; these endpoints are what their forms submit to, and your own sections can use them the same way (the {% form %} kinds are auth_code_send, register, login, logout).