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

# Request - Link

> Generate authentication links globally with randomized channel selection for initiating WhatsApp chats and callback verification using Global Token.

## Overview

This endpoint allows you to request a one-time password (OTP) link for global use. The OTP link can be used for authentication or verification purposes.

## Request Parameters

<ParamField body="contact_id" type="string" required>
  The contact ID to send the OTP link to. Format: `xxx@c.us`
</ParamField>

<ParamField body="expires" type="number" required>
  Expiration time in seconds. For example, 1800 seconds (30 minutes).
</ParamField>

<ParamField body="name" type="string">
  Application name that will be displayed to the user.
</ParamField>

<ParamField body="message" type="object">
  <Expandable title="Message Object">
    <ParamField body="prompt" type="string" required>
      Prompt message to channel from user. Example: "Give me link to login at TARGET App"
    </ParamField>

    <ParamField body="success" type="string" required>
      Success message to user. Example: "Here is your login link bit.ly/any"
    </ParamField>

    <ParamField body="failed" type="string" required>
      Failed message to user. Example: "Login failed, please try again later."
    </ParamField>

    <ParamField body="expired" type="string" required>
      Message to user when the OTP has expired. Example: "The link has been expired, please try another one."
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="callback" type="object">
  <Expandable title="Callback Object">
    <ParamField body="success" type="string" format="uri" required>
      Callback URL for successful verification (GET Method). Example: "[https://domain.com/callback/success](https://domain.com/callback/success)"
    </ParamField>

    <ParamField body="failed" type="string" format="uri" required>
      Callback URL for failed verification (GET Method). Example: "[https://domain.com/callback/failed](https://domain.com/callback/failed)"
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates whether the request was successful.
</ResponseField>

<ResponseField name="message" type="string">
  A message describing the result of the operation.
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="Data Object">
    <ResponseField name="id" type="string">
      The ID of the message.
    </ResponseField>

    <ResponseField name="code" type="string">
      The OTP code sent to the phone.
    </ResponseField>

    <ResponseField name="contact_id" type="string">
      The contact ID.
    </ResponseField>

    <ResponseField name="link" type="string">
      The message link.
    </ResponseField>

    <ResponseField name="app_uri" type="string">
      The app URL (open).
    </ResponseField>

    <ResponseField name="expired_at" type="string">
      The time when the code expires.
    </ResponseField>

    <ResponseField name="timestamp" type="string">
      The timestamp when it was triggered.
    </ResponseField>
  </Expandable>
</ResponseField>

## Error Codes

<ResponseField name="403" type="object">
  Authorization Exception - Occurs when the request is not properly authorized.
</ResponseField>

<ResponseField name="422" type="object">
  Validation Exception - Occurs when the request parameters fail validation.
</ResponseField>


## OpenAPI

````yaml POST /otp/link/global
openapi: 3.1.0
info:
  title: CrunchzApp API Docs
  version: 1.0.0
  description: >-
    Comprehensive WhatsApp API for seamless messaging integration, automation,
    and customer communication in your applications.
servers:
  - url: https://api.crunchz.app/api
security:
  - http: []
paths:
  /otp/link/global:
    post:
      tags:
        - OTP Link
        - OtpLink
      description: >-
        Generate authentication links globally with randomized channel selection
        for initiating WhatsApp chats and callback verification using Global
        Token.
      operationId: otpLink.globalRequestLink
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreOtpLinkRequest'
      responses:
        '200':
          description: '`OtpLinkResource`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OtpLinkResource'
        '400':
          $ref: '#/components/responses/BadRequestException'
        '401':
          $ref: '#/components/responses/UnauthorizedException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '500':
          $ref: '#/components/responses/InternalServerErrorException'
components:
  schemas:
    StoreOtpLinkRequest:
      type: object
      properties:
        contact_id:
          type: string
          description: Contact ID .
          example: xxx@c.us
        expires:
          type: number
          description: Expire time in second ( e.g 30 Minute )
          example: 1800
        name:
          type:
            - string
            - 'null'
          description: Application Name.
          example: Your Company Name
        message:
          type: object
          properties:
            prompt:
              type: string
              description: Prompt message to channel from user.
              example: Give me link to login at TARGET App
            success:
              type: string
              description: Success message to user.
              example: Here is your login link bit.ly/any
            failed:
              type: string
              description: Failed message to user.
              example: Login failed, please try again later.
            expired:
              type: string
              description: Message to user when the OTP has expired.
              example: The link has been expired, please try another one.
          required:
            - prompt
            - success
            - failed
            - expired
        callback:
          type: object
          properties:
            success:
              type: string
              format: uri
              description: Callback success (GET Method).
              example: https://domain.com/callback/success
            failed:
              type: string
              format: uri
              description: Callback failed (GET Method).
              example: https://domain.com/callback/failed
          required:
            - success
            - failed
      required:
        - contact_id
        - expires
      title: StoreOtpLinkRequest
    OtpLinkResource:
      type: object
      properties:
        success:
          type: boolean
          description: The success status of response.
        message:
          type: string
          description: The message of response.
        data:
          type: object
          properties:
            id:
              type: string
              description: The ID of the message.
            code:
              type: string
              description: The otp code sent to phone.
            contact_id:
              type: string
              description: The contact id.
            link:
              type: string
              description: The message link.
            app_uri:
              type: string
              description: The app url (open).
            expired_at:
              type: string
              description: The time when the code is expired.
            timestamp:
              type: string
              description: The timestamp when it triggered.
          required:
            - id
            - code
            - contact_id
            - link
            - app_uri
            - expired_at
            - timestamp
      required:
        - success
        - message
        - data
      title: OtpLinkResource
  responses:
    BadRequestException:
      description: Bad request error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    UnauthorizedException:
      description: Unauthorized error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
    InternalServerErrorException:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
  securitySchemes:
    http:
      type: http
      scheme: bearer
      bearerFormat: JWT

````