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

# Create Knot Zero Links (Batch)

> Create Knot Zero links for up to 10,000 users in one request.

A user that fails validation gets an `error` instead of a link without failing the rest of the request. Links are created together: if the request fails, no links are created and no earlier links are revoked.


## OpenAPI

````yaml POST /zero-link/batch/create
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:
  /zero-link/batch/create:
    post:
      summary: Create Knot Zero Links (Batch)
      description: Create Knot Zero links for up to 10,000 users in one request.
      operationId: clip_link_create_batch
      requestBody:
        description: The users to create links for.
        content:
          application/json:
            schema:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - card_switcher
                  description: Product to associate the link with.
                  example: card_switcher
                users:
                  type: array
                  minItems: 1
                  maxItems: 10000
                  description: >-
                    The users to create links for. Maximum 10,000 users per
                    request. A user can appear once per card. Later rows with
                    the same `external_user_id` and `card_id` get an error.
                  items:
                    type: object
                    properties:
                      phone_number:
                        type: string
                        description: >-
                          User's phone number in E.164 format. Must be a valid
                          US or Canadian phone number. Knot sends a one-time
                          code to this number to verify the user each time they
                          open the link.
                        example: '+12025550123'
                      external_user_id:
                        type: string
                        description: Your unique identifier for the user.
                        example: 123abc
                        maxLength: 256
                      card_id:
                        type: string
                        description: Your unique identifier for the user's card.
                        example: 81n9al10a0ayn13
                        maxLength: 256
                    required:
                      - phone_number
                      - external_user_id
                      - card_id
              required:
                - type
                - users
            examples:
              Batch:
                summary: Batch
                value:
                  type: card_switcher
                  users:
                    - phone_number: '+12025550123'
                      external_user_id: 123abc
                      card_id: 81n9al10a0ayn13
                    - phone_number: '+12025550124'
                      external_user_id: 456def
                      card_id: 92o0bm21b1bzo24
                    - phone_number: '1234567892'
                      external_user_id: 789ghi
                      card_id: 03p1cn32c2c0p35
                    - phone_number: '+12025550125'
                      external_user_id: 123abc
                      card_id: 81n9al10a0ayn13
      responses:
        '200':
          description: >-
            Successful request. Results are returned in the same order as
            `users` in the request. A user that fails validation returns an
            `error` instead of a `link` and doesn't fail the rest of the
            request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  links:
                    type: array
                    description: One result per user, in request order.
                    items:
                      type: object
                      properties:
                        external_user_id:
                          type:
                            - string
                            - 'null'
                          description: The `external_user_id` from the request.
                          example: 123abc
                        card_id:
                          type:
                            - string
                            - 'null'
                          description: The `card_id` from the request.
                          example: 81n9al10a0ayn13
                        link:
                          type:
                            - string
                            - 'null'
                          description: >-
                            The Knot Zero link for the user. `null` when `error`
                            is present.
                          example: >-
                            https://clip.knotapi.com/switch?token=example_knot_zero_token_1xxxxxxxxxxxxxxxxxx
                        token:
                          type:
                            - string
                            - 'null'
                          description: >-
                            The unique token in `link`, returned separately so
                            you don't need to parse it from the link. `null`
                            when `error` is present.
                          example: example_knot_zero_token_1xxxxxxxxxxxxxxxxxx
                        error:
                          type:
                            - object
                            - 'null'
                          description: >-
                            Why a link couldn't be created for the user. `null`
                            on success.
                          properties:
                            error_type:
                              type: string
                              enum:
                                - INVALID_REQUEST
                              example: INVALID_REQUEST
                            error_code:
                              type: string
                              enum:
                                - INVALID_FIELD
                              example: INVALID_FIELD
                            error_message:
                              type: string
                              description: >-
                                Which field failed validation, or that the user
                                appears more than once in the request.
                              enum:
                                - The phone number field is required.
                                - The phone number must be a string.
                                - The phone number format is invalid.
                                - >-
                                  The phone number must be a valid number in a
                                  supported country.
                                - The external user id field is required.
                                - The external user id must be a string.
                                - >-
                                  The external user id must not be greater than
                                  256 characters.
                                - The card id field is required.
                                - The card id must be a string.
                                - >-
                                  The card id must not be greater than 256
                                  characters.
                                - >-
                                  This user and card appear more than once in
                                  this request.
                              example: The phone number format is invalid.
                          required:
                            - error_type
                            - error_code
                            - error_message
              examples:
                Batch:
                  summary: Batch
                  value:
                    links:
                      - external_user_id: 123abc
                        card_id: 81n9al10a0ayn13
                        link: >-
                          https://clip.knotapi.com/switch?token=example_knot_zero_token_2xxxxxxxxxxxxxxxxxx
                        token: example_knot_zero_token_2xxxxxxxxxxxxxxxxxx
                        error: null
                      - external_user_id: 456def
                        card_id: 92o0bm21b1bzo24
                        link: >-
                          https://clip.knotapi.com/switch?token=example_knot_zero_token_3xxxxxxxxxxxxxxxxxx
                        token: example_knot_zero_token_3xxxxxxxxxxxxxxxxxx
                        error: null
                      - external_user_id: 789ghi
                        card_id: 03p1cn32c2c0p35
                        link: null
                        token: null
                        error:
                          error_type: INVALID_REQUEST
                          error_code: INVALID_FIELD
                          error_message: The phone number format is invalid.
                      - external_user_id: 123abc
                        card_id: 81n9al10a0ayn13
                        link: null
                        token: null
                        error:
                          error_type: INVALID_REQUEST
                          error_code: INVALID_FIELD
                          error_message: >-
                            This user and card appear more than once in this
                            request.
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                TypeRequired:
                  summary: type is missing
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The type field is required.
                UsersRequired:
                  summary: users is missing or empty
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The users field is required.
                TooManyUsers:
                  summary: More than 10,000 users
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The users must not have more than 10000 items.
        '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: >-
                      Knot Zero is not enabled. Please contact Knot for access
                      to this endpoint.
        '429':
          description: Too many requests. Limited to 10 requests per minute per client.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                RateLimited:
                  summary: Rate limited
                  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.
                    retry_after: 42
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
            - WEBHOOK_ENDPOINT_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
            - CANCELLABLE_SUBSCRIPTION_NOT_FOUND
            - MULTIPLE_CANCELLABLE_SUBSCRIPTIONS_FOUND
            - ONGOING_OPERATION
            - CART_NOT_FOUND
            - FULFILLMENT_NOT_FOUND
            - INVALID_ACCESS_TOKEN
            - INSUFFICIENT_SCOPE
            - INSUFFICIENT_ROLE
            - WEBHOOK_ENDPOINT_NOT_FOUND
            - WEBHOOK_ENDPOINT_LIMIT_REACHED
            - WEBHOOK_ENDPOINT_ALREADY_EXISTS
            - RATE_LIMIT_EXCEEDED
            - ENVIRONMENT_MISMATCH
          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.

````

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