{"templateId":"markdown","versions":[{"version":"1.0","label":"1.0","link":"/docs/verification/sdk/java/1.0/syntax-reference","default":false,"active":true,"folderId":"9f3494c8"},{"version":"2.0","label":"2.0","link":"/docs/verification/sdk/java/syntax-reference","default":true,"active":false,"folderId":"9f3494c8"}],"sharedDataIds":{"sidebar":"sidebar-docs/verification/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["partial","admonition"]},"product":"Verification","type":"markdown"},"seo":{"title":"Java SDK Reference | Verification API | Sinch","siteUrl":"https://developers.sinch.com","llmstxt":{"title":"Sinch Developer Documentation","description":"LLMs.txt containing a map of all the documentation files for Sinch.","sections":[{"title":"Numbers API","description":"The Numbers API enables you to search for, view, and activate numbers. It's considered a precursor to other APIs in the Sinch product family. The numbers API can be used in tandem with any of our APIs that perform messaging or calling.","includeFiles":["docs/numbers/**/*.md","docs/numbers/**/*.yaml"],"excludeFiles":["docs/numbers/index.md"]},{"title":"Conversation API","description":"Send and receive messages globally on many popular channels with ease and confidence when using Sinch's Conversation API. Conversation API is the preferred API for sending mobile messages on SMS and other social channels with Sinch. It is a simple API with unified error messages, consistent request payloads, and common webhook payloads that are channel-agnostic.","includeFiles":["docs/conversation/**/*.md","docs/conversation/**/*.yaml"],"excludeFiles":["docs/conversation/index.md"]},{"title":"Voice API","description":"The Voice API works as a big telephony switch. The Voice API handles incoming phone calls (also known as incoming call “legs”), sets up outgoing phone calls (or outgoing call “legs”), and bridges the two. The incoming call leg may come in over a data connection (from a smartphone or web application using the Sinch SDKs) or through a local phone number (from the PSTN network). Similarly, the outgoing call leg can be over data (to another smartphone or web application using the Sinch SDKs) or the PSTN network.","includeFiles":["docs/voice/**/*.md","docs/voice/**/*.yaml"],"excludeFiles":["docs/voice/index.md"]},{"title":"Verification API","description":"The Verification API is a platform for phone number verification. It consists of the API and different software development kits (the Sinch SDKs) that you integrate with your smartphone or web application and cloud based back-end services. Together they enable SMS, Flashcall, Phone Call and Data verification in your application.","includeFiles":["docs/verification/**/*.md","docs/verification/**/*.yaml"],"excludeFiles":["docs/verification/index.md"]},{"title":"Provisioning API","description":"Provisioning API allows you to programmatically set up your senders, accounts and templates on your favorite messaging platforms on the Conversation API. For now, you can create your first WhatsApp channel through Meta's Embedded sign up, you can configure your first SMS App and configure your webhooks. As development continues, we will be adding the most commonly used channels.","includeFiles":["docs/provisioning-api/**/*.md","docs/provisioning-api/**/*.json"],"excludeFiles":["docs/provisioning-api/index.md"]},{"title":"Elastic SIP Trunking API","description":"With Elastic SIP Trunking you can create and manage your SIP trunks and phone numbers programmatically.","includeFiles":["docs/est/**/*.md","docs/est/**/*.yaml"],"excludeFiles":["docs/est/index.md"]},{"title":"Fax API","description":"Send and receive HIPAA compliant faxes on our modern fax platform using our developer-friendly API.","includeFiles":["docs/fax/**/*.md","docs/fax/**/*.yaml"],"excludeFiles":["docs/fax/index.md"]},{"title":"In-app Voice and Video SDK","description":"The In-app Voice and Video SDK enables you to add voice and video calling capabilities directly into your mobile or web application using the Sinch SDKs.","includeFiles":["docs/in-app-calling/**/*.md"],"excludeFiles":["docs/in-app-calling/index.md"]},{"title":"Number Lookup API","description":"The Number Lookup API is designed to provide in-depth information about phone numbers, helping enterprises enhance their communication strategies and prevent fraud. By identifying the type of phone line (for example, mobile, landline, VoIP) and the associated carrier, the API allows businesses to optimize routing, reduce unnecessary costs, and improve customer engagement.","includeFiles":["docs/number-lookup-api-v2/**/*.md","docs/number-lookup-api-v2/**/*.yaml"],"excludeFiles":["docs/number-lookup-api-v2/index.md"]},{"title":"Functions","description":"Serverless compute for voice and messaging. Deploy your code and Sinch routes live calls and messages to it — no infrastructure to run.","includeFiles":["docs/functions/functions/**/*.md","docs/functions/concepts/**/*.md","docs/functions/reference/**/*.md"],"excludeFiles":["docs/functions/functions/index.md"]},{"title":"CLI","description":"One command line for every Sinch API and the full Functions lifecycle — scaffold, run locally, deploy, and manage.","includeFiles":["docs/functions/cli/**/*.md"],"excludeFiles":["docs/functions/cli/index.md"]}]},"description":"Learn the syntax of the Sinch Java SDK for Verification API."},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"sinch-java-sdk-for-verification","__idx":0},"children":["Sinch Java SDK for Verification"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sinch Java SDK allows you to quickly interact with the ","Verification API"," from inside your Java applications. When using the Java SDK, the code representing requests and queries sent to and responses received from the ","Verification API"," are structured similarly to those that are sent and received using the ","Verification API","."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The fastest way to get started with the SDK is to check out our ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/getting-started/java-sdk/sms-verification"},"children":["getting started"]}," guides. There you'll find all the instructions necessary to download, install, set up, and start using the SDK."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note:"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also view the generated JavaDocs for the Java SDK ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/latest/com/sinch/sdk/domains/verification/api/v1/package-summary.html"},"children":["here"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"syntax","__idx":1},"children":["Syntax"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note:"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide describes the syntactical structure of the Java SDK for the Verification API, including any differences that may exist between the API itself and the SDK. For a full reference on Verification API calls and responses, see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification"},"children":["Verification API Reference"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The code sample below is an example of how to use the Java SDK to initiate an SMS PIN Verification. We've also provided an example that accomplishes the same task using the REST API."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"SDK","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"file":"/code-snippets/java-sdk/verification/VerificationSample.java","language":"java","title":"VerificationsSample.java","header":{"title":"VerificationsSample.java","controls":{"copy":{}}},"lang":"java","source":"package verification;\n\nimport com.sinch.sdk.core.exceptions.ApiException;\nimport com.sinch.sdk.core.utils.StringUtil;\nimport com.sinch.sdk.domains.verification.api.v1.*;\nimport com.sinch.sdk.domains.verification.models.v1.NumberIdentity;\nimport com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms;\nimport com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms;\nimport com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms;\nimport com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms;\nimport com.sinch.sdk.models.E164PhoneNumber;\nimport java.util.Scanner;\n\npublic class VerificationsSample {\n\n  private final VerificationService verificationService;\n\n  public VerificationsSample(VerificationService verificationService) {\n    this.verificationService = verificationService;\n  }\n\n  public void start() {\n\n    E164PhoneNumber e164Number = promptPhoneNumber();\n\n    try {\n      // Starting verification onto phone number\n      String id = startSmsVerification(verificationService.verificationStart(), e164Number);\n\n      // Ask user for received code\n      Integer code = promptSmsCode();\n\n      // Submit the verification report\n      reportSmsVerification(verificationService.verificationReport(), code, id);\n    } catch (ApiException e) {\n      echo(\"Error (%d): %s\", e.getCode(), e.getMessage());\n    }\n  }\n\n  /**\n   * Will start an SMS verification onto specified phone number\n   *\n   * @param service Verification Start service\n   * @param phoneNumber Destination phone number\n   * @return Verification ID\n   */\n  private String startSmsVerification(\n      VerificationsStartService service, E164PhoneNumber phoneNumber) {\n\n    echo(\"Sending verification request onto '%s'\", phoneNumber.stringValue());\n\n    VerificationStartRequestSms parameters =\n        VerificationStartRequestSms.builder()\n            .setIdentity(NumberIdentity.valueOf(phoneNumber))\n            .build();\n\n    VerificationStartResponseSms response = service.startSms(parameters);\n    echo(\"Verification started with ID '%s'\", response.getId());\n    return response.getId();\n  }\n\n  /**\n   * Will use Sinch product to retrieve verification report by ID\n   *\n   * @param service Verification Report service\n   * @param code Code received by SMS\n   * @param id Verification ID related to the verification\n   */\n  private void reportSmsVerification(VerificationsReportService service, Integer code, String id) {\n\n    VerificationReportRequestSms parameters =\n        VerificationReportRequestSms.builder().setCode(String.valueOf(code)).build();\n\n    echo(\"Requesting report for '%s'\", id);\n    VerificationReportResponseSms response = service.reportSmsById(id, parameters);\n    echo(\"Report response: %s\", response);\n  }\n\n  /**\n   * Prompt user for a valid phone number\n   *\n   * @return Phone number value\n   */\n  private E164PhoneNumber promptPhoneNumber() {\n    String input;\n    boolean valid;\n    do {\n      input = prompt(\"\\nEnter a phone number to start verification\");\n      valid = E164PhoneNumber.validate(input);\n      if (!valid) {\n        echo(\"Invalid number '%s'\", input);\n      }\n    } while (!valid);\n\n    return E164PhoneNumber.valueOf(input);\n  }\n\n  /**\n   * Prompt user for a SMS code\n   *\n   * @return Value entered by user\n   */\n  private Integer promptSmsCode() {\n    Integer code = null;\n    do {\n      String input = prompt(\"Enter the verification code to report the verification\");\n      try {\n        code = Integer.valueOf(input);\n      } catch (NumberFormatException nfe) {\n        echo(\"Invalid value '%s' (code should be numeric)\", input);\n      }\n\n    } while (null == code);\n    return code;\n  }\n\n  /**\n   * Endless loop for user input until a valid string is entered or 'Q' to quit\n   *\n   * @param prompt Prompt to be used task user a value\n   * @return The entered text from user\n   */\n  private String prompt(String prompt) {\n\n    String input = null;\n    Scanner scanner = new Scanner(System.in);\n\n    while (StringUtil.isEmpty(input)) {\n      System.out.println(prompt + \" ([Q] to quit): \");\n      input = scanner.nextLine();\n    }\n\n    if (\"Q\".equalsIgnoreCase(input)) {\n      System.out.println(\"Quit application\");\n      System.exit(0);\n    }\n    return input.trim();\n  }\n\n  private void echo(String text, Object... args) {\n    System.out.println(\"  \" + String.format(text, args));\n  }\n}\n"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"REST API","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"package app;\n\nimport java.io.IOException;\nimport java.net.*;\nimport java.net.http.*;\nimport java.util.*;\n\npublic class App {\n    \n    private static final String applicationKey = \"<REPLACE_WITH_VERIF_APP_KEY>\";\n    private static final String applicationSecret = \"<REPLACE_WITH_VERIF_APP_SECRET>\";\n    private static final String toNumber = \"<REPLACE_WITH_TO_NUMBER>\";\n    private static final String SINCH_URL = \"https://verification.api.sinch.com/verification/v1/verifications\";\n    public static final String JSON_CONTENT_TYPE = \"application/json; charset=utf-8\";\n    \n    public static void main(String[] args) throws Exception {\n        \n        HttpResponse<String> response = sendSMSPinWithBasicAuth();\n\n        System.out.println(response.body());\n    }\n\n    private static HttpResponse<String> sendSMSPinWithBasicAuth() throws IOException, InterruptedException {\n        var httpClient = HttpClient.newBuilder().build();\n\n        var payload = getSMSVerificationRequestBody();\n\n        var request = HttpRequest.newBuilder()\n                .POST(HttpRequest.BodyPublishers.ofString(payload))\n                .uri(URI.create(SINCH_URL))\n                .header(\"Content-Type\", JSON_CONTENT_TYPE)\n                .header(\"Authorization\", \"Basic \" + Base64.getEncoder().encodeToString((applicationKey + \":\" + applicationSecret).getBytes()))\n                .build();\n\n        return httpClient.send(request, HttpResponse.BodyHandlers.ofString());\n    }\n\n    private static String getSMSVerificationRequestBody() {\n        return \"\"\"\n            {\n                \"identity\": {\n                    \"type\": \"number\",\n                    \"endpoint\": \"%s\"\n                },\n                \"method\": \"sms\"\n            }\n            \"\"\".formatted(toNumber);\n    }\n}\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example highlights the following required to successfully make a Verification API call using the Sinch Java SDK:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#client"},"children":["Client initialization"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#verification-domain"},"children":["Verification domain"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#endpoint-categories"},"children":["Endpoint usage"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#request-and-query-parameters"},"children":["Field population"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"client","__idx":2},"children":["Client"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When using the Sinch Java SDK, you initialize communication with the Sinch backend by initializing the Java SDK's main client class. This client allows you to access the functionality of the Sinch Java SDK."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"initialization","__idx":3},"children":["Initialization"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To start using the SDK, you need to initialize the main client class and create a configuration object to connect to your Sinch account and Verification app. You can find all of the credentials you need on your Sinch ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/verification/apps"},"children":["dashboard"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"import com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.models.Configuration;\n\npublic class App {\n    \n    public static void main(String[] args) {\n        SinchClient client = new SinchClient(Configuration.builder()\n                                    .setApplicationKey(\"YOUR_application_key\")\n                                    .setApplicationSecret(\"YOUR_application_secret\")\n                                    .build());\n    }\n}\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For testing purposes on your local environment it's fine to use hardcoded values, but before deploying to production we strongly recommend using environment variables to store the credentials."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"verification-domain","__idx":4},"children":["Verification domain"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sinch Java SDK organizes different functionalities in the Sinch product suite into domains. These domains are accessible through the client. For example, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client.verification().v1().[endpoint_category()].[method()]"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the Sinch Java SDK, Verification API endpoints are accessible through the client. The naming convention of the endpoints represented in the SDK matches the API:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verification().v1().verificationStart()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verification().v1().verificationReport()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verification().v1().verificationStatus()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verification().v1().webhooks()"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var identity = NumberIdentity.valueOf(\"YOUR_phone_number\");\nvar response = client.verification().v1().verificationStart().startSms(VerificationStartRequestSms\n                                        .builder()\n                                        .setIdentity(identity)\n                                        .build());\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The field mappings are described in the sections below."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verification().v1().verificationStart()"]}," category of the Java SDK corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-start/"},"children":["verifications"]}," endpoint. The mapping between the API operations and corresponding Java methods are described below:"]},{"$$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":"API operation"},"children":["API operation"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK method"},"children":["SDK method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JavaDocs entry"},"children":["JavaDocs entry"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-start/startverification"},"children":["Start an SMS PIN verification request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startSms()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.html#startSms(com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms)"},"children":["startSms"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-start/startverification"},"children":["Start a Flash Call verification request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startFlashCall()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.html#startFlashCall(com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall)"},"children":["startFlashCall"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-start/startverification"},"children":["Start a Phone Call verification request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startPhoneCall()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.html#startPhoneCall(com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall)"},"children":["startPhoneCall"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-start/startverification"},"children":["Start a Data verification request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startData()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.html#startData(com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData)"},"children":["startData"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verification().v1().verificationReport()"]}," category of the Java SDK corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-report/"},"children":["verifications"]}," endpoint. The mapping between the API operations and corresponding Java methods are described below:"]},{"$$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":"API operation"},"children":["API operation"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK method"},"children":["SDK method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JavaDocs entry"},"children":["JavaDocs entry"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-report/reportverificationbyidentity"},"children":["Report an SMS PIN verification code by the identity of the recipient"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reportSmsByIdentity()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.html#reportSmsByIdentity(com.sinch.sdk.domains.verification.models.v1.NumberIdentity,com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms)"},"children":["reportSmsByIdentity"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-report/reportverificationbyid"},"children":["Report an SMS PIN verification code by the ID of the verification request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reportSmsById()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.html#reportSmsById(java.lang.String,com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms)"},"children":["reportSmsById"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-report/reportverificationbyidentity"},"children":["Report a Phone Call verification code by the identity of the recipient"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reportPhoneCallByIdentity()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.html#reportPhoneCallByIdentity(com.sinch.sdk.domains.verification.models.v1.NumberIdentity,com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall)"},"children":["reportPhoneCallByIdentity"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-report/reportverificationbyid"},"children":["Report a Phone Call verification code by the ID of the verification request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reportPhoneCallById()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.html#reportPhoneCallById(java.lang.String,com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall)"},"children":["reportPhoneCallById"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-report/reportverificationbyidentity"},"children":["Report a FlashCall verification code by the identity of the recipient"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reportFlashCallByIdentity()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.html#reportFlashCallByIdentity(com.sinch.sdk.domains.verification.models.v1.NumberIdentity,com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall)"},"children":["reportFlashCallByIdentity"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verifications-report/reportverificationbyid"},"children":["Report a FlashCall verification code by the ID of the verification request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reportFlashCallById()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.html#reportFlashCallById(java.lang.String,com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall)"},"children":["reportFlashCallById"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verification().v1().verificationStatus()"]}," category of the Java SDK corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verification-status/"},"children":["verifications"]}," endpoint. The mapping between the API operations and corresponding Java methods are described below:"]},{"$$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":"API operation"},"children":["API operation"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK method"},"children":["SDK method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JavaDocs entry"},"children":["JavaDocs entry"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verification-status/verificationstatusbyid"},"children":["Get the status of a verification by the ID of the verification request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["getById()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationStatusService.html#getById(java.lang.String)"},"children":["getById"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verification-status/verificationstatusbyidentity"},"children":["Get the status of a verification by the identity of the recipient"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["getByIdentity()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationStatusService.html#getByIdentity(com.sinch.sdk.domains.verification.models.v1.NumberIdentity,com.sinch.sdk.domains.verification.models.v1.VerificationMethod)"},"children":["getByIdentity"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verification-status/verificationstatusbyreference"},"children":["Get the status of a verification by a reference value"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["getByReference()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/VerificationStatusService.html#getByReference(java.lang.String)"},"children":["getByReference"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verification().v1().webhooks()"]}," category of the Java SDK corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verification-callbacks/"},"children":["callbacks"]}," section. The mapping between the API operations and corresponding Java methods are described below:"]},{"$$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":"API callback"},"children":["API callback"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"SDK method"},"children":["SDK method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JavaDocs entry"},"children":["JavaDocs entry"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent"},"children":["Validates if the authentication of the verification request matches"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["validateAuthenticatedRequest()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/WebHooksService.html#validateAuthenticationHeader(java.lang.String,java.lang.String,java.util.Map,java.lang.String)"},"children":["validateAuthenticationHeader"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent"},"children":["Serializes a verification response into a JSON string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["serializeResponse()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/WebHooksService.html#serializeResponse(com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse)"},"children":["serializeResponse"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent"},"children":["Deserializes a JSON response into the corresponding Verification event class"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parseEvent()"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-java/1.7.1/com/sinch/sdk/domains/verification/api/v1/WebHooksService.html#parseEvent(java.lang.String)"},"children":["parseEvent"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Requests and queries made using the Java SDK are similar to those made using the SMS API. Many of the fields are named and structured similarly. For example, consider the representations of a Verification method type. One field is represented in JSON, and the other is using our Java SDK:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"SDK","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"VerificationStartRequestSms\n","lang":"java"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"REST API","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"\"method\": \"sms\"\n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Many fields in the Java SDK are rendered as enums in data models."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When making calls directly to the API, we use JSON objects, including (in some cases) nested JSON objects. When using the Java SDK, we use Java data models instead of nested JSON objects. For example, consider the Verification configuration objects below. One is represented in JSON, the other as a Java object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"Java","header":{"controls":{"copy":{}}},"source":"VerificationStartRequestSms.builder()\n                                .setIdentity(NumberIdentity.builder()\n                                    .setEndpoint(\"YOUR_phone_number\")\n                                    .build())\n                                .build()\n","lang":"Java"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"method\": \"sms\",\n  \"identity\": {\n    \"type\": \"number\",\n    \"endpoint\": \"YOUR_phone_number\"\n  }\n}\n","lang":"JSON"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Note that in the Java SDK you would use a specific helper class for the type of Verification you want to send and a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder()"]}," method to construct the appropriate data model in the correct structure."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response fields match the API responses. They are delivered as Java objects."]}]},"headings":[{"value":"Sinch Java SDK for Verification","id":"sinch-java-sdk-for-verification","depth":1},{"value":"Syntax","id":"syntax","depth":2},{"value":"Client","id":"client","depth":2},{"value":"Initialization","id":"initialization","depth":3},{"value":"Verification domain","id":"verification-domain","depth":2}],"frontmatter":{"seo":{"title":"Java SDK Reference | Verification API | Sinch","description":"Learn the syntax of the Sinch Java SDK for Verification API."},"product":"Verification API"},"lastModified":"2026-03-24T21:51:31.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/verification/sdk/java/1.0/syntax-reference","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}