{"templateId":"markdown","versions":[{"version":"1.0","label":"1.0","link":"/docs/numbers/sdk/java/1.0/syntax-reference","default":false,"active":true,"folderId":"951f83c6"},{"version":"2.0","label":"2.0","link":"/docs/numbers/sdk/java/syntax-reference","default":true,"active":false,"folderId":"951f83c6"}],"sharedDataIds":{"sidebar":"sidebar-docs/numbers/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["partial","admonition"]},"product":"Numbers","type":"markdown"},"seo":{"title":"Java SDK Reference | Numbers 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 Numbers API."},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"sinch-java-sdk-for-numbers","__idx":0},"children":["Sinch Java SDK for Numbers"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sinch Java SDK allows you to quickly interact with the ","Numbers API"," from inside your Java applications. When using the Java SDK, the code representing requests and queries sent to and responses received from the ","Numbers API"," are structured similarly to those that are sent and received using the ","Numbers 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/numbers/getting-started/"},"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":"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":["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/numbers/package-summary.html"},"children":["here"]},"."]}]},{"$$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 Numbers API, including any differences that may exist between the API itself and the SDK. For a full reference on Numbers API calls and responses, see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers"},"children":["Numbers API Reference"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This code sample is an example of how to use the Java SDK to list the available numbers of a given type and region. 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/numbers/search-available.sample.java","language":"java","title":"Snippet.java","header":{"title":"Snippet.java","controls":{"copy":{}}},"lang":"java","source":"// This code returns a list of all the available numbers for a given set of search criteria. \n/**\n * Sinch Java Snippet\n *\n * <p>This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n * <p>See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage numbers;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.numbers.api.v1.NumbersService;\nimport com.sinch.sdk.domains.numbers.models.v1.NumberType;\nimport com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters;\nimport com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse;\nimport com.sinch.sdk.models.Configuration;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class SearchForAvailableNumbers {\n\n  private static final Logger LOGGER = Logger.getLogger(SearchForAvailableNumbers.class.getName());\n\n  public static void main(String[] args) {\n\n    String projectId = Settings.getProjectId().orElse(\"MY_PROJECT_ID\");\n    String keyId = Settings.getKeyId().orElse(\"MY_KEY_ID\");\n    String keySecret = Settings.getKeySecret().orElse(\"MY_KEY_SECRET\");\n\n    // ISO 3166-1 alpha-2 country code of the phone number. e.g. \"US\", \"GB\", \"SE\"...\n    // See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for details\n    String regionCode = \"MY_REGION_CODE\";\n    NumberType type = NumberType.LOCAL;\n\n    Configuration configuration =\n        Configuration.builder()\n            .setProjectId(projectId)\n            .setKeyId(keyId)\n            .setKeySecret(keySecret)\n            .build();\n\n    SinchClient client = new SinchClient(configuration);\n\n    NumbersService numbersService = client.numbers().v1();\n\n    AvailableNumbersListQueryParameters parameters =\n        AvailableNumbersListQueryParameters.builder()\n            .setRegionCode(regionCode)\n            .setType(type)\n            .build();\n\n    LOGGER.info(\"Looking for available numbers\");\n\n    AvailableNumberListResponse response = numbersService.searchForAvailableNumbers(parameters);\n\n    response\n        .iterator()\n        .forEachRemaining(\n            number -> LOGGER.info(String.format(\"Available number details: %s\", number)));\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":"\nimport java.net.*;\nimport java.net.http.*;\nimport java.util.*;\n\npublic class App {\n  public static void main(String[] args) throws Exception {\n    var httpClient = HttpClient.newBuilder().build();\n\n    var host = \"https://numbers.api.sinch.com\";\n    var projectId = \"YOUR_projectId\";\n    var pathname = \"/v1/projects/\" + projectId + \"/availableNumbers\";\n    var request = HttpRequest.newBuilder()\n      .GET()\n      .uri(URI.create(host + pathname ))\n      .header(\"Authorization\", \"Basic \" + Base64.getEncoder().encodeToString((\"YOUR_username:YOUR_password\").getBytes()))\n      .build();\n\n    var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());\n\n    System.out.println(response.body());\n  }\n}\n","lang":"java"},"children":[]}]}]},{"$$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 successfully initialize the Sinch client class, you must provide a valid access key ID and access key secret combination. You must also provide your Project ID. For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"\npackage numbers.sdk;\n\nimport com.sinch.sdk.SinchClient;\n\npublic class App {\n    \n    public static String access_key = \"YOUR_access_key\";\n    public static String access_secret = \"YOUR_access_secret\";\n    public static String project_id = \"YOUR_project_id\"\n\n    public static void main(String[] args) {\n        \n      SinchClient client = new SinchClient(Configuration.builder()\n                                  .setKeyId(access_key)\n                                  .setKeySecret(access_secret)\n                                  .setProjectId(project_id)\n                                  .build());\n}\n\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"numbers-domain","__idx":4},"children":["Numbers 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.numbers().v1().[endpoint_category()].[method()]"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"endpoint-categories","__idx":5},"children":["Endpoint categories"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the Sinch Java SDK, Numbers API endpoints are accessible through the client:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1().regions()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1().callbackConfiguration()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1().webhooks()"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var numbers = client.numbers().v1().list(AvailableNumberListRequest.builder()\n                                                                .setType(NumberType.LOCAL)\n                                                                .setRegionCode(\"US\")\n                                                                .build());\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The field mappings are described in the sections below."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"numbersv1-endpoint-category","__idx":6},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1()"]}," endpoint category"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1()"]}," category of the Java SDK has methods that correspond to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/available-number/"},"children":["available"]}," and ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/active-number/"},"children":["active"]}," endpoints. The mapping between the API operations and corresponding Java methods are described below, as well as links to the JavaDocs page:"]},{"$$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"},"children":["JavaDocs"]}]}]},{"$$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/numbers/api-reference/numbers/available-number/numberservice_rentnumber"},"children":["Activate a new phone number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rent()"]}]},{"$$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/numbers/api/v1/NumbersService.html#rent(java.lang.String,com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest)"},"children":["rent"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/available-number/numberservice_listavailablenumbers"},"children":["Search for available phone numbers"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["searchForAvailableNumbers()"]}]},{"$$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/numbers/api/v1/NumbersService.html#searchForAvailableNumbers(com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest)"},"children":["searchForAvailableNumbers"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/available-number/numberservice_getavailablenumber"},"children":["Check availability of a specific number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkAvailability()"]}]},{"$$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/numbers/api/v1/NumbersService.html#checkAvailability(java.lang.String)"},"children":["checkAvailability"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/available-number/numberservice_rentanynumber"},"children":["Rent any available number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rentAny()"]}]},{"$$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/numbers/api/v1/NumbersService.html#rentAny(com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest)"},"children":["rentAny"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/active-number/numberservice_listactivenumbers"},"children":["List active numbers for a project"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["list()"]}]},{"$$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/numbers/api/v1/NumbersService.html#list(com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest)"},"children":["list"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/active-number/numberservice_updateactivenumber"},"children":["Update active number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["update()"]}]},{"$$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/numbers/api/v1/NumbersService.html#update(java.lang.String,com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest)"},"children":["update"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/active-number/numberservice_getactivenumber"},"children":["Retrieve active number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["get()"]}]},{"$$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/numbers/api/v1/NumbersService.html#get(java.lang.String)"},"children":["get"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/active-number/numberservice_releasenumber"},"children":["Release active number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["release()"]}]},{"$$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/numbers/api/v1/NumbersService.html#release(java.lang.String)"},"children":["release"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"numbersv1regions-endpoint-category","__idx":7},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1().regions()"]}," endpoint category"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1().regions()"]}," category of the Java SDK corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/available-regions/"},"children":["availableRegions"]}," endpoint. The mapping between the API operation and corresponding Java method are described below, as well as links to the JavaDocs page:"]},{"$$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"},"children":["JavaDocs"]}]}]},{"$$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/numbers/api-reference/numbers/available-regions/"},"children":["List available regions"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["list()"]}]},{"$$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/numbers/api/v1/AvailableRegionService.html#list(com.sinch.sdk.domains.numbers.models.v1.regions.available.request.AvailableRegionListRequest)"},"children":["list"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"numbersv1callbackconfiguration-endpoint-category","__idx":8},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1().callbackConfiguration()"]}," endpoint category"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1().callbackConfiguration()"]}," category of the Java SDK corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/numbers-callbacks/"},"children":["callbackConfiguration"]}," endpoint. The mapping between the API operations and corresponding Java methods are described below, as well as links to the JavaDocs page:"]},{"$$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"},"children":["JavaDocs"]}]}]},{"$$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/numbers/api-reference/numbers/numbers-callbacks/getcallbackconfiguration"},"children":["Get callbacks configuration"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["get()"]}]},{"$$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/numbers/api/v1/CallbackConfigurationService.html#get()"},"children":["get"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/numbers-callbacks/updatecallbackconfiguration"},"children":["Update callback configuration"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["update()"]}]},{"$$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/numbers/api/v1/CallbackConfigurationService.html#update(com.sinch.sdk.domains.numbers.models.v1.callbacks.request.CallbackConfigurationUpdateRequest)"},"children":["update"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"numbersv1webhooks-endpoint-category","__idx":9},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1().webhooks()"]}," endpoint category"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numbers().v1().webhooks()"]}," category of the Java SDK corresponds to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/numbers/api-reference/numbers/numbers-callbacks/numberservice_eventscallback"},"children":["Event notification"]}," operation. The mapping between the API operation and corresponding Java method are described below, as well as links to the JavaDocs page:"]},{"$$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"},"children":["JavaDocs"]}]}]},{"$$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/numbers/api-reference/numbers/numbers-callbacks/numberservice_eventscallback"},"children":["Event notification"]}]},{"$$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/numbers/api/v1/WebHooksService.html#parseEvent(java.lang.String)"},"children":["parseEvent"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"request-and-query-parameters","__idx":10},"children":["Request and query parameters"]},{"$$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 an SMS API message 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":"NumberType.MOBILE\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":"\"type\": \"MOBILE\"\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":"Heading","attributes":{"level":2,"id":"nested-objects","__idx":11},"children":["Nested objects"]},{"$$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 SMS 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":"AvailableNumberListRequest.builder()\n                        .setType(NumberType.LOCAL)\n                        .setRegionCode(\"US\")\n                        .build()\n","lang":"Java"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"type\": \"LOCAL\",\n  \"regionCode\": \"US\"\n}\n","lang":"JSON"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Note that in the Java SDK you would use a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder()"]}," method to construct the appropriate data model in the correct structure."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"responses","__idx":12},"children":["Responses"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response fields match the API responses. They are delivered as Java objects."]}]},"headings":[{"value":"Sinch Java SDK for Numbers","id":"sinch-java-sdk-for-numbers","depth":1},{"value":"Syntax","id":"syntax","depth":2},{"value":"Client","id":"client","depth":2},{"value":"Initialization","id":"initialization","depth":3},{"value":"Numbers domain","id":"numbers-domain","depth":2},{"value":"Endpoint categories","id":"endpoint-categories","depth":2},{"value":"numbers().v1() endpoint category","id":"numbersv1-endpoint-category","depth":3},{"value":"numbers().v1().regions() endpoint category","id":"numbersv1regions-endpoint-category","depth":3},{"value":"numbers().v1().callbackConfiguration() endpoint category","id":"numbersv1callbackconfiguration-endpoint-category","depth":3},{"value":"numbers().v1().webhooks() endpoint category","id":"numbersv1webhooks-endpoint-category","depth":3},{"value":"Request and query parameters","id":"request-and-query-parameters","depth":2},{"value":"Nested objects","id":"nested-objects","depth":2},{"value":"Responses","id":"responses","depth":2}],"frontmatter":{"seo":{"title":"Java SDK Reference | Numbers API | Sinch","description":"Learn the syntax of the Sinch Java SDK for Numbers API."},"product":"Numbers API"},"lastModified":"2026-03-24T21:51:31.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/numbers/sdk/java/1.0/syntax-reference","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}