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

# OTP Generate

> Used to create and send one-time passwords (OTPs) to users for secure authentication.

## OpenAPI

````json POST /otp/generate
{
  "openapi": "3.1.0",
  "info": {
    "title": "external-api",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.eu.xtremepush.com/api/external"
    }
  ],
  "paths": {
    "/otp/generate": {
      "post": {
        "summary": "OTP Generate",
        "description": "Used to create and send one-time passwords (OTPs) to users for secure authentication.",
        "operationId": "otp-generate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "apptoken",
                  "service_id",
                  "id",
                  "id_type",
                  "send_by",
                  "mobile_number"
                ],
                "properties": {
                  "apptoken": {
                    "type": "string",
                    "description": "Your App token"
                  },
                  "service_id": {
                    "type": "string",
                    "description": "Represents the integration ID. The integration associated with this ID must be active"
                  },
                  "id": {
                    "type": "string",
                    "description": "Required if send_by is set to id. Identifier for the user profile."
                  },
                  "id_type": {
                    "type": "string",
                    "description": "Required if send_by is set to id. Type of the identifier provided in the id field."
                  },
                  "send_by": {
                    "type": "string",
                    "description": "Determines how the profile is identified for OTP delivery. Options: id or contact."
                  },
                  "mobile_number": {
                    "type": "string",
                    "description": "Required if send_by is set to contact. The mobile number to receive the OTP."
                  }
                }
              },
              "examples": {
                "Send OTP via SMS using a user ID": {
                  "value": {
                    "apptoken": "YOUR_APPTOKEN",
                    "service_id": "YOUR_SERVICE_ID",
                    "send_by": "id",
                    "id": "USER_ID",
                    "id_type": "user_id"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": "true",
                      "default": "true"
                    },
                    "code": {
                      "type": "integer",
                      "example": "200",
                      "default": "0"
                    },
                    "request_id": {
                      "type": "string",
                      "example": "123e4567-e89b-12d3-a456-426614174000"
                    },
                    "status": {
                      "type": "string",
                      "example": "success"
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "success": "true",
                      "code": "200",
                      "request_id": "123e4567-e89b-12d3-a456-426614174000",
                      "status": "success"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": "false",
                      "default": "true"
                    },
                    "code": {
                      "type": "integer",
                      "example": "400",
                      "default": "0"
                    },
                    "status": {
                      "type": "string",
                      "example": "failure"
                    },
                    "error": {
                      "type": "string",
                      "example": "Invalid mobile number format."
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "success": "false",
                      "code": "400",
                      "status": "failure",
                      "error": "Invalid mobile number format."
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "OTP Methods"
        ]
      }
    }
  }
}
````

