> ## 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.

# Get Merchant Accounts

> Get a user's merchant accounts linked to Knot.

This endpoint allows you to retrieve an array of merchant accounts for a given user (specified in the request with `external_user_id`) that are currently linked to Knot. If a user unlinked a merchant account with [Unlink Merchant Account](https://docs.knotapi.com/api-reference/accounts/unlink-account), it will not be returned.

You can choose to retrieve all merchant accounts for a user or a single merchant account by passing a specific `merchant_id` in the request.


## OpenAPI

````yaml GET /accounts/get
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:
  /accounts/get:
    get:
      description: Get a user's merchant accounts linked to Knot.
      operationId: accounts_get
      parameters:
        - name: external_user_id
          in: query
          required: true
          schema:
            type: string
          description: Your unique identifier for the user.
        - name: merchant_id
          in: query
          required: false
          schema:
            type: integer
            example: 19
          description: >-
            Unique identifier for a merchant. Used to return a single merchant
            account object.
        - name: type
          in: query
          required: false
          schema:
            type: string
            enum:
              - card_switcher
              - transaction_link
              - vault
            example: card_switcher
          description: >-
            Product type for which you want to get the status of the most recent
            login attempt in `lifecycle.status`.
      responses:
        '200':
          description: >-
            Successful request. If you pass a merchant_id in the request, the
            response will be a single object, instead of an array.
          content:
            application/json:
              schema:
                oneOf:
                  - title: Multiple Accounts
                    type: array
                    items:
                      type: object
                      properties:
                        merchant:
                          type: object
                          properties:
                            id:
                              type: integer
                              description: >-
                                Static unique ID of the merchant (across all
                                environments). This ID remains constant and does
                                not change.
                              example: 10
                            name:
                              type: string
                              description: Name of the merchant.
                              example: Uber
                            logo:
                              type: string
                              description: Logo of the merchant.
                              example: >-
                                https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                        connection:
                          type: object
                          properties:
                            status:
                              type: string
                              enum:
                                - connected
                                - disconnected
                              description: Connection status of the merchant account.
                            scopes:
                              type: array
                              items:
                                type: object
                                properties:
                                  type:
                                    type: string
                                    enum:
                                      - update_card
                                      - cancel
                                    description: Type of scope.
                                    example: update_card
                              description: >-
                                Array of scopes for the merchant account
                                connection.
                        lifecycle:
                          type: object
                          properties:
                            status:
                              type:
                                - string
                                - 'null'
                              description: >-
                                Status of the most recent task login attempt for
                                the type specified in the request.
                              enum:
                                - authenticating
                                - credentials_required
                                - otp_required
                                - approval_required
                                - security_questions_required
                                - zipcode_required
                                - license_required
                        last_user_action:
                          type: object
                          properties:
                            attempted_at:
                              type:
                                - string
                                - 'null'
                              format: date-time
                              description: Timestamp of the most recent cardswitch attempt.
                            status:
                              type:
                                - string
                                - 'null'
                              description: Status of the most recent cardswitch attempt.
                              enum:
                                - succeeded
                                - failed
                  - title: Single Account
                    type: object
                    properties:
                      merchant:
                        type: object
                        properties:
                          id:
                            type: integer
                            description: >-
                              Static unique ID of the merchant (across all
                              environments). This ID remains constant and does
                              not change.
                            example: 10
                          name:
                            type: string
                            description: Name of the merchant.
                            example: Uber
                          logo:
                            type: string
                            description: Logo of the merchant.
                            example: >-
                              https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        type: object
                        properties:
                          status:
                            type: string
                            enum:
                              - connected
                              - disconnected
                            description: Connection status of the merchant account.
                          scopes:
                            type: array
                            items:
                              type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - update_card
                                    - cancel
                                  description: Type of scope.
                                  example: update_card
                            description: >-
                              Array of scopes for the merchant account
                              connection.
                      lifecycle:
                        type: object
                        properties:
                          status:
                            type:
                              - string
                              - 'null'
                            description: >-
                              Status of the most recent task login attempt for
                              the type specified in the request.
                            enum:
                              - authenticating
                              - credentials_required
                              - otp_required
                              - approval_required
                              - security_questions_required
                              - zipcode_required
                              - license_required
                      last_user_action:
                        type: object
                        properties:
                          attempted_at:
                            type:
                              - string
                              - 'null'
                            format: date-time
                            description: Timestamp of the last user action.
                          status:
                            type:
                              - string
                              - 'null'
                            description: Status of the last user action.
                            enum:
                              - succeeded
                              - failed
              examples:
                TypeEmpty:
                  summary: Type is empty.
                  value:
                    - merchant:
                        id: 19
                        name: DoorDash
                        logo: >-
                          https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        status: connected
                        scopes:
                          - type: update_card
                      lifecycle:
                        status: null
                      last_user_action:
                        attempted_at: null
                        status: null
                    - merchant:
                        id: 40
                        name: Instacart
                        logo: >-
                          https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        status: connected
                        scopes:
                          - type: update_card
                      lifecycle:
                        status: null
                      last_user_action:
                        attempted_at: null
                        status: null
                    - merchant:
                        id: 12
                        name: Target
                        logo: >-
                          https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        status: disconnected
                        scopes: []
                      lifecycle:
                        status: null
                      last_user_action:
                        attempted_at: null
                        status: null
                TypeEmptyWithMerchantId:
                  summary: Type empty with merchant id.
                  value:
                    merchant:
                      id: 19
                      name: DoorDash
                      logo: >-
                        https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                    connection:
                      status: connected
                      scopes:
                        - type: update_card
                    lifecycle:
                      status: null
                    last_user_action:
                      attempted_at: null
                      status: null
                TypeCardSwitcher:
                  summary: Type = card_switcher.
                  value:
                    - merchant:
                        id: 19
                        name: DoorDash
                        logo: >-
                          https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        status: connected
                        scopes:
                          - type: update_card
                      lifecycle:
                        status: null
                      last_user_action:
                        attempted_at: '2024-11-22T14:30:16Z'
                        status: succeeded
                    - merchant:
                        id: 40
                        name: Instacart
                        logo: >-
                          https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        status: disconnected
                        scopes: []
                      lifecycle:
                        status: authenticating
                      last_user_action:
                        attempted_at: null
                        status: null
                    - merchant:
                        id: 12
                        name: Target
                        logo: >-
                          https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        status: connected
                        scopes:
                          - type: update_card
                      lifecycle:
                        status: null
                      last_user_action:
                        attempted_at: '2025-03-10T16:02:36Z'
                        status: succeeded
                TypeTransactionLink:
                  summary: Type = transaction_link.
                  value:
                    - merchant:
                        id: 19
                        name: DoorDash
                        logo: >-
                          https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        status: connected
                        scopes:
                          - type: update_card
                      lifecycle:
                        status: null
                      last_user_action:
                        attempted_at: null
                        status: null
                    - merchant:
                        id: 40
                        name: Instacart
                        logo: >-
                          https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        status: connected
                        scopes:
                          - type: update_card
                      lifecycle:
                        status: authenticating
                      last_user_action:
                        attempted_at: null
                        status: null
                    - merchant:
                        id: 12
                        name: Target
                        logo: >-
                          https://knot.imgix.net/merchants/KBQ5j6cN010PPpwbO7RpKGyDrCpsZ91FRhwnZp5u.png
                      connection:
                        status: disconnected
                        scopes: []
                      lifecycle:
                        status: null
                      last_user_action:
                        attempted_at: null
                        status: null
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                ExternalUserIdRequired:
                  summary: external_user_id not found
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The external user id field is required.
                InvalidType:
                  summary: Invalid product type
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The selected type is invalid.
                InvalidMerchantId:
                  summary: merchant_id is not valid
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The selected merchant id is invalid.
                UserNotFound:
                  summary: User was not found
                  value:
                    error_type: USER_ERROR
                    error_code: USER_NOT_FOUND
                    error_message: >-
                      The user was not found. Please check the external_user_id
                      provided.
                LinkedMerchantNotFound:
                  summary: Merchant account was not found
                  value:
                    error_type: MERCHANT_ACCOUNT_ERROR
                    error_code: MERCHANT_ACCOUNT_NOT_FOUND
                    error_message: >-
                      The merchant account was not found. Please check the
                      merchant_id provided.
        '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: >-
                      The type is not enabled. Please contact Knot for access to
                      this endpoint.
        '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.

````