{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/voice-2.0/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["partial"]},"product":"Voice v2 (preview)","type":"markdown"},"seo":{"title":"OAuth 2.0 authentication | Voice 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":"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":"How to perform authentication using OAuth 2.0 for the Voice API."},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"oauth-20-authentication","__idx":0},"children":["OAuth 2.0 authentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Achieve more secure API authentication with OAuth 2.0 ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["access tokens"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Access tokens are ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["short lived"]},". Typically, they will only last ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["one hour"]},". This is done to keep your data (and ours) safer."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In exchanging credentials, you'll get a long string called an ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["access token"]},". This access token will serve as your bearer token in the authorization header of API calls."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Find your credentials"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/settings/access-keys"},"children":["Sinch Build Dashboard"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["There are two pieces of information needed to obtain an access token: the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["key ID"]}," and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["key secret"]}," corresponding to your project ID."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To get an access token, do the following:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Login to the Sinch Build Dashboard to get your ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/settings/access-keys"},"children":["access keys"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click on ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create Access Key"]}," and when prompted, enter a display name, then click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Confirm"]},"."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Does it have to be a new key?"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Not at all. If you have existing credentials saved, feel free to use them."]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Key ID"]}," and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Key Secret"]}," will display. Save the project ID, key ID, and key secret someplace safe."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Important!"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["The key secret is only viewable at the time of initial creation."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you accidentally misplace they key secret, no worries! Create a new key."]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Using the following curl command, get your access token using the key ID and key secret."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"curl","header":{"controls":{"copy":{}}},"source":"curl https://auth.sinch.com/oauth2/token \\\n-d grant_type=client_credentials \\\n-u YOUR_Key_ID:YOUR_Key_Secret\n","lang":"curl"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You'll see your new access token in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["access_token"]}," field of the response. Now you're ready to use this token on calls to the API. Simply include the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["access_token"]}," value in the header of your API call using the following structure (be sure to take into account any coding language-specific syntax): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization: Bearer {{YOUR_access_token_value}}"]},". The access token will be useable for ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["one hour."]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Short lived"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The access token is meant to be short lived for enhanced security. Generate one as often as it is necessary."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":1},"children":["Examples"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example will return all services for your project using the Voice API. Replace all relevant parameters with your credential (including the curly braces ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{}"]},"). Note that you'll also need your project ID, which is ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/settings/access-keys"},"children":["found in the Sinch Build Dashboard"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"curl -i -X GET \\\n'https://voice.api.sinch.com/v2/projects/{YOUR_project_id}/services' \\\n  -H 'Authorization: Bearer {YOUR_access_token} ' \\\n  -H 'Content-Type: application/json' \\\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["That's it!"]}]},"headings":[{"value":"OAuth 2.0 authentication","id":"oauth-20-authentication","depth":1},{"value":"Examples","id":"examples","depth":2}],"frontmatter":{"seo":{"title":"OAuth 2.0 authentication | Voice API | Sinch","description":"How to perform authentication using OAuth 2.0 for the Voice API."}},"lastModified":"2026-08-31T13:48:15.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/voice-2.0/api-reference/authentication/oauth","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}