Beam allows you to deploy web endpoints that can be invoked via HTTP requests. These endpoints can be used to run arbitrary code. For instance, you could perform inference using one of our GPUs, or just run a simple function that multiplies two numbers.
from beam import endpoint@endpoint( cpu=1.0, memory=128,)def multiply(**inputs): result = inputs["x"] * 2 return {"result": result}
Endpoints vs. Task QueuesEndpoints are RESTful APIs, designed for synchronous tasks that can complete in 180 seconds or less. For longer running tasks, you’ll want to use an asynchronous task_queue instead.
beam serve monitors changes in your local file system, live-reloads the remote environment as you work, and forwards remote container logs to your local shell.Serve is great for prototyping. You can develop in a containerized cloud environment in real-time, with adjustable CPU, memory, GPU resources.It’s also great for testing an app before deploying it. Served functions are orchestrated identically to deployments, which means you can test your Beam workflow end-to-end before deploying.To start an ephemeral serve session, you’ll use the serve command:
beam serve [FILE.PY]:[ENTRY-POINT]
For example, to start a session for the multiply function in app.py, run:
beam serve app.py:multiply
To end the session, you can use Ctrl + C in the terminal where you started the session.
Serve sessions end automatically after 10 minutes of inactivity. The entire
duration of the session is counted towards billable usage, even if the session
is not receiving requests.
By default, Beam will sync all the files in your working directory to the
remote container. This allows you to use the files you have locally while
developing. If you want to prevent some files from getting uploaded, you can
create a .beamignore.
When you’re finished with prototyping and want to make a persistent deployment of the endpoint, enter your shell and run this command from the working directory:
beam deploy [FILE.PY]:[ENTRY-POINT]
After running this command, you’ll see some logs in the console that show the progress of your deployment.
The container handling the endpoint will spin down after 180 seconds of inactivity by default, or customized with the keep_warm_seconds parameter. The container will be billed for the time it is active and handling requests.
To send other payloads other than JSON, you can encode the data as a base64 string and include it in the JSON payload, or upload the file to a S3 bucket and mount the bucket to the endpoint.For more detailed examples, checkout the Sending File Payloads documentation.
Was this page helpful?
⌘I
{"docsConfig":{"theme":"linden","$schema":"https://mintlify.com/docs.json","name":"Beam","description":"Beam provides CPU and GPU machines for agents, billed by the millisecond: persistent VMs that pause with their memory intact, sandboxes that boot in seconds, and GPU endpoints for inference.","colors":{"primary":"#477ff7","light":"#93c5fd","dark":"#2563eb"},"logo":{"light":"https://mintcdn.com/slai-beam/StmwwthCMFzpzgft/logo/dark-logo.svg?fit=max\u0026auto=format\u0026n=StmwwthCMFzpzgft\u0026q=85\u0026s=23387d001289bc6dcbe6be3f49769690","dark":"https://mintcdn.com/slai-beam/StmwwthCMFzpzgft/logo/light-logo.svg?fit=max\u0026auto=format\u0026n=StmwwthCMFzpzgft\u0026q=85\u0026s=0e0baef0b1593f56b60113ffd67fd744"},"favicon":"https://mintcdn.com/slai-beam/ZujHWu-L9dNBQS2M/logo/favicon.png?fit=max\u0026auto=format\u0026n=ZujHWu-L9dNBQS2M\u0026q=85\u0026s=b6614f50c2766c80749cc429d96a3a05","navbar":{"links":[{"href":"https://join.slack.com/t/beam-cloud/shared_invite/zt-4bf7jalhy-KI0ebGXk4vKpcDofwDjCLA","label":"Community"},{"href":"https://status.beam.cloud","label":"Status"}],"primary":{"type":"button","label":"Dashboard","href":"https://platform.beam.cloud"}},"footer":{"socials":{"website":"https://beam.cloud","github":"https://github.com/beam-cloud/beta9","slack":"https://join.slack.com/t/beam-cloud/shared_invite/zt-4bf7jalhy-KI0ebGXk4vKpcDofwDjCLA"}},"seo":{"metatags":{"og:image":"https://www.beam.cloud/meta-hero.png"},"indexing":"navigable"},"fonts":{"family":"Inter"},"integrations":{"ga4":{"measurementId":"G-XN1SS41L9X"},"posthog":{"apiKey":"phc_VhYc3jzbsDBBGtZHU3fLefqRq6wE8FxZLy1zJk1cLeB","apiHost":"https://us.i.posthog.com"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"markdown":{"instructions":["Install the Beam CLI, sign in, and connect coding agents to the Beam MCP server with `curl -fsSL https://www.beam.cloud/install | sh`. To also create a VM, run `curl -fsSL https://www.beam.cloud/install | sh -s -- --vm`.","VMs are persistent Linux machines without GPUs. Defaults: 4 CPUs, 8 GiB of RAM, a 50 GiB disk, Ubuntu 24.04, and a browser desktop. A running VM accrues usage until you stop, pause, or remove it, or until an idle timeout puts it to sleep.","Stopping a VM keeps its disk and discards RAM and processes. Pausing keeps both, and resuming restores them. To pause after 5 idle minutes and wake on access, run `beam vm update NAME --ttl 300 --idle-action pause --auto-resume`.","Core VM commands: `beam vm new NAME`, `beam vm ssh NAME`, `beam vm sync NAME ./dir`, `beam vm exec NAME -- CMD`, `beam vm expose NAME PORT --protected`, `beam vm fork NAME NEW_NAME`, `beam vm pause NAME`, `beam vm stop NAME`, `beam vm rm NAME`.","For GPUs, use a sandbox or a deployed endpoint. Sandboxes are disposable environments that boot in seconds and fork from snapshots.","Current rates are at https://www.beam.cloud/pricing."]},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Slack Community","icon":"slack","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://join.slack.com/t/beam-cloud/shared_invite/zt-4bf7jalhy-KI0ebGXk4vKpcDofwDjCLA"},{"anchor":"Github","icon":"github","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://github.com/beam-cloud/beta9"},{"anchor":"Twitter","icon":"twitter","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://twitter.com/beam_cloud"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"slai-beam","hasAudioNarration":false,"actualSubdomain":"slai-beam","customDomains":["docs.beam.cloud"],"gitSource":{"type":"github","owner":"slai-labs","repo":"beam-docs","deployBranch":"main","contentDirectory":"","mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad930602bf56705e20822a7","collectionId":"b5717e79-df2a-4cca-ae30-b75e78c492c4","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad930602bf56705e20822a7"},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ad930602bf56705e20822a7","clientVersion":"0.0.4054","searchFilterCounts":[{"language":"default","tag":"Documentation","count":83},{"language":"default","tag":"Examples","count":16},{"language":"default","tag":"Building Blocks","count":12},{"language":"default","tag":"Inference","count":11},{"language":"default","tag":"Virtual Machines","count":11},{"language":"default","tag":"Advanced Topics","count":9},{"language":"default","tag":"Start Here","count":9},{"language":"default","tag":"API Reference","count":7},{"language":"default","tag":"Sandboxes","count":7},{"language":"default","tag":"Data and Storage","count":5}]},"assistantConfig":{"deflection":{"enabled":true,"email":"support@beam.cloud"}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#navbar ul:has(>#topbar-cta-button)>li:not(#topbar-cta-button)>a{padding:.375rem .75rem;border-radius:9999px;background-color:rgb(243 244 246);color:rgb(17 24 39);font-size:.875rem;line-height:1.25rem;transition:background-color 150ms ease}#navbar ul:has(>#topbar-cta-button)>li:not(#topbar-cta-button)>a:hover{background-color:rgb(229 231 235);color:rgb(17 24 39)}.dark #navbar ul:has(>#topbar-cta-button)>li:not(#topbar-cta-button)>a{background-color:rgb(255 255 255/.08);color:rgb(255 255 255)}.dark #navbar ul:has(>#topbar-cta-button)>li:not(#topbar-cta-button)>a:hover{background-color:rgb(255 255 255/.14);color:rgb(255 255 255)}#topbar-cta-button>a{padding:.375rem .875rem;border-radius:9999px;border-color:transparent;background-color:#477ff7;color:#fff;transition:background-color 150ms ease}#topbar-cta-button>a:hover{background-color:#2563eb;color:#fff}#topbar-cta-button>a svg{display:none}"}],"page":{"pagePath":"v2/endpoint/overview","slug":"/v2/endpoint/overview","pageMetadata":{"title":"Creating a Web Endpoint","description":"Deploying and invoking web endpoints on Beam","icon":"laptop-code","href":"/v2/endpoint/overview"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Deploying and invoking web endpoints on Beam\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{Accordion,CodeBlock,Heading,Info,Tab,Tabs,Tip,Warning}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Beam allows you to deploy web endpoints that can be invoked via HTTP requests. These endpoints can be used to run arbitrary code. For instance, you could perform inference using one of our GPUs, or just run a simple function that multiplies two numbers.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` beam `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` endpoint`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@endpoint`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` cpu`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1.0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` memory`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`128`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` multiply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`inputs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` inputs[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"result\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: result}`})]}),`\n`]})})}),`\n`,_jsxs(Tip,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Endpoints vs. Task Queues`})}),_jsxs(_components.p,{children:[`Endpoints are RESTful APIs, designed for synchronous tasks that can complete in 180 seconds or less. For longer running tasks, you’ll want to use an asynchronous `,_jsx(_components.a,{href:`/v2/task-queue/running-tasks`,children:_jsx(_components.code,{children:`task_queue`})}),` instead.`]})]}),`\n`,_jsx(Heading,{level:`4`,id:`launch-a-preview-environment-optional`,children:`Launch a Preview Environment (Optional)`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`/v2/reference/cli#serve`,children:_jsx(_components.code,{children:`beam serve`})}),` monitors changes in your local file system, live-reloads the remote environment as you work, and forwards remote container logs to your local shell.`]}),`\n`,_jsx(_components.p,{children:`Serve is great for prototyping. You can develop in a containerized cloud environment in real-time, with adjustable CPU, memory, GPU resources.`}),`\n`,_jsx(_components.p,{children:`It’s also great for testing an app before deploying it. Served functions are orchestrated identically to deployments, which means you can test your Beam workflow end-to-end before deploying.`}),`\n`,_jsxs(_components.p,{children:[`To start an ephemeral `,_jsx(_components.code,{children:`serve`}),` session, you’ll use the `,_jsx(_components.code,{children:`serve`}),` command:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`beam`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` serve`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [FILE.PY]:[ENTRY-POINT]`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`For example, to start a session for the `,_jsx(_components.code,{children:`multiply`}),` function in `,_jsx(_components.code,{children:`app.py`}),`, run:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`beam`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` serve`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` app.py:multiply`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`To end the session, you can use `,_jsx(_components.code,{children:`Ctrl + C`}),` in the terminal where you started the session.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Serve sessions end automatically after 10 minutes of inactivity. The entire\nduration of the session is counted towards billable usage, even if the session\nis not receiving requests.`})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`By default, Beam will sync all the files in your working directory to the\nremote container. This allows you to use the files you have locally while\ndeveloping. If you want to prevent some files from getting uploaded, you can\ncreate a `,_jsx(_components.a,{href:`/v2/reference/cli#ignore-local-files`,children:_jsx(_components.code,{children:`.beamignore`})}),`.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`deploying-the-endpoint`,children:`Deploying the Endpoint`}),`\n`,_jsx(_components.p,{children:`When you’re finished with prototyping and want to make a persistent deployment of the endpoint, enter your shell and run this command from the working directory:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`beam`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` deploy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [FILE.PY]:[ENTRY-POINT]`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`After running this command, you’ll see some logs in the console that show the progress of your deployment.`}),`\n`,_jsx(Accordion,{title:`Show Logs`,id:`show-logs`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`19`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`19`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`$`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` beam`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` deploy`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` app.py:multiply`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`> `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Building`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` image`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`> `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Using`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cached`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` image`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`> `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Syncing`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` files`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`Reading`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` .beamignore`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` file`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`> `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Files`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` synced`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`> `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Deploying`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` endpoint`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`> `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Deployed`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`> `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Invocation`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` details`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://multiply-712408b-v1.app.beam.cloud'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Accept: _/_'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Accept-Encoding: gzip, deflate'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Connection: keep-alive'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Authorization: Bearer [YOUR_AUTH_TOKEN]'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Content-Type: application/json'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-d `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'{}'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})})}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`The container handling the endpoint will spin down after 180 seconds of inactivity by default, or customized with the `,_jsx(_components.code,{children:`keep_warm_seconds`}),` parameter. The container will be billed for the time it is active and handling requests.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`calling-the-endpoint`,children:`Calling the Endpoint`}),`\n`,_jsx(_components.p,{children:`After deploying the API, you’ll be able to make a web request to hit the API with cURL or libraries of your choice.`}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`cURL`,id:`curl`,\"data-child-heading-ids\":`[\"example-request\",\"example-response\"]`,children:[_jsx(_components.p,{children:`Open another terminal window to invoke the API:`}),_jsx(Heading,{level:`3`,id:`example-request`,children:`Example Request`}),_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://multiply-712408b-v1.app.beam.cloud'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Accept: */*'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Accept-Encoding: gzip, deflate'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Connection: keep-alive'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Authorization: Bearer [YOUR_AUTH_TOKEN]'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Content-Type: application/json'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`-d `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'{\"x\": 10}'`})]}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`example-response`,children:`Example Response`}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"result\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`20`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),_jsxs(Tab,{title:`Python`,id:`python`,\"data-child-heading-ids\":`[\"example-response-2\"]`,children:[_jsxs(_components.p,{children:[`In Python, you can use the `,_jsx(_components.code,{children:`requests`}),` library to make a POST request to the endpoint:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://multiply-712408b-v1.app.beam.cloud\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Connection\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"keep-alive\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer [YOUR_AUTH_TOKEN]\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(url, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`data)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.json())`})]}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`example-response-2`,children:`Example Response`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"result\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})})]})]}),`\n`,_jsx(_components.p,{children:`To send other payloads other than JSON, you can encode the data as a base64 string and include it in the JSON payload, or upload the file to a S3 bucket and mount the bucket to the endpoint.`}),`\n`,_jsxs(_components.p,{children:[`For more detailed examples, checkout the `,_jsx(_components.a,{href:`/v2/endpoint/sending-file-payloads`,children:`Sending File Payloads`}),` documentation.`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`1`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsx(_components.code,{language:`text`,numberOfLines:`1`,children:_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Creating a Web Endpoint","description":"Deploying and invoking web endpoints on Beam","icon":"laptop-code","href":"/v2/endpoint/overview"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Launch a Preview Environment (Optional)","slug":"launch-a-preview-environment-optional","depth":4,"children":[]},{"title":"Deploying the Endpoint","slug":"deploying-the-endpoint","depth":3,"children":[]},{"title":"Calling the Endpoint","slug":"calling-the-endpoint","depth":3,"children":[]},{"title":"Example Request","slug":"example-request","depth":3,"children":[],"tabId":"curl"},{"title":"Example Response","slug":"example-response","depth":3,"children":[],"tabId":"curl"},{"title":"Example Response","slug":"example-response-2","depth":3,"children":[],"tabId":"python"}],"codeExamples":{}},"jsLinks":[],"subdomain":"slai-beam","siteName":"Beam","title":"Creating a Web Endpoint - Beam","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-06-19T21:41:32.467Z","originalFileLocation":"v2/endpoint/overview.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Deploying and invoking web endpoints on Beam\">\u003cmeta data-mint-head name=\"application-name\" content=\"Beam\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Creating a Web Endpoint - Beam\">\u003cmeta data-mint-head property=\"og:description\" content=\"Deploying and invoking web endpoints on Beam\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Beam\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.beam.cloud/v2/endpoint/overview\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://www.beam.cloud/meta-hero.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Creating a Web Endpoint - Beam\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Deploying and invoking web endpoints on Beam\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://www.beam.cloud/meta-hero.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Beam\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#477ff7\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.beam.cloud/v2/endpoint/overview\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/v2/endpoint/overview.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.beam.cloud/#organization\",\"name\":\"Beam\",\"url\":\"https://docs.beam.cloud\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/slai-beam/StmwwthCMFzpzgft/logo/dark-logo.svg?fit=max\u0026auto=format\u0026n=StmwwthCMFzpzgft\u0026q=85\u0026s=23387d001289bc6dcbe6be3f49769690\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.beam.cloud#website\",\"name\":\"Beam\",\"url\":\"https://docs.beam.cloud\",\"publisher\":{\"@id\":\"https://docs.beam.cloud/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.beam.cloud/v2/endpoint/overview#webpage\",\"url\":\"https://docs.beam.cloud/v2/endpoint/overview\",\"name\":\"Creating a Web Endpoint\",\"description\":\"Deploying and invoking web endpoints on Beam\",\"dateModified\":\"2026-06-19T21:41:32.467Z\",\"isPartOf\":{\"@id\":\"https://docs.beam.cloud#website\"},\"breadcrumb\":{\"@id\":\"https://docs.beam.cloud/v2/endpoint/overview#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.beam.cloud/v2/endpoint/overview#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Inference\",\"item\":\"https://docs.beam.cloud/v2/endpoint/hosted-models\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating a Web Endpoint\",\"item\":\"https://docs.beam.cloud/v2/endpoint/overview\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.beam.cloud/v2/endpoint/overview#article\",\"headline\":\"Creating a Web Endpoint\",\"name\":\"Creating a Web Endpoint\",\"description\":\"Deploying and invoking web endpoints on Beam\",\"url\":\"https://docs.beam.cloud/v2/endpoint/overview\",\"mainEntityOfPage\":{\"@id\":\"https://docs.beam.cloud/v2/endpoint/overview#webpage\"},\"image\":\"https://www.beam.cloud/meta-hero.png\",\"dateModified\":\"2026-06-19T21:41:32.467Z\",\"publisher\":{\"@id\":\"https://docs.beam.cloud/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.beam.cloud#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Beam\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Beam","nav":{"global":{"anchors":[{"anchor":"Slack Community","icon":"slack","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://join.slack.com/t/beam-cloud/shared_invite/zt-4bf7jalhy-KI0ebGXk4vKpcDofwDjCLA"},{"anchor":"Github","icon":"github","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://github.com/beam-cloud/beta9"},{"anchor":"Twitter","icon":"twitter","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://twitter.com/beam_cloud"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Start Here","pages":[{"title":"Introduction","icon":"table-rows","href":"/v2/getting-started/introduction"},{"title":"Give an Agent a Dev Box","sidebarTitle":"Virtual Machines","icon":"server","href":"/v2/getting-started/quickstart-vm"},{"title":"Run Agent Code in a Sandbox","sidebarTitle":"Sandboxes","icon":"box","href":"/v2/getting-started/quickstart-sandbox"},{"title":"Quickstart: Deploy an Endpoint","sidebarTitle":"Endpoints","icon":"hand-wave","href":"/v2/getting-started/quickstart"},{"title":"Set Up Coding Agents","icon":"plug","href":"/v2/getting-started/add-to-cursor-claude"},{"title":"Installation","icon":"download","href":"/v2/getting-started/installation"},{"title":"Authentication and Workspaces","icon":"key","href":"/v2/getting-started/authentication"},{"title":"Core Concepts","icon":"notebook","href":"/v2/getting-started/core-concepts"},{"title":"Using the Dashboard","icon":"browser","href":"/v2/getting-started/dashboard"}]},{"group":"Virtual Machines","pages":[{"title":"Overview","icon":"server","href":"/v2/vm/overview"},{"title":"Configuration","icon":"sliders","href":"/v2/vm/configuration"},{"title":"Secrets","icon":"lock","href":"/v2/vm/secrets"},{"title":"Lifecycle","icon":"power-off","href":"/v2/vm/lifecycle"},{"title":"Storage and Snapshots","icon":"database","href":"/v2/vm/storage"},{"title":"Commands and SSH","icon":"terminal","href":"/v2/vm/processes"},{"title":"Networking","icon":"network-wired","href":"/v2/vm/networking"},{"title":"Desktop","icon":"desktop","href":"/v2/vm/desktop"},{"title":"Docker and Compose","icon":"docker","href":"/v2/vm/docker"},{"title":"CLI Reference","icon":"code","href":"/v2/vm/cli"},{"title":"SDK","icon":"code","href":"/v2/vm/sdk"}]},{"group":"Sandboxes","pages":[{"title":"Overview","icon":"box","href":"/v2/sandbox/overview"},{"title":"Sandbox Configuration","icon":"wrench","href":"/v2/sandbox/configuration"},{"title":"Snapshots","icon":"camera","href":"/v2/sandbox/snapshots"},{"title":"Process Management","icon":"terminal","href":"/v2/sandbox/processes"},{"title":"Networking","icon":"globe","href":"/v2/sandbox/networking"},{"title":"File System Operations","icon":"folder","href":"/v2/sandbox/filesystem"},{"title":"Docker in Sandboxes","icon":"docker","href":"/v2/sandbox/docker"}]},{"group":"Inference","pages":[{"title":"Hosted Model Inference","description":"Discover and call models from the Endpoints catalog","icon":"brain","href":"/v2/endpoint/hosted-models"},{"title":"Creating a Web Endpoint","icon":"laptop-code","href":"/v2/endpoint/overview"},{"title":"Hosting a Web Server","description":"Deploying web servers on Beam","icon":"server","href":"/v2/endpoint/web-server"},{"title":"Realtime and Streaming","icon":"bolt","href":"/v2/endpoint/realtime"},{"title":"Pre-Loading Models","icon":"circle-down","href":"/v2/endpoint/loaders"},{"title":"Cold Start Performance","icon":"rocket","href":"/v2/topics/cold-start"},{"title":"Keeping Containers Warm","icon":"hotjar","href":"/v2/endpoint/keep-warm"},{"title":"Concurrent Inputs","icon":"cubes-stacked","href":"/v2/scaling/concurrent-inputs"},{"title":"GPU Acceleration","icon":"microchip","href":"/v2/environment/gpu"},{"title":"Versioning","icon":"code-compare","href":"/v2/endpoint/versioning"},{"title":"Sending File Payloads","icon":"file","href":"/v2/endpoint/sending-file-payloads"}]},{"group":"Building Blocks","pages":[{"title":"Running Async Tasks","icon":"layer-group","href":"/v2/task-queue/running-tasks"},{"title":"Querying Task Status","icon":"check-double","href":"/v2/task-queue/query-status"},{"title":"Running Functions Remotely","icon":"cloud","href":"/v2/function/running-functions"},{"title":"Scheduled Jobs","icon":"clock","href":"/v2/function/scheduled-job"},{"title":"Queues","icon":"grip-lines","href":"/v2/function/queues"},{"title":"Distributed Maps","icon":"book","href":"/v2/function/maps"},{"title":"Deploy Containers","icon":"docker","href":"/v2/hosting/containers"},{"title":"Deployment Lifecycle","icon":"code-branch","href":"/v2/hosting/deployments"},{"title":"Environment Variables and References","icon":"link","href":"/v2/hosting/references"},{"title":"Stacks","icon":"layer-group","href":"/v2/hosting/stacks"},{"title":"Host a Web Service","icon":"hammer","href":"/v2/pod/web-service"},{"title":"Networking","icon":"sitemap","href":"/v2/pod/networking"}]},{"group":"Container Images","pages":[{"title":"Container Images","icon":"gears","href":"/v2/environment/custom-images"},{"title":"Custom Registries","icon":"list","href":"/v2/environment/custom-registries"},{"title":"CPU and RAM","icon":"server","href":"/v2/environment/resources"},{"title":"Storing Secrets","icon":"lock","href":"/v2/environment/secrets"}]},{"group":"Data and Storage","pages":[{"title":"Managed Databases","icon":"database","href":"/v2/data/databases"},{"title":"Distributed Storage Volumes","icon":"hard-drive","href":"/v2/data/volume"},{"title":"Durable Disks","icon":"database","href":"/v2/data/durable-disks"},{"title":"Mounting S3 Buckets","icon":"bucket","href":"/v2/data/external-storage"},{"title":"Ephemeral Files and Images","icon":"upload","href":"/v2/data/output"}]},{"group":"Scaling","pages":[{"title":"Scaling Out","icon":"boxes-stacked","href":"/v2/scaling/concurrency"},{"title":"Parallelizing Functions","icon":"boxes-stacked","href":"/v2/scaling/parallelizing-functions"}]},{"group":"Operations","pages":[{"title":"Logs and Metrics","icon":"chart-line","href":"/v2/operations/observability"},{"title":"Workspace MCP","icon":"plug","href":"/v2/operations/mcp"},{"title":"Webhooks","icon":"webhook","href":"/v2/operations/webhooks"}]},{"group":"Run in Your Cloud","pages":[{"title":"Compute Pools","icon":"server","href":"/v2/scaling/pools"},{"title":"Overview","icon":"building","href":"/v2/self-hosting/overview"},{"title":"Local Development Cluster","icon":"computer","href":"/v2/self-hosting/local-machine"},{"title":"Deploying Beta9 on AWS","icon":"aws","href":"/v2/self-hosting/aws"}]},{"group":"Advanced Topics","pages":[{"title":"Integrate into CI/CD","icon":"link","href":"/v2/topics/ci"},{"title":"Input and Output Schemas","icon":"brackets-curly","href":"/v2/topics/schemas"},{"title":"Timeouts and Retries","icon":"clock","href":"/v2/topics/timeouts-and-retries"},{"title":"Public Endpoints","icon":"unlock","href":"/v2/topics/public-endpoints"},{"title":"Task Callbacks","icon":"bell","href":"/v2/topics/callbacks"},{"title":"Send Events Between Apps","icon":"circle","href":"/v2/topics/signal"},{"title":"Runtime Variables","icon":"code","href":"/v2/topics/context"},{"title":"Working in Jupyter Notebooks","icon":"book","href":"/v2/environment/jupyter-notebook"},{"title":"Remote vs. Local Environment","icon":"house","href":"/v2/environment/remote-versus-local"}]},{"group":"Resources","pages":[{"title":"Pricing and Billing","icon":"dollar-sign","href":"/v2/resources/pricing-and-billing"},{"title":"Using Beam Docs with AI Tools","icon":"robot","href":"/v2/resources/ai-tools"},{"title":"Troubleshooting","icon":"question","href":"/v2/resources/faq"}]},{"group":"Security","pages":[{"title":"Security overview","icon":"shield-halved","href":"/v2/security/security"},{"title":"Terms of Service","icon":"handshake","href":"/v2/security/terms-and-conditions"},{"title":"Privacy Policy","icon":"user-secret","href":"/v2/security/privacy-policy"},{"title":"Data Processing Addendum","icon":"file-shield","hidden":true,"href":"/v2/security/data-processing-addendum"},{"title":"Subprocessor List","icon":"list-check","hidden":true,"href":"/v2/security/subprocessor-list"}]}]},{"tab":"Examples","pages":[{"title":"Examples","href":"/v2/examples/overview"}]},{"tab":"Python SDK","pages":[{"title":"Python SDK","href":"/v2/reference/py-sdk"}]},{"tab":"JavaScript / TypeScript","pages":[{"title":"JavaScript / TypeScript","href":"/v2/reference/ts-sdk"}]},{"tab":"CLI","pages":[{"title":"CLI","href":"/v2/reference/cli"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/v2/reference/api"}]}]},"basePath":"","title":"Creating a Web Endpoint - Beam","buildId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","deploymentId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","dynamics":[],"chunks":[]}