{"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":"functioncontext-cheat-sheet","__idx":0},"children":["FunctionContext cheat sheet"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A quick lookup of everything hanging off ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context"]}," (Node) / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context"]}," (C#). For the conceptual tour, see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"#"},"children":["context object"]},". For method-level detail, trust TypeScript IntelliSense or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dotnet"]},"'s IntelliSense — this page is the \"what can I type\" reference."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"at-a-glance","__idx":1},"children":["At a glance"]},{"$$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":"Capability"},"children":["Capability"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Node.js"},"children":["Node.js"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"C#"},"children":["C#"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Key-value cache"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.cache"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Cache"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Blob / file storage"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.storage"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Storage"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SQLite database"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.database"]}," (path)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Database.ConnectionString"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Structured logger"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["console"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.log"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Logger"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Project + function info"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.config"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Configuration"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Env vars"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.env"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["process.env"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Configuration"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Request ID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.requestId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HttpContext.TraceIdentifier"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Timestamp"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.timestamp"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["(see request headers)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Voice SDK client"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.voice"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Voice"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Conversation SDK"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.conversation"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Conversation"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SMS SDK"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.sms"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Sms"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Numbers SDK"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.numbers"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Numbers"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Verification SDK (C#)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["—"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Context.Verification"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Private assets"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.assets(filename)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["(package helpers)"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["SDK client properties are ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["undefined"]}," if the required environment variables are missing — always null-check. See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/functions/reference/sdk-env-vars"},"children":["SDK env vars"]}," for which variables unlock each client."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"cache","__idx":2},"children":["Cache"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Node\nawait context.cache.set('session:abc', { userId: 'u1' }, 1800);  // TTL seconds\nconst session = await context.cache.get<{ userId: string }>('session:abc');\nconst exists = await context.cache.has('session:abc');\nawait context.cache.extend('session:abc', 600);\nawait context.cache.delete('session:abc');\nconst keys = await context.cache.keys('session:*');\nconst many = await context.cache.getMany<Session>(keys);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"// C#\nawait Context.Cache.Set(\"session:abc\", new { UserId = \"u1\" }, 1800);\nvar session = await Context.Cache.Get<MySession>(\"session:abc\");\nif (await Context.Cache.Exists(\"session:abc\"))\n    await Context.Cache.Delete(\"session:abc\");\nvar keys = await Context.Cache.GetKeys();\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Default TTL is 3600 seconds. Values are JSON-serialized."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"storage","__idx":3},"children":["Storage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Node\nawait context.storage.write('reports/daily.json', JSON.stringify(data));\nconst buf = await context.storage.read('reports/daily.json');\nconst files = await context.storage.list('reports/');\nconst exists = await context.storage.exists('reports/old.json');\nawait context.storage.delete('reports/old.json');\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"// C#\nawait Context.Storage.WriteAsync(\"reports/daily.json\", JsonSerializer.Serialize(data));\nvar text = await Context.Storage.ReadTextAsync(\"reports/daily.json\");\nvar bytes = await Context.Storage.ReadAsync(\"reports/daily.json\");\nvar files = await Context.Storage.ListAsync(\"reports/\");\n\n// Streams for large files\nusing var stream = await Context.Storage.ReadStreamAsync(\"large-file.bin\");\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Keys can include ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/"]}," — treat them as folder paths."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"database","__idx":4},"children":["Database"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Node — context.database is a file path\nimport initSqlJs from 'sql.js';\nimport { readFileSync, writeFileSync, existsSync } from 'fs';\n\nconst SQL = await initSqlJs();\nconst buf = existsSync(context.database) ? readFileSync(context.database) : undefined;\nconst db = new SQL.Database(buf);\ndb.run('CREATE TABLE IF NOT EXISTS kv (key TEXT PRIMARY KEY, value TEXT)');\nwriteFileSync(context.database, Buffer.from(db.export()));\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"// C# — Context.Database.ConnectionString is an ADO.NET connection string\nusing var conn = new SqliteConnection(Context.Database.ConnectionString);\nconn.Open();\nusing var cmd = conn.CreateCommand();\ncmd.CommandText = \"CREATE TABLE IF NOT EXISTS kv (key TEXT PRIMARY KEY, value TEXT)\";\ncmd.ExecuteNonQuery();\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In production, the platform automatically replicates and backs up the database. No code changes required."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"logger","__idx":5},"children":["Logger"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Node\nconsole.log('Request received', { callId: data.callid });\ncontext.log?.info('Request received', { callId: data.callid });\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"// C#\nLogger.LogInformation(\"Request received from {Cli}\", data.Cli);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Output is captured and streamed via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sinch functions logs"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"config-and-variables","__idx":6},"children":["Config and variables"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Node — raw\ncontext.config.projectId\ncontext.config.functionName\ncontext.config.environment     // 'development' | 'production'\ncontext.config.variables       // object of sinch.json variables\n\n// Node — UniversalConfig helper\nimport { createConfig } from '@sinch/functions-runtime';\nconst config = createConfig(context);\nconfig.requireSecret('STRIPE_SECRET_KEY');           // throws if missing\nconfig.getVariable('COMPANY_NAME', 'Acme Corp');\nconfig.getApplicationCredentials();                   // voice app key/secret\nconfig.isDevelopment();\nconfig.isProduction();\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"// C#\nvar companyName = Configuration[\"COMPANY_NAME\"] ?? \"Acme Corp\";\nvar apiKey = Configuration[\"STRIPE_SECRET_KEY\"]\n    ?? throw new InvalidOperationException(\"STRIPE_SECRET_KEY is required\");\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"#"},"children":["configuration & secrets"]}," for how the layers fit together."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"pre-wired-sdk-clients","__idx":7},"children":["Pre-wired SDK clients"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Initialized by the runtime when the required env vars are present. See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/functions/reference/sdk-env-vars"},"children":["SDK env vars"]}," for the full list."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Node — always null-check\nif (context.voice) {\n  await context.voice.callouts.custom({ ... });\n}\n\nif (context.conversation) {\n  await context.conversation.messages.send({ ... });\n}\n\nif (context.sms) {\n  await context.sms.batches.send({ ... });\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"// C# — same pattern\nif (Context.Voice is not null)\n    await Context.Voice.Callouts.CustomAsync(...);\n\nif (Context.Conversation is not null)\n    await Context.Conversation.Messages.Send(...);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"assets","__idx":8},"children":["Assets"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Private files you ship alongside your code. Do ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["not"]}," use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fs.readFileSync('./assets/...')"]}," — the deployed artifact structure differs from dev."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Node\nconst greeting = await context.assets('greetings/en.txt');\nconst audioBuffer = await context.assets('prompts/welcome.wav');\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"// C# — context.Assets helper\nvar greeting = await Context.Assets(\"greetings/en.txt\");\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["public"]}," static files (images, CSS), use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["public/"]}," directory — the runtime serves it at ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"request-metadata","__idx":9},"children":["Request metadata"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Node\ncontext.requestId   // tracing ID unique to this invocation\ncontext.timestamp   // ISO 8601 when the request entered the runtime\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Include ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context.requestId"]}," in logs and upstream calls for cross-service debugging."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"custom-http-request-and-response-node-custom-endpoints-only","__idx":10},"children":["Custom HTTP request and response (Node custom endpoints only)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For non-voice custom endpoints, the second argument is a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FunctionRequest"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"interface FunctionRequest {\n  method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n  path: string;\n  query?: Record<string, string | string[]>;\n  headers?: Record<string, string>;\n  body?: unknown;\n  params?: Record<string, string>;\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["And you return a plain ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{ statusCode, body, headers? }"]}," object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"return { statusCode: 200, body: { status: 'healthy' } };\nreturn { statusCode: 400, body: { error: 'Missing field: name' } };\nreturn { statusCode: 404, body: { error: 'Not found' } };\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["C# custom endpoints use regular ASP.NET MVC action results (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Ok"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NotFound"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BadRequest"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["StatusCode"]},", etc.)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related","__idx":11},"children":["Related"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#"},"children":["Context object concept"]}," — narrative tour of the same APIs"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/functions/reference/sdk-env-vars"},"children":["SDK env vars"]}," — which variables unlock which client"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#"},"children":["Configuration & secrets"]}," — how config flows into the runtime"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#"},"children":["Node.js runtime"]}," / ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"#"},"children":["C# runtime"]}," — runtime guides"]}]}]},"headings":[{"value":"FunctionContext cheat sheet","id":"functioncontext-cheat-sheet","depth":1},{"value":"At a glance","id":"at-a-glance","depth":2},{"value":"Cache","id":"cache","depth":2},{"value":"Storage","id":"storage","depth":2},{"value":"Database","id":"database","depth":2},{"value":"Logger","id":"logger","depth":2},{"value":"Config and variables","id":"config-and-variables","depth":2},{"value":"Pre-wired SDK clients","id":"pre-wired-sdk-clients","depth":2},{"value":"Assets","id":"assets","depth":2},{"value":"Request metadata","id":"request-metadata","depth":2},{"value":"Custom HTTP request and response (Node custom endpoints only)","id":"custom-http-request-and-response-node-custom-endpoints-only","depth":2},{"value":"Related","id":"related","depth":2}],"frontmatter":{"seo":{"title":""}},"lastModified":"2026-04-15T14:23:23.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/functions/reference/function-context","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}