{"templateId":"../../../@theme/Templates/SideBySide.tsx","sharedDataIds":{"sidebar":"sidebar-docs/sdks/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["split","partial"]},"type":"markdown"},"seo":{"title":".NET SDK Reference Docs | 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":"Voice API v2","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-2.0/**/*.md","docs/voice-2.0/**/*.yaml"],"excludeFiles":["docs/voice-2.0/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":"See all versions of the Sinch .NET SDK reference documentation."},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Split","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"sinch-net-sdk","__idx":0},"children":["Sinch .NET SDK"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dotnet.microsoft.com/en-us/download/dotnet/6.0"},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"https://img.shields.io/badge/.NET-6.0-blue.svg","alt":".NET 6.0"},"children":[]}]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dotnet.microsoft.com/en-us/download/dotnet/7.0"},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"https://img.shields.io/badge/.NET-7.0-blue.svg","alt":".NET 7.0"},"children":[]}]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dotnet.microsoft.com/en-us/download/dotnet/8.0"},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"https://img.shields.io/badge/.NET-8.0-blue.svg","alt":".NET 8.0"},"children":[]}]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.nuget.org/packages/Sinch"},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"https://img.shields.io/nuget/v/Sinch.svg","alt":"NuGet"},"children":[]}]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/blob/main/LICENSE"},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"https://img.shields.io/badge/License-Apache_2.0-blue.svg","alt":"License"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here you'll find documentation related to the Sinch .NET SDK, including how to install it, initialize it, and start developing .NET code using Sinch services."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To use Sinch services, you'll need a Sinch account and access keys. You can sign up for an account and create access keys at ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com"},"children":["dashboard.sinch.com"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"table-of-contents","__idx":1},"children":["Table of contents"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#prerequisites"},"children":["Prerequisites"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#version-support"},"children":["Version support"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#documentation"},"children":["Documentation"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#installation"},"children":["Installation"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#supported-apis"},"children":["Supported APIs"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#getting-started"},"children":["Getting started"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#logging"},"children":["Logging"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#handling-exceptions"},"children":["Handling exceptions"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#custom-http-client-implementation"},"children":["Custom HTTP client implementation"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#third-party-dependencies"},"children":["Third-party dependencies"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#examples"},"children":["Examples"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#changelog--migration"},"children":["Changelog & Migration"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#license"},"children":["License"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#contact"},"children":["Contact"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":2},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dotnet.microsoft.com/en-us/download/dotnet/6.0"},"children":[".NET 6.0"]},", ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dotnet.microsoft.com/en-us/download/dotnet/7.0"},"children":[".NET 7.0"]},", or ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dotnet.microsoft.com/en-us/download/dotnet/8.0"},"children":[".NET 8.0"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.nuget.org/"},"children":["NuGet"]}," or the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dotnet"]}," CLI"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/"},"children":["Sinch account"]}]}]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Warning"]},": This SDK is intended for server-side (backend) use only. Do not use it in front-end or client-side applications (web, mobile, or desktop), regardless of language or framework. Doing so can expose your Sinch credentials to end-users."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"version-support","__idx":3},"children":["Version support"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This SDK follows ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://semver.org/"},"children":["Semantic Versioning"]}," for version numbering."," ","SemVer defines what changes are allowed in each type of release (major, minor, patch) but does not define a support or patching policy."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This section describes the support policy for this project."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Release cadence"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A new major version will not be released until at least 6 months after the previous major version."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Support policy"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Patches are published only for the latest minor release within each supported major version. For example: if version 2.0 exists and 2.1.0 is released, patches will be applied to 2.1.x only. Users on 2.0.x will no longer receive patches and must upgrade to 2.1.x to get bug fixes and security updates."]},{"$$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":"Version"},"children":["Version"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Status"},"children":["Status"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Support"},"children":["Support"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Timeline"},"children":["Timeline"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Current major"]}," (latest released)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fully supported"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["All new features, bug fixes, and security fixes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Ongoing"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Previous major"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Maintenance"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Critical bug fixes and security fixes only, no new features"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Begins when current major is released; ends when next major is released or 1 year from current release, whichever comes first"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Older majors"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["End-of-Life (EOL)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No patches or support"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["—"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["What are critical bug fixes?"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the previous major version, we apply patches for:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Security vulnerabilities"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Data loss risks"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Breaking compatibility issues"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["If you're using an unsupported version"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We recommend upgrading to a supported version to receive ongoing security and stability updates. Bug reports against unsupported versions are not prioritized and may not be addressed."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Dependency security updates"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We assess dependency vulnerabilities by severity level. High and Critical vulnerabilities (CVSS score ≥ 7.0) are backported to the latest minor release of both the current and previous major versions. Medium and Low severity vulnerabilities (CVSS < 7.0) are applied to the current major version only."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"documentation","__idx":4},"children":["Documentation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information on the SDK, refer to the dedicated ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/docs/sdks/dotnet"},"children":[".NET SDK documentation"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the SDK's programmatic API surface, see the online ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-dotnet/latest"},"children":["SDK reference"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For broader Sinch product documentation, including the underlying REST APIs, visit the official ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/"},"children":["Sinch developer portal"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"installation","__idx":5},"children":["Installation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Run the following command to install the SDK:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"dotnet add package Sinch\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"supported-apis","__idx":6},"children":["Supported APIs"]},{"$$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 Category"},"children":["API Category"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API Name"},"children":["API Name"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Messaging"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/docs/conversation/"},"children":["Conversation API"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/docs/sms/"},"children":["SMS API"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Voice and Video"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/docs/voice/"},"children":["Voice API"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Numbers"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/docs/numbers/"},"children":["Numbers API"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Verification"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/docs/verification/"},"children":["Verification API"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fax"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/docs/fax/"},"children":["Fax API"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," The SMS API is end-of-sale. New integrations should use the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/docs/conversation/"},"children":["Conversation API"]}," instead, which supports SMS and many other channels."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"getting-started","__idx":7},"children":["Getting started"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"client-initialization","__idx":8},"children":["Client initialization"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To start using the SDK, initialize the main client class. This client gives you access to all the SDK services:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch;\n\n// Warning: not all APIs support project authentication. Check the section for each API before using this snippet.\n\nvar sinch = new SinchClient(\n    \"SINCH_PROJECT_ID\",\n    \"SINCH_KEY_ID\",\n    \"SINCH_KEY_SECRET\");\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SINCH_PROJECT_ID"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SINCH_KEY_ID"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SINCH_KEY_SECRET"]}," from the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/settings/access-keys"},"children":["Access keys"]}," page in your Sinch dashboard (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SINCH_KEY_SECRET"]}," is shown only once, at creation time). It's highly recommended to not hardcode these credentials: load them from environment variables for local development, and from a secret manager in production."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This snippet is the common starting point for project-based APIs. Some APIs need a different initialization or extra parameters (for example, a region or application credentials), see the section for each API below."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With ASP.NET dependency injection:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"// SinchClient is thread safe so it's okay to add it as a singleton\nbuilder.Services.AddSingleton<ISinchClient>(_ => new SinchClient(\n    builder.Configuration[\"Sinch:ProjectId\"],\n    builder.Configuration[\"Sinch:KeyId\"],\n    builder.Configuration[\"Sinch:KeySecret\"]));\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"conversation-api","__idx":9},"children":["Conversation API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Conversation API is regionalized. To use this API, the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["conversation_region"]}," parameter is required:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch;\nusing Sinch.Conversation;\n\nvar sinch = new SinchClient(\n    \"SINCH_PROJECT_ID\",\n    \"SINCH_KEY_ID\",\n    \"SINCH_KEY_SECRET\",\n    options =>\n    {\n        options.ConversationRegion = ConversationRegion.Eu;\n    });\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sinch-events","__idx":10},"children":["Sinch Events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Conversation API delivers asynchronous Sinch Events to the Event Destination URL you configure for your app in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/convapi/apps"},"children":["Conversation dashboard"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ValidateAuthenticationHeader"]}," confirms a request comes from Sinch and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ParseEvent"]}," turns its payload into a typed event object; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["headers"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["body"]}," are the incoming request's headers and raw body:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using System.Text.Json.Nodes;\nusing Sinch.Conversation.Hooks;\n\nvar headers = Request.Headers.ToDictionary(h => h.Key, h => h.Value);\nvar body = /* raw JSON body as JsonNode */;\n\nbool validAuth = sinch.Conversation.Webhooks.ValidateAuthenticationHeader(headers, body, sinchEventsSecret);\n\nICallbackEvent callbackEvent = sinch.Conversation.Webhooks.ParseEvent(body);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sinchEventsSecret"]}," is set per app in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/convapi/apps"},"children":["Conversation dashboard"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ParseEvent"]}," works without validating the request, but then its origin can't be verified, so validating is recommended in production."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can find a complete example in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/blob/main/examples/WebApi/Controllers/ReceiveConversationCallbackController.cs"},"children":["examples/WebApi/Controllers/ReceiveConversationCallbackController.cs"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"sms-api","__idx":11},"children":["SMS API"]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Warning:"]}," the SMS API is end-of-sale. For new integrations, prefer the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#conversation-api"},"children":["Conversation API"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SMS API is regionalized: set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sms_region"]}," to the region where your SMS account is hosted. The accepted values depend on which credentials you use:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Project access keys"]},": available only in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["us"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["eu"]}," regions. Use the same ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["project_id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["key_id"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["key_secret"]}," as the common client, plus ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sms_region"]},":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch;\nusing Sinch.SMS;\n\nvar sinch = new SinchClient(\n    \"SINCH_PROJECT_ID\",\n    \"SINCH_KEY_ID\",\n    \"SINCH_KEY_SECRET\",\n    options =>\n    {\n        options.SmsRegion = SmsRegion.Us;\n    });\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["SMS authentication for new projects"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Projects created after the SMS API end-of-sale (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["15/04/26"]},") cannot use project access keys. The SMS API requests return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401 Unauthorized"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you encounter this issue, consider the following options:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use service plan credentials (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["service_plan_id"]}," + ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sms_api_token"]},")"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use the Conversation API, which works with project access keys."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Contact your account manager"]}]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Service plan"]},": available in all regions (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["us"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["eu"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["au"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["br"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ca"]},"). Use a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["service_plan_id"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sms_api_token"]},", both available on the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/sms/api/services"},"children":["Service APIs dashboard"]},":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch;\nusing Sinch.SMS;\n\nvar sinch = new SinchClient(default, default, default,\n    options =>\n    {\n        options.UseServicePlanIdWithSms(\n            \"SINCH_SERVICE_PLAN_ID\",\n            \"SINCH_SMS_API_TOKEN\",\n            SmsServicePlanIdRegion.Us);\n    });\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," if you use both the SMS and the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#conversation-api"},"children":["Conversation API"]}," from the same client, set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sms_region"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["conversation_region"]}," to the same region. Mismatched regions cause delivery failures."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sinch-events-1","__idx":12},"children":["Sinch Events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SMS API delivers asynchronous Sinch Events to an Event Destination, whose URL is set per batch with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["callback_url"]}," parameter on the send, update and replace operations. The SDK provides typed models for deserializing inbound callbacks, such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IncomingTextSms"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RecipientDeliveryReport"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch.SMS.Hooks;\n\n// In an ASP.NET controller, model binding deserializes the payload automatically:\n[HttpPost]\npublic async Task HandleInbound([FromBody] IncomingTextSms incomingSms)\n{\n    // handle inbound SMS event\n}\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Signature authentication for SMS events must be enabled for your account by your account manager. Until it is activated, signature headers will not be present. See the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/docs/sms/api-reference/sms/tag/Webhooks/#tag/Webhooks/section/Callbacks"},"children":["SMS events documentation"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can find a complete example in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/blob/main/examples/WebApi/Controllers/InboundSmsController.cs"},"children":["examples/WebApi/Controllers/InboundSmsController.cs"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"voice-api","__idx":13},"children":["Voice API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Voice API uses application credentials. Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application_key"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application_secret"]},", both available on the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/voice/apps"},"children":["Apps dashboard"]},"; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["voice_region"]}," is optional and defaults to a global region:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch;\nusing Sinch.Voice;\n\nvar voiceClient = sinch.Voice(\n    \"SINCH_APPLICATION_KEY\",\n    \"SINCH_APPLICATION_SECRET\",\n    VoiceRegion.Global);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sinch-events-2","__idx":14},"children":["Sinch Events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Voice API delivers synchronous Sinch Events to the Event Destination URL configured for your app. Requests are signed with your application credentials, so validation requires the HTTP verb and URI of the controller handling the request, in addition to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["headers"]}," and raw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["body"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch.Voice.Hooks;\n\nbool validAuth = voiceClient.ValidateAuthenticationHeader(\n    HttpMethod.Post,\n    \"/webhooks/voice\",\n    Request.Headers.ToDictionary(h => h.Key, h => h.Value.AsEnumerable()),\n    rawBody);\n\nIVoiceEvent voiceEvent = voiceClient.ParseEvent(rawBody);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Some events (for example an incoming call) expect a SVAML response: build it from the business layer and return it from your controller."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can find a complete example in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/blob/main/examples/WebApi/Controllers/HandleIncomingIceEventController.cs"},"children":["examples/WebApi/Controllers/HandleIncomingIceEventController.cs"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"verification-api","__idx":15},"children":["Verification API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Verification API uses application credentials. Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application_key"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application_secret"]},", both available on the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/verification/apps"},"children":["Apps dashboard"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch;\n\nvar verificationClient = sinch.Verification(\n    \"SINCH_APPLICATION_KEY\",\n    \"SINCH_APPLICATION_SECRET\");\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sinch-events-3","__idx":16},"children":["Sinch Events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Verification API delivers synchronous Sinch Events to the Event Destination URL configured for your app. Requests are signed with your application credentials, so validation requires the HTTP verb and URI of the controller handling the request, in addition to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["headers"]}," and raw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["body"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using System.Text.Json;\nusing Sinch.Verification.Hooks;\n\nbool validAuth = verificationClient.ValidateAuthenticationHeader(\n    HttpMethod.Post,\n    \"/webhooks/verification\",\n    Request.Headers.ToDictionary(h => h.Key, h => h.Value.AsEnumerable()),\n    rawBody);\n\nvar verificationEvent = JsonSerializer.Deserialize<VerificationRequestEvent>(rawBody);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Some events expect a response: build it from the business layer and return it to Sinch."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"numbers-api","__idx":17},"children":["Numbers API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Numbers API needs no extra parameters, use the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#client-initialization"},"children":["common client"]}," shown above."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sinch-events-4","__idx":18},"children":["Sinch Events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Numbers API delivers asynchronous Sinch Events to the Event Destination you configure through ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sinch.Numbers.Callbacks"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ValidateAuthenticationHeader"]}," confirms a request comes from Sinch; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["headers"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["body"]}," are the incoming request's headers and raw body:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using System.Text.Json;\nusing Sinch.Numbers.Hooks;\n\nbool validAuth = sinch.Numbers.ValidateAuthenticationHeader(sinchEventsSecret, rawBody, Request.Headers);\n\nvar numbersEvent = JsonSerializer.Deserialize<Event>(rawBody);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sinchEventsSecret"]}," is the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HmacSecret"]}," value configured on the Event Destination. Deserializing the payload works without validating the request, but then its origin can't be verified, so validating is recommended in production."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"fax-api","__idx":19},"children":["Fax API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Fax API needs no extra parameters beyond the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#client-initialization"},"children":["common client"]}," shown above. Optionally set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fax_region"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SinchOptions"]}," to select the regional endpoint."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"sinch-events-5","__idx":20},"children":["Sinch Events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Fax API delivers asynchronous Sinch Events to the incoming webhook URL you configure per service in the Fax dashboard. The SDK provides typed event models such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IncomingFaxEvent"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CompletedFaxEvent"]}," for deserializing the payload:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch.Fax.Hooks;\n\n[HttpPost]\npublic IActionResult HandleFaxEvent([FromBody] IFaxEvent faxEvent)\n{\n    // handle fax event\n}\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No request signature validation is implemented for the Fax API. You can find a complete example in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/blob/main/examples/WebApi/Controllers/HandleFaxEventController.cs"},"children":["examples/WebApi/Controllers/HandleFaxEventController.cs"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"your-first-request","__idx":21},"children":["Your first request"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once your client is configured, you can send your first message. The example below uses the Conversation API to send a simple text message over SMS. Replace ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CONVERSATION_APP_ID"]}," with your app ID, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SINCH_VIRTUAL_PHONE_NUMBER"]}," with your Sinch number and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RECIPIENT_PHONE_NUMBER"]}," with the recipient's phone number:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch.Conversation;\nusing Sinch.Conversation.Common;\nusing Sinch.Conversation.Messages;\nusing Sinch.Conversation.Messages.Message;\nusing Sinch.Conversation.Messages.Send;\n\nvar response = await sinch.Conversation.Messages.Send(new SendMessageRequest\n{\n    AppId = \"CONVERSATION_APP_ID\",\n    Recipient = new Identified\n    {\n        IdentifiedBy = new IdentifiedBy\n        {\n            ChannelIdentities = new List<ChannelIdentity>\n            {\n                new()\n                {\n                    Channel = ConversationChannel.Sms,\n                    Identity = \"RECIPIENT_PHONE_NUMBER\"\n                }\n            }\n        }\n    },\n    Message = new AppMessage(new TextMessage(\"Hello from the Sinch .NET SDK!\")),\n    ChannelProperties = new Dictionary<string, string>\n    {\n        [\"SMS_SENDER\"] = \"SINCH_VIRTUAL_PHONE_NUMBER\"\n    }\n});\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"logging","__idx":22},"children":["Logging"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK uses ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://learn.microsoft.com/en-us/dotnet/core/extensions/logging"},"children":["Microsoft.Extensions.Logging"]},". Provide an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ILoggerFactory"]}," through ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SinchOptions"]}," when initializing the client:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch;\n\nvar sinch = new SinchClient(\n    \"SINCH_PROJECT_ID\",\n    \"SINCH_KEY_ID\",\n    \"SINCH_KEY_SECRET\",\n    options =>\n    {\n        options.LoggerFactory = LoggerFactory.Create(config =>\n        {\n            config.AddConsole();\n        });\n    });\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If no logger factory is provided, the SDK does not emit log output."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"handling-exceptions","__idx":23},"children":["Handling exceptions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For an unsuccessful API call, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SinchApiException"]}," will be thrown. It exposes the HTTP status code, a status string, a detailed message, and any additional error details:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch;\nusing Sinch.SMS.Batches.Send;\n\ntry\n{\n    var batch = await sinch.Sms.Batches.Send(new SendTextBatchRequest\n    {\n        Body = \"Hello, World!\",\n        To = new List<string> { \"+123456789\" }\n    });\n}\ncatch (SinchApiException e)\n{\n    logger.LogError(\"API exception. Status: {status}. Detailed message: {message}\", e.Status, e.DetailedMessage);\n}\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Authentication failures throw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SinchAuthException"]}," from the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Sinch.Auth"]}," namespace."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"custom-http-client-implementation","__idx":24},"children":["Custom HTTP client implementation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By default, the SDK creates and manages its own ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HttpClient"]},". To provide your own instance (for example, to configure a proxy or reuse a shared client), pass it through ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SinchOptions"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Sinch;\n\nvar sinch = new SinchClient(\n    \"SINCH_PROJECT_ID\",\n    \"SINCH_KEY_ID\",\n    \"SINCH_KEY_SECRET\",\n    options =>\n    {\n        options.HttpClient = new HttpClient();\n    });\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For additional configuration options such as API URL overrides, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/blob/main/src/Sinch/SinchOptions.cs"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SinchOptions"]}]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"third-party-dependencies","__idx":25},"children":["Third-party dependencies"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK relies on the following third-party dependencies:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.nuget.org/packages/Microsoft.Extensions.Http"},"children":["Microsoft.Extensions.Http"]},": HTTP client factory integration."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.nuget.org/packages/Microsoft.Extensions.Primitives"},"children":["Microsoft.Extensions.Primitives"]},": Primitive types used across the SDK."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.nuget.org/packages/System.Text.Json"},"children":["System.Text.Json"]},": JSON serialization and deserialization."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":26},"children":["Examples"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can find:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["a C# example of selected API operations in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/tree/main/snippets"},"children":["snippets"]}," folder."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["console application examples in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/tree/main/examples/Console"},"children":["examples/Console"]}," folder."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["an ASP.NET web application for handling Sinch Events in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/tree/main/examples/WebApi"},"children":["examples/WebApi"]}," folder."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"changelog--migration","__idx":27},"children":["Changelog & Migration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For information about the latest changes in the SDK, please refer to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/blob/main/CHANGELOG.md"},"children":["CHANGELOG"]}," file."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"license","__idx":28},"children":["License"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This project is licensed under the Apache License. See the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/sinch/sinch-sdk-dotnet/blob/main/LICENSE"},"children":["LICENSE"]}," file for the license text."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"contact","__idx":29},"children":["Contact"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Developer Experience engineering team: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"mailto:team-developer-experience@sinch.com"},"children":["team-developer-experience@sinch.com"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"versions","__idx":30},"children":["Versions"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-dotnet/1.5.1/index.html"},"children":["1.5.1 (latest)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-dotnet/1.5.0/index.html"},"children":["1.5.0"]}]}]}]}]},"headings":[{"value":"Sinch .NET SDK","id":"sinch-net-sdk","depth":1},{"value":"Table of contents","id":"table-of-contents","depth":2},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Version support","id":"version-support","depth":2},{"value":"Documentation","id":"documentation","depth":2},{"value":"Installation","id":"installation","depth":2},{"value":"Supported APIs","id":"supported-apis","depth":2},{"value":"Getting started","id":"getting-started","depth":2},{"value":"Client initialization","id":"client-initialization","depth":3},{"value":"Conversation API","id":"conversation-api","depth":3},{"value":"Sinch Events","id":"sinch-events","depth":4},{"value":"SMS API","id":"sms-api","depth":3},{"value":"Sinch Events","id":"sinch-events-1","depth":4},{"value":"Voice API","id":"voice-api","depth":3},{"value":"Sinch Events","id":"sinch-events-2","depth":4},{"value":"Verification API","id":"verification-api","depth":3},{"value":"Sinch Events","id":"sinch-events-3","depth":4},{"value":"Numbers API","id":"numbers-api","depth":3},{"value":"Sinch Events","id":"sinch-events-4","depth":4},{"value":"Fax API","id":"fax-api","depth":3},{"value":"Sinch Events","id":"sinch-events-5","depth":4},{"value":"Your first request","id":"your-first-request","depth":3},{"value":"Logging","id":"logging","depth":2},{"value":"Handling exceptions","id":"handling-exceptions","depth":2},{"value":"Custom HTTP client implementation","id":"custom-http-client-implementation","depth":2},{"value":"Third-party dependencies","id":"third-party-dependencies","depth":2},{"value":"Examples","id":"examples","depth":2},{"value":"Changelog & Migration","id":"changelog--migration","depth":2},{"value":"License","id":"license","depth":2},{"value":"Contact","id":"contact","depth":2},{"value":"Versions","id":"versions","depth":2}],"frontmatter":{"seo":{"title":".NET SDK Reference Docs | Sinch","description":"See all versions of the Sinch .NET SDK reference documentation."},"template":"../../../@theme/Templates/SideBySide.tsx"},"lastModified":"2026-09-02T22:05:18.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/sdks/dotnet/sdk-reference-docs","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}