Pular para o conteúdo
Documentação API Reference FAQ Changelog Status

Customer

magento-2

Conta, endereços, senha, preferências e tokens do cliente.

Query customer Customer token

Returns information about the logged-in customer, including addresses, orders, store credit history and wishlist.

Returns: Customer

The customer query returns information about the logged-in customer, store credit history and the customer's wishlist. Customer tokens in GraphQL call headers are recommended, although session authentication is also supported.

{
    customer {
        firstname
        lastname
        email
        addresses {
            street
            city
            region { region_code }
            postcode
            country_code
            telephone
        }
    }
}
Query customerOrders Deprecated Customer token

Deprecated. Returns the authenticated customer's order history. Use the orders field on the Customer type instead.

Deprecated

Use customer { orders } instead. Removed in favor of the nested orders field on the Customer type.

Substituído por POST customer .

Returns: CustomerOrders

Deprecated — use customer { orders } diretamente.

The customerOrders query returns a list of orders placed by the logged-in customer, exposing order, invoice and shipment data managed by the Sales module. Adobe recommends migrating to the orders field nested under the customer query.

{
    customerOrders {
        items {
            order_number
            id
            created_at
            grand_total
            status
        }
    }
}
Query customer.orders Customer token

List orders for the authenticated customer (nested field on the Customer type, supports pagination and filtering).

Returns: CustomerOrders

Retrieves the orders placed by the authenticated customer as a nested field on the Customer type. Supports pagination (pageSize, currentPage) and filtering.

{
    customer {
        orders(pageSize: 10, currentPage: 1) {
            total_count
            items {
                number
                order_date
                status
                total {
                    grand_total { value currency }
                    shipping_handling { total_amount { value } }
                }
                items { product_name product_sku quantity_ordered }
            }
        }
    }
}
Mutation createCustomerV2 Since 2.4.7 Guest

Creates a new customer account. Supersedes the legacy createCustomer mutation and accepts CustomerCreateInput.

Input: CustomerCreateInput Returns: CustomerOutput

The createCustomerV2 mutation creates a new customer account. It supersedes the earlier createCustomer mutation and takes a CustomerCreateInput object, which differs from the input used by updateCustomerV2. Starting with Adobe Commerce 2.4.7, custom attributes may be supplied during account creation.

mutation {
    createCustomerV2(
        input: {
            firstname: "Bob"
            lastname: "Loblaw"
            email: "bobloblaw@example.com"
            password: "b0bl0bl@w"
            is_subscribed: true
        }
    ) {
        customer {
            firstname
            lastname
            email
            is_subscribed
        }
    }
}
FieldTypeDescription
firstnameString!Customer's first name (required).
lastnameString!Customer's last name (required).
emailString!Customer's email address (required).
passwordStringAccount password.
is_subscribedBooleanNewsletter subscription flag.
genderIntGender code (1 = Male, 2 = Female).
custom_attributes[AttributeValueInput!]Optional custom attribute assignments (2.4.7+).
Mutation updateCustomerV2 Customer token

Updates the personal information of the authenticated customer. Supersedes updateCustomer and uses CustomerUpdateInput.

Input: CustomerUpdateInput Returns: CustomerOutput

The updateCustomerV2 mutation updates personal information on an existing customer account. It supersedes the earlier updateCustomer mutation and takes a CustomerUpdateInput object rather than CustomerInput. No single attribute is strictly required on update — provide only the fields you want to change. To change the email address, use the dedicated updateCustomerEmail mutation instead.

mutation {
    updateCustomerV2(
        input: {
            firstname: "Robert"
            is_subscribed: false
        }
    ) {
        customer {
            firstname
            is_subscribed
        }
    }
}
Mutation changeCustomerPassword Customer token

Changes the password of the currently logged-in customer.

Returns: Customer

Use the changeCustomerPassword mutation to change the password of the logged-in customer. Customer tokens in GraphQL call headers are recommended; session authentication is also supported.

mutation {
    changeCustomerPassword(
        currentPassword: "roni_cost3@example.com"
        newPassword: "roni_cost4@example.com"
    ) {
        id
        email
    }
}
ArgumentTypeDescription
currentPasswordString!The customer's existing password.
newPasswordString!The new password to set.
Mutation requestPasswordResetEmail Guest Customer token

Sends an email containing a password reset token to the specified address.

Returns: Boolean

The requestPasswordResetEmail mutation initiates a password reset by sending an email to the given address. It returns true when the reset process starts successfully and the email is sent; false otherwise. The email contains a URL with a token used by the subsequent resetPassword mutation.

mutation {
    requestPasswordResetEmail(
        email: "roni_cost@example.com"
    )
}
ArgumentTypeRequired
emailStringYes
Mutation resetPassword Guest Customer token

Completes the password reset flow using the token delivered by requestPasswordResetEmail.

Returns: Boolean

The resetPassword mutation resets the password for a registered customer using the reset token and email address from requestPasswordResetEmail. It returns true on success, false otherwise. The new password must comply with the store's password policies.

mutation {
    resetPassword(
        email: "roni_cost@example.com",
        resetPasswordToken: "gh80pkjGdsPyiXc0sUUXswX1uGN7crUr",
        newPassword: "new_password"
    )
}
ArgumentTypeRequiredDescription
emailStringYesCustomer's email address.
resetPasswordTokenStringYesReset token received by email.
newPasswordStringYesThe new password to set.
Mutation createCustomerAddress Customer token

Creates a new address for the authenticated customer.

Input: CustomerAddressInput Returns: CustomerAddress

Use the createCustomerAddress mutation to create an address for the logged-in customer. Customer tokens in GraphQL call headers are recommended; session authentication is also supported.

Syntax: createCustomerAddress(input: CustomerAddressInput!): CustomerAddress

mutation {
    createCustomerAddress(input: {
        region: {
            region: "Arizona"
            region_code: "AZ"
        }
        country_code: US
        street: ["123 Main Street"]
        telephone: "7777777777"
        postcode: "77777"
        city: "Phoenix"
        firstname: "Bob"
        lastname: "Loblaw"
        default_shipping: true
        default_billing: false
    }) {
        id
        region { region region_code }
        country_code
        street
        telephone
        postcode
        city
        default_shipping
        default_billing
    }
}
Mutation updateCustomerAddress Customer token

Updates a customer address identified by its unique ID. The V2 variant (Storefront Compatibility Package, 2.4.9+) uses a string uid.

Input: CustomerAddressInput Returns: CustomerAddress

Use updateCustomerAddress (or updateCustomerAddressV2 from the Storefront Compatibility Package, shipping with Adobe Commerce 2.4.9) to update an existing customer address. The V2 variant takes the address uid (ID!) and a CustomerAddressInput and supports custom attributes via custom_attributesV2.

mutation {
    updateCustomerAddressV2(
        uid: "ODU="
        input: {
            city: "Austin"
            postcode: "78701"
        }
    ) {
        id
        city
        postcode
    }
}
ArgumentTypeDescription
uidID!The unique identifier of the customer address.
inputCustomerAddressInputFields to update on the address.
Mutation deleteCustomerAddress Customer token

Deletes a customer address identified by its ID. Returns a Boolean indicating success.

Returns: Boolean

Use deleteCustomerAddress (or deleteCustomerAddressV2 from the Storefront Compatibility Package, shipping with Adobe Commerce 2.4.9) to delete a specific customer address. The mutation returns a Boolean indicating whether the deletion succeeded.

mutation {
    deleteCustomerAddressV2(uid: "ODU=")
}
ArgumentTypeDescription
uidID!The unique ID of the CustomerAddress object.
Query countries Guest Customer token

Returns all countries in which the store can do business, with their ISO codes, localized names and available regions.

Returns: Country

The countries query returns all countries in which the store can do business. Use the country query for information about a single country.

query {
    countries {
        id
        two_letter_abbreviation
        three_letter_abbreviation
        full_name_locale
        full_name_english
        available_regions {
            id
            code
            name
        }
    }
}
Query country Guest Customer token

Returns information about a specific country identified by its ISO code, including available regions.

Returns: Country

The country query retrieves information about a specific country, including its localized names and available regions. Use the countries query to list all supported countries.

Accepts a single argument id (String), typically the ISO two-letter abbreviation (for example "AU" or "BR").

query {
    country(id: "AU") {
        id
        two_letter_abbreviation
        three_letter_abbreviation
        full_name_locale
        full_name_english
        available_regions {
            id
            code
            name
        }
    }
}
Mutation confirmEmail Guest

Completes customer activation by confirming the email address with the confirmation key sent during sign-up.

Input: ConfirmEmailInput Returns: CustomerOutput

The confirmEmail mutation completes the customer activation flow by validating the email address. Adobe Commerce sends a confirmation key during account creation; the customer supplies it to confirm their email.

mutation {
    confirmEmail(input: {
        email: "roni_cost@example.com"
        confirmation_key: "abcde"
    }) {
        customer {
            email
        }
    }
}
FieldTypeDescription
emailStringThe customer's email address.
confirmation_keyStringThe confirmation token emailed by Adobe Commerce.
Mutation resendConfirmationEmail Guest

Resends the account confirmation email to a customer who has not yet completed activation.

Returns: Boolean

The resendConfirmationEmail mutation resends the confirmation email to a customer who has not completed activation. It returns true on success, false otherwise.

mutation ResendConfirmationEmail {
    resendConfirmationEmail(email: "roni_cost@example.com")
}
ArgumentTypeRequired
emailStringYes
Mutation deleteCustomer Customer token

Deletes the authenticated customer account.

Permite apagar a conta do cliente logado. Respeita GDPR. Em algumas versões pode não estar habilitada — verifique a config customer/account_delete/enabled no admin antes de usar.