> ## Documentation Index
> Fetch the complete documentation index at: https://docs.henrylabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Account Connect

> Connect a buyer's own account at a store: the login they created there, so purchases for them at that store check out on their account. Only for stores that check out on customers' own accounts; any other store answers `409`.

Henry stores the password encrypted and never returns it, or the username, from any endpoint. Connecting again for the same buyer and store replaces the login, so a buyer who changed their password just connects again, which also clears a `failed` login. Henry doesn't check the login here: a wrong password fails the buyer's first purchase at the store, at sign-in. A purchase at such a store for a buyer with no connected login is refused with `409` before anything is charged.



## OpenAPI

````yaml /v1/api-reference/openapi.documented.json post /account/connect
openapi: 3.1.0
info:
  title: Henry Labs API
  version: 1.18.0
  description: Playground for Henry Labs API endpoints
  contact:
    name: Henry Labs API Support
    email: support@henrylabs.ai
servers:
  - url: https://api.henrylabs.ai/v1
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Product
    description: Product search, details, and data enrichment
  - name: Cart
    description: Universal user shopping cart management
  - name: Orders
    description: Order management post purchase
  - name: Merchants
    description: Merchant information and status
  - name: Card
    description: Card tokenization and management
  - name: Account
    description: Buyers' own logins at stores that check out on customers' own accounts
paths:
  /account/connect:
    post:
      tags:
        - Account
      summary: Account Connect
      description: >-
        Connect a buyer's own account at a store: the login they created there,
        so purchases for them at that store check out on their account. Only for
        stores that check out on customers' own accounts; any other store
        answers `409`.


        Henry stores the password encrypted and never returns it, or the
        username, from any endpoint. Connecting again for the same buyer and
        store replaces the login, so a buyer who changed their password just
        connects again, which also clears a `failed` login. Henry doesn't check
        the login here: a wrong password fails the buyer's first purchase at the
        store, at sign-in. A purchase at such a store for a buyer with no
        connected login is refused with `409` before anything is charged.
      operationId: accountConnect
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accountConnectInput'
      responses:
        '200':
          description: Login connected
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accountConnectResponse'
        '400':
          description: Bad request - Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  status:
                    type: string
                  message:
                    type: string
                required:
                  - success
                  - status
                  - message
                additionalProperties: false
        '401':
          description: Unauthorized - Invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  status:
                    type: string
                  message:
                    type: string
                required:
                  - success
                  - status
                  - message
                additionalProperties: false
        '404':
          description: No store with this host
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  status:
                    type: string
                  message:
                    type: string
                required:
                  - success
                  - status
                  - message
                additionalProperties: false
        '409':
          description: >-
            The store doesn't check out on customers' own accounts, so there is
            nothing to connect
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  status:
                    type: string
                  message:
                    type: string
                required:
                  - success
                  - status
                  - message
                additionalProperties: false
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import HenrySDK from '@henrylabs/sdk';

            const client = new HenrySDK({
              apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.account.connect({
              buyerEmail: 'jane@example.com',
              merchantHost: 'uniqlo.com',
              password: 'correct-horse-battery-staple',
              username: 'jane@example.com',
            });

            console.log(response.data);
components:
  schemas:
    accountConnectInput:
      type: object
      properties:
        merchantHost:
          type: string
          minLength: 1
          description: >-
            The store, by the host Henry names it with (for example
            `uniqlo.com`). A URL is accepted and reduced to its host; a leading
            `www.` is ignored.
          example: uniqlo.com
        buyerEmail:
          type: string
          format: email
          pattern: >-
            ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
          description: >-
            The buyer the login belongs to: the `buyer.email` your purchases at
            this store carry. Matched case-insensitively.
          example: jane@example.com
        username:
          type: string
          minLength: 1
          maxLength: 320
          description: >-
            What the buyer signs in to the store with, usually their email
            address.
          example: jane@example.com
        password:
          type: string
          minLength: 1
          maxLength: 1024
          description: >-
            The buyer's password at the store. Stored encrypted and never
            returned by any endpoint.
          example: correct-horse-battery-staple
      required:
        - merchantHost
        - buyerEmail
        - username
        - password
    accountConnectResponse:
      type: object
      properties:
        success:
          type: boolean
        status:
          type: string
        message:
          type: string
        data:
          type: object
          properties:
            merchantHost:
              type: string
              description: The store the login is for.
              example: uniqlo.com
            buyerEmail:
              type: string
              description: The buyer the login belongs to, lowercased.
              example: jane@example.com
            status:
              type: string
              enum:
                - connected
                - failed
                - disconnected
              description: >-
                `connected`: purchases for this buyer at this store sign in with
                it. `failed`: the store would not sign in with it (the password
                was rejected, the account is locked, or the store asked for a
                check only the buyer can complete), so purchases there are
                refused until you connect the login again. `disconnected`: it
                was removed and erased, and is no longer used.
              example: connected
            connectedAt:
              type: string
              description: When the login was first connected (ISO 8601).
              example: '2026-11-12T23:00:00.000Z'
            replaced:
              type: boolean
              description: >-
                `true` when this replaced a login already connected for this
                buyer and store.
              example: false
          required:
            - merchantHost
            - buyerEmail
            - status
            - connectedAt
            - replaced
          additionalProperties: false
      required:
        - success
        - status
        - message
        - data
      additionalProperties: false
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.