{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-products/whatsapp/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Send an OTP message","description":"Integration and usage documentation.","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"send-an-otp-message","__idx":0},"children":["Send an OTP message"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this endpoint to send a one-time password (OTP) via WhatsApp using a pre-approved ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["authentication template"]},".",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"Before making requests, ensure you have configured ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/products/whatsapp/enterprise-documentation/developer-documentation/authentication"},"children":["authentication"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the full technical reference, see the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/products/whatsapp/openapi/services/sendwhatsappotp"},"children":["OpenAPI specification"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"endpoint","__idx":1},"children":["Endpoint"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"POST /api/services/send-otp\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"headers","__idx":2},"children":["Headers"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required"},"children":["Required"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Basic Auth credentials. See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/products/whatsapp/enterprise-documentation/developer-documentation/authentication"},"children":["Authentication"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-Api-Key"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["API key for the account. See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/products/whatsapp/enterprise-documentation/developer-documentation/authentication"},"children":["Authentication"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Type"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Must be ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/json"]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Authentication templates"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Authentication templates use WhatsApp's preset message text: ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<VERIFICATION_CODE> is your verification code."]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"The OTP code you provide replaces ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<VERIFICATION_CODE>"]},". Parameters are limited to 15 characters.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/products/whatsapp/enterprise-documentation/developer-documentation/integration-guide/authentication-templates"},"children":["Authentication templates"]}," for details on components and button behavior."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"body-parameters","__idx":3},"children":["Body parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required"},"children":["Required"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["to"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Destination phone number in E.164 format (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["+390000000000"]},")"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["language"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Template language code (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["it"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["en"]},"). See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#supported-languages"},"children":["supported languages"]},". Falls back to the template's default language if not found."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["templateId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The authentication template ID to use"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["otp"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The OTP code to send (max 15 characters, e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"123456\""]},")"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reference"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["object"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Tracking information: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["service"]}," (optional), ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["action"]}," (optional), ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["key"]}," (optional)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lra"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Local Registration Authority (LRA) identifier"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["businessRelationId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["One Platform Business Relation ID. If specified, consumption is attributed to this BRI."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"request-example","__idx":4},"children":["Request example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"to\": \"+390000000000\",\n  \"language\": \"it\",\n  \"templateId\": 1,\n  \"otp\": \"123456\",\n  \"reference\": {\n    \"service\": \"DIGITALSIGN\",\n    \"action\": \"2FA\",\n    \"key\": \"ext-key-002\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-examples","__idx":5},"children":["Response examples"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["200 — Message sent"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"messageId\": \"3425151601\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["messageId"]}," uniquely identifies the sent message and can be used to track its delivery status."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"error-codes","__idx":6},"children":["Error codes"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"HTTP Status"},"children":["HTTP Status"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Error code"},"children":["Error code"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Error type"},"children":["Error type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Solution"},"children":["Solution"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["3"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ConstraintViolationException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Check the request parameters against the API documentation"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["7"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["InvalidTemplateException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The specified ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["templateId"]}," does not exist or is not available for your account"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["8"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WrongNumberException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Verify the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["to"]}," number is in valid E.164 format"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For authentication errors (code 1, 6, 9), see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/products/whatsapp/enterprise-documentation/developer-documentation/authentication"},"children":["Authentication"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"faq","__idx":7},"children":["FAQ"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":5,"id":"what-happens-if-the-language-does-not-exist-for-a-templateid-","__idx":8},"children":["What happens if the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["language"]}," does not exist for a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["templateId"]},"?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each template has a default language defined in its configuration. If the language specified in the request does not exist for the given ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["templateId"]},", the API automatically falls back to the template's default language."]}]},"headings":[{"value":"Send an OTP message","id":"send-an-otp-message","depth":1},{"value":"Endpoint","id":"endpoint","depth":4},{"value":"Headers","id":"headers","depth":4},{"value":"Body parameters","id":"body-parameters","depth":4},{"value":"Request example","id":"request-example","depth":4},{"value":"Response examples","id":"response-examples","depth":4},{"value":"Error codes","id":"error-codes","depth":4},{"value":"FAQ","id":"faq","depth":4},{"value":"What happens if the language does not exist for a templateId ?","id":"what-happens-if-the-language-does-not-exist-for-a-templateid-","depth":5}],"frontmatter":{"seo":{"title":"Send an OTP message"}},"lastModified":"2026-03-12T17:07:43.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/whatsapp/enterprise-documentation/developer-documentation/api-references/send-message-apis/send-otp","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}