{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/functions/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["partial"]},"type":"markdown"},"seo":{"title":"Developer Documentation","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":"SMS API","description":"The SMS API allows you to send and receive SMS messages with a few easy steps. You can also send bulk SMS messages to multiple customers using the Sinch SMS service.","includeFiles":["docs/sms/**/*.md","docs/sms/**/*.yaml"],"excludeFiles":["docs/sms/index.md"]},{"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"]}],"hide":false,"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"local-development","__idx":0},"children":["Local Development"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"starting-the-dev-server","__idx":1},"children":["Starting the dev server"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sinch functions dev\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Node.js"]}," functions restart automatically when you save changes. ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["C#"]}," functions use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dotnet watch run"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Default port is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["3000"]},". Override with:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sinch functions dev --port 8080\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"tunnel","__idx":2},"children":["Tunnel"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The tunnel proxies requests from the Sinch platform to your local machine. Without it, Sinch callbacks cannot reach ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["localhost"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["On first run, the CLI asks for your tunnel preference. Your answer is saved in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sinch.json"]}," under ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tunnel.preference"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sinch functions dev --tunnel      # Force tunnel on\nsinch functions dev --no-tunnel   # Force tunnel off\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When active, the tunnel registers a public endpoint and the platform automatically configures your Voice application's callback URL to point at it."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"debugging","__idx":3},"children":["Debugging"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"nodejs","__idx":4},"children":["Node.js"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sinch functions dev --debug\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Starts the Node.js inspector on port ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["9229"]},". The CLI creates ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".vscode/launch.json"]}," automatically if it does not exist."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["VS Code / Cursor"]}," — Press F5 to attach"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["WebStorm"]}," — Run > Attach to Node.js/Chrome > ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["localhost:9229"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Manual"]}," — connect to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ws://localhost:9229"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"c","__idx":5},"children":["C#"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sinch functions dev --debug\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Creates ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".vscode/launch.json"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".vscode/tasks.json"]},". For Visual Studio: Debug > Attach to Process > ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dotnet.exe"]},". For Rider: Run > Attach to Process."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"debug-environment-variables","__idx":6},"children":["Debug environment variables"]},{"$$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":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Effect"},"children":["Effect"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DEBUG=1"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Verbose debug logging in CLI and runtime"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DEBUG_HTTP=1"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Log all HTTP request and response details"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"testing-endpoints","__idx":7},"children":["Testing endpoints"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# ICE callback\ncurl -s -X POST http://localhost:3000/ice \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"callid\": \"test-123\",\n    \"cli\": \"+15551234567\",\n    \"to\": {\"type\": \"number\", \"endpoint\": \"+15559876543\"},\n    \"domain\": \"pstn\",\n    \"originationType\": \"pstn\"\n  }'\n\n# PIE callback (simulating DTMF press \"1\")\ncurl -s -X POST http://localhost:3000/pie \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"callid\": \"test-123\",\n    \"menuResult\": {\n      \"menuId\": \"main\",\n      \"value\": \"1\",\n      \"inputMethod\": \"dtmf\"\n    }\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"secrets","__idx":8},"children":["Secrets"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Secrets are sensitive values stored in your OS keychain and injected at runtime."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"pattern","__idx":9},"children":["Pattern"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Declare the key in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," (Node.js) or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["appsettings.json"]}," (C#) with an empty value"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Store the actual value: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sinch secrets add OPENAI_API_KEY sk-proj-PLACEHOLDER"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The runtime loads values from the keychain at startup"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"use-in-code","__idx":10},"children":["Use in code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const apiKey = process.env.OPENAI_API_KEY;\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"manage-secrets","__idx":11},"children":["Manage secrets"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sinch secrets list                         # List key names (values hidden)\nsinch secrets get OPENAI_API_KEY           # Show metadata, --show for value\nsinch secrets delete OPENAI_API_KEY        # Remove from keychain\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"c-secrets","__idx":12},"children":["C# secrets"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sinch functions init"]}," runs ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dotnet user-secrets init"]}," automatically. To add manually:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"dotnet user-secrets set OPENAI_API_KEY sk-proj-PLACEHOLDER\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"on-deploy","__idx":13},"children":["On deploy"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The CLI reads your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["appsettings.json"]},". For keys with empty values, it looks up the actual value from the keychain. Secret variables are encrypted at rest and never appear in logs."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"credential-injection","__idx":14},"children":["Credential injection"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The dev server injects Sinch credentials as environment variables automatically:"]},{"$$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":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Source"},"children":["Source"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SINCH_APPLICATION_KEY"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["OS keychain (Voice application key)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SINCH_APPLICATION_SECRET"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["OS keychain (Voice application secret)"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"what-gets-excluded-from-deployment","__idx":15},"children":["What gets excluded from deployment"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["node_modules/"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env.local"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bin/"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["obj/"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".git/"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".vscode/"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".idea/"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".vs/"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cursor/"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["*.zip"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["*.user"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["*.suo"]}]}]},"headings":[{"value":"Local Development","id":"local-development","depth":1},{"value":"Starting the dev server","id":"starting-the-dev-server","depth":2},{"value":"Tunnel","id":"tunnel","depth":2},{"value":"Debugging","id":"debugging","depth":2},{"value":"Node.js","id":"nodejs","depth":3},{"value":"C#","id":"c","depth":3},{"value":"Debug environment variables","id":"debug-environment-variables","depth":3},{"value":"Testing endpoints","id":"testing-endpoints","depth":2},{"value":"Secrets","id":"secrets","depth":2},{"value":"Pattern","id":"pattern","depth":3},{"value":"Use in code","id":"use-in-code","depth":3},{"value":"Manage secrets","id":"manage-secrets","depth":3},{"value":"C# secrets","id":"c-secrets","depth":3},{"value":"On deploy","id":"on-deploy","depth":3},{"value":"Credential injection","id":"credential-injection","depth":2},{"value":"What gets excluded from deployment","id":"what-gets-excluded-from-deployment","depth":2}],"frontmatter":{"seo":{"title":""}},"lastModified":"2026-04-15T14:23:23.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/functions/local-development","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}