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

# Detect Accounts

> Detect merchant accounts with a user's email.

After calling this endpoint, listen for the [`NEW_DETECTED_ACCOUNTS_AVAILABLE`](/detect/webhook-events/new-detected-accounts-available) webhook event which will fire if any detected accounts are found. This may take up to 1 minute.


## OpenAPI

````yaml POST /detect
openapi: 3.1.0
info:
  title: Knot API
  description: An API to interact with the Knot merchant connectivity platform.
  version: 1.0.0
servers:
  - url: https://development.knotapi.com
    description: Development server
security:
  - basicAuth: []
paths:
  /detect:
    post:
      description: Detect merchant accounts with a user's email.
      operationId: detect_accounts
      requestBody:
        description: >-
          The input parameters required for detecting a user's merchant
          accounts.
        content:
          application/json:
            schema:
              type: object
              properties:
                external_user_id:
                  type: string
                  description: Your unique identifier for the user.
                  example: 123abc
                email:
                  type: string
                  description: The user's email address.
                  example: jane@example.com
                phone_number:
                  type: string
                  description: The user's phone number in E.164 format. Optional.
                  example: '+14155551234'
              required:
                - external_user_id
                - email
      responses:
        '202':
          description: Successful request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Success message.
                    example: Success
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                MissingExternalUserId:
                  summary: Missing external_user_id parameter
                  value:
                    error_type: INVALID_INPUT
                    error_code: MISSING_PARAMETER
                    error_message: external_user_id is required.
                InvalidEmail:
                  summary: email is not a valid email address
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The email must be a valid email address.
                InvalidPhoneNumber:
                  summary: phone_number is not a valid phone number
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The phone_number must be in E.164 format.
                MissingEmail:
                  summary: Missing email parameter
                  value:
                    error_type: INVALID_INPUT
                    error_code: MISSING_PARAMETER
                    error_message: email is required.
                OngoingOperation:
                  summary: An existing operation is in progress
                  value:
                    error_type: MERCHANT_ACCOUNT_ERROR
                    error_code: ONGOING_OPERATION
                    error_message: An existing operation is in progress.
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                AuthFailed:
                  summary: Auth failed
                  value:
                    error_type: INVALID_INPUT
                    error_code: INVALID_API_KEYS
                    error_message: Invalid client_id or secret provided.
        '403':
          description: Forbidden request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                NoAccess:
                  summary: No access
                  value:
                    error_type: INVALID_REQUEST
                    error_code: NO_ACCESS
                    error_message: Please contact Knot for access to this endpoint.
        '429':
          description: Rate limit exceeded.
          headers:
            Retry-After:
              description: Seconds until the rate limit resets.
              schema:
                type: integer
                example: 3600
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                RateLimitExceeded:
                  summary: Rate limit exceeded
                  value:
                    error_type: RATE_LIMIT_ERROR
                    error_code: TOO_MANY_REQUESTS
                    error_message: >-
                      Rate limit exceeded. Please retry after the time indicated
                      in the Retry-After header.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                InternalServerError:
                  summary: Unexpected server error
                  value:
                    message: Server Error
components:
  schemas:
    Error:
      type: object
      properties:
        error_type:
          type: string
          description: Type of error.
          enum:
            - INVALID_INPUT
            - INVALID_REQUEST
            - USER_ERROR
            - SESSION_ERROR
            - MERCHANT_ACCOUNT_ERROR
            - MERCHANT_ERROR
            - SUBSCRIPTION_ERROR
            - TRANSACTION_ERROR
            - CART_ERROR
          example: INVALID_REQUEST
        error_code:
          type: string
          description: Error code.
          enum:
            - INVALID_API_KEYS
            - INVALID_FIELD
            - INVALID_JWE
            - INVALID_CURSOR_FORMAT
            - USER_NOT_FOUND
            - MERCHANT_ACCOUNT_NOT_FOUND
            - MERCHANT_ACCOUNT_DISCONNECTED
            - SESSION_NOT_FOUND
            - EXTEND_NOT_SUPPORTED
            - MERCHANT_UNAVAILABLE
            - NO_ACCESS
            - TRANSACTION_NOT_FOUND
            - NO_TRANSACTIONS
            - SUBSCRIPTION_NOT_FOUND
            - ONGOING_OPERATION
            - CART_NOT_FOUND
            - FULFILLMENT_NOT_FOUND
          example: INVALID_FIELD
        error_message:
          type: string
          description: Detailed error message.
          example: The limit may not be greater than 10.
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Basic authentication header of the form `Basic <encoded-value>`, where
        `<encoded-value>` is the base64-encoded string `username:password`. Use
        your `client_id` as the `username` and your `secret` as the `password`
        value.

````