Beam apps can be deployed using the RestAPI trigger.Input and output fields are serialized and validated by the Beam.Types module.Here’s an example of what
this might look like:
The beam library includes several basic data types that can be used to
validate your inputs against.
Type
Description
beam.types.Json()
A JSON object
beam.types.String(max_length=None)
A string field, with an optional max_length parameter
beam.types.Float()
Standard floating point value
beam.types.Boolean()
Standard boolean value
beam.types.Tensor(shape=None, dtype=None)
A torch tensor object, with optional shape and dtype parameters
beam.types.Dataframe()
A pandas dataframe object
beam.types.NumpyArray(shape=None, dtype=None)
A numpy array, with optional shape and dtype parameters
beam.types.Binary()
A binary object, for example a video file or anything that doesn’t fit into the other types listed
beam.types.Image(raw=False)
A generic image, automatically serialized into a PIL object for use in the handler
Types can be labeled optional by passing in required=falsebeam.types.Boolean(required=false)beam.types.Dataframe(required=false)
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Slai","colors":{"primary":"#477ff7","light":"#93c5fd","dark":"#2563eb"},"favicon":"/favicon.png","logo":{"light":"https://mintcdn.com/slai-docs/x8Ejwqb1sXwT0acS/logo/light.svg?fit=max\u0026auto=format\u0026n=x8Ejwqb1sXwT0acS\u0026q=85\u0026s=db8f5b5f184192d8225e18682bdcdd17","dark":"https://mintcdn.com/slai-docs/x8Ejwqb1sXwT0acS/logo/dark.svg?fit=max\u0026auto=format\u0026n=x8Ejwqb1sXwT0acS\u0026q=85\u0026s=e9a2faa70ba540818bf6e625ae5b9f56"},"navbar":{"links":[{"label":"Dashboard","href":"https://www.slai.io/models"}],"primary":{"type":"button","label":"Start a new project","href":"https://www.slai.io/launchpad"}},"footer":{"socials":{"website":"https://slai.io"}},"integrations":{"ga4":{"measurementId":"G-XN1SS41L9X"},"logrocket":{"appId":"tmarkn/slai-production"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"slai-docs","hasAudioNarration":false,"actualSubdomain":"slai-docs","customDomains":["docs.slai.io"],"gitSource":{"type":"github","owner":"slai-labs","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae913e4efc85bd31467acd5:success","clientVersion":"0.0.4270","searchFilterCounts":[{"language":"default","tag":"Documentation","count":26},{"language":"default","tag":"Sandbox","count":7},{"language":"default","tag":"Integrations","count":5},{"language":"default","tag":"User Guides","count":5},{"language":"default","tag":"Security","count":3},{"language":"default","tag":"Dashboard","count":2},{"language":"default","tag":"Terms and Conditions","count":2},{"language":"default","tag":"API Reference","count":1},{"language":"default","tag":"Home","count":1},{"language":"default","tag":"Pricing","count":1}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","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":"rbac-expansion","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":"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":"site-roles","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":"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":"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":"editor-metadata","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":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"beam/triggers/rest-api","slug":"/beam/triggers/rest-api","pageMetadata":{"title":"REST API","description":"Deploying a Beam app as a REST API","href":"/beam/triggers/rest-api"},"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 a Beam app as a REST API\"\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`,em:`em`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage,Table,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`3`,id:`deploying-a-rest-api`,children:`Deploying a REST API`}),`\n`,_jsxs(_components.p,{children:[`Beam apps can be deployed using the `,_jsx(_components.code,{children:`RestAPI`}),` trigger.`]}),`\n`,_jsxs(_components.p,{children:[`Input and output fields are serialized and validated by the `,_jsx(_components.a,{href:`/beam/triggers/webhook#beam-types`,children:_jsx(_components.code,{children:`Beam.Types`})}),` module.`]}),`\n`,_jsx(_components.p,{children:`Here’s an example of what\nthis might look like:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,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:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`app.Trigger.RestAPI(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`\tinputs`}),_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:`: beam.Types.Float(), `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"y\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: beam.Types.Float()},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`\toutputs`}),_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:`\"sum\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: beam.Types.Float()},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`\thandler`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"test.py:add_numbers\"`}),_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`]})})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`inputs`})}),_jsx(_components.td,{children:_jsx(_components.em,{children:`dict`})}),_jsx(_components.td,{children:`A dictionary specifying the interface for the API`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`outputs`})}),_jsx(_components.td,{children:_jsx(_components.em,{children:`dict`})}),_jsx(_components.td,{children:`A dictionary specifying the outputs returned from the API`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`handler`})}),_jsx(_components.td,{children:_jsx(_components.em,{children:`string`})}),_jsx(_components.td,{children:`The function that will be run when the API is invoked`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`calling-the-api`,children:`Calling the API`}),`\n`,_jsxs(_components.p,{children:[`After deploying the API, you’ll be able to copy a cURL request to hit the API. In your app dashboard, click `,_jsx(_components.strong,{children:`Call API`}),`.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/slai-docs/0GTBstnyDK-8Z9OV/img/beam/tools/call-api.png?fit=max\u0026auto=format\u0026n=0GTBstnyDK-8Z9OV\u0026q=85\u0026s=d6589ec096d0f13cafcefb7d8c1f2bd5`,alt:`Call API`,\"data-og-width\":`1592`,width:`1592`,\"data-og-height\":`658`,height:`658`,\"data-path\":`img/beam/tools/call-api.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/slai-docs/0GTBstnyDK-8Z9OV/img/beam/tools/call-api.png?w=280\u0026fit=max\u0026auto=format\u0026n=0GTBstnyDK-8Z9OV\u0026q=85\u0026s=b6bb32116a8418f1023e5f6824106cea 280w, https://mintcdn.com/slai-docs/0GTBstnyDK-8Z9OV/img/beam/tools/call-api.png?w=560\u0026fit=max\u0026auto=format\u0026n=0GTBstnyDK-8Z9OV\u0026q=85\u0026s=5f947742d0fe2ffcd9ecf401bb1e5a6d 560w, https://mintcdn.com/slai-docs/0GTBstnyDK-8Z9OV/img/beam/tools/call-api.png?w=840\u0026fit=max\u0026auto=format\u0026n=0GTBstnyDK-8Z9OV\u0026q=85\u0026s=eddacc3bfca92de749c5a41c7b4ad3b4 840w, https://mintcdn.com/slai-docs/0GTBstnyDK-8Z9OV/img/beam/tools/call-api.png?w=1100\u0026fit=max\u0026auto=format\u0026n=0GTBstnyDK-8Z9OV\u0026q=85\u0026s=94e08741406f6b2e8b4591725f100bb4 1100w, https://mintcdn.com/slai-docs/0GTBstnyDK-8Z9OV/img/beam/tools/call-api.png?w=1650\u0026fit=max\u0026auto=format\u0026n=0GTBstnyDK-8Z9OV\u0026q=85\u0026s=b2d1465ed4f43b914937c0afe5078153 1650w, https://mintcdn.com/slai-docs/0GTBstnyDK-8Z9OV/img/beam/tools/call-api.png?w=2500\u0026fit=max\u0026auto=format\u0026n=0GTBstnyDK-8Z9OV\u0026q=85\u0026s=cee376d230feff207d4ef9d4aca3f3d6 2500w`}),`\n`,_jsx(Heading,{level:`3`,id:`example-request`,children:`Example Request`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,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:_jsxs(_components.code,{language:`text`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`curl -X POST --compressed \"https://beam.slai.io/ahg0v\" \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -H 'Accept: */*' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -H 'Accept-Encoding: gzip, deflate' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -H 'Authorization: Basic dW5kZWZpbmVkOnVuZGVmaW5lZA==' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -H 'Connection: keep-alive' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -H 'Content-Type: application/json' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -d '{\"prompt\": \"Here's my example prompt\"}'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`3`,id:`example-response`,children:`Example Response`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,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:`7`,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:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"prediction\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"{'POSITIVE': 0.9988627433776855, 'NEGATIVE': 0.0011372779263183475}\"`})]}),`\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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"msg\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},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:` \"error_msg\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`beam-types`,children:`Beam Types`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.strong,{children:`beam`}),` library includes several basic data types that can be used to\nvalidate your inputs against.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`beam.types.Json()`})}),_jsx(_components.td,{children:`A JSON object`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`beam.types.String(max_length=None)`})}),_jsx(_components.td,{children:`A string field, with an optional max_length parameter`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`beam.types.Float()`})}),_jsx(_components.td,{children:`Standard floating point value`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`beam.types.Boolean()`})}),_jsx(_components.td,{children:`Standard boolean value`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`beam.types.Tensor(shape=None, dtype=None)`})}),_jsx(_components.td,{children:`A torch tensor object, with optional shape and dtype parameters`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`beam.types.Dataframe()`})}),_jsx(_components.td,{children:`A pandas dataframe object`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`beam.types.NumpyArray(shape=None, dtype=None)`})}),_jsx(_components.td,{children:`A numpy array, with optional shape and dtype parameters`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`beam.types.Binary()`})}),_jsx(_components.td,{children:`A binary object, for example a video file or anything that doesn’t fit into the other types listed`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`beam.types.Image(raw=False)`})}),_jsx(_components.td,{children:`A generic image, automatically serialized into a PIL object for use in the handler`})]})]})]}),`\n`,_jsxs(Tip,{children:[_jsxs(_components.p,{children:[`Types can be labeled optional by passing in `,_jsx(_components.code,{children:`required=false`})]}),_jsx(_components.p,{children:_jsx(_components.code,{children:`beam.types.Boolean(required=false)`})}),_jsx(_components.p,{children:_jsx(_components.code,{children:`beam.types.Dataframe(required=false)`})})]})]})}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":"REST API","description":"Deploying a Beam app as a REST API","href":"/beam/triggers/rest-api"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Deploying a REST API","slug":"deploying-a-rest-api","depth":3,"children":[]},{"title":"Calling the API","slug":"calling-the-api","depth":3,"children":[]},{"title":"Example Request","slug":"example-request","depth":3,"children":[]},{"title":"Example Response","slug":"example-response","depth":3,"children":[]},{"title":"Beam Types","slug":"beam-types","depth":3,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"slai-docs","siteName":"Slai","title":"REST API - Slai","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-06T22:37:44.621Z","originalFileLocation":"beam/triggers/rest-api.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 a Beam app as a REST API\">\u003cmeta data-mint-head name=\"application-name\" content=\"Slai\">\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-docs/SXx20scKi4GaiL1r/_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-docs/SXx20scKi4GaiL1r/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/slai-docs/SXx20scKi4GaiL1r/_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-docs/SXx20scKi4GaiL1r/_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-docs/SXx20scKi4GaiL1r/_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-docs/SXx20scKi4GaiL1r/_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-docs/SXx20scKi4GaiL1r/_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-docs/SXx20scKi4GaiL1r/_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-docs/SXx20scKi4GaiL1r/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"REST API - Slai\">\u003cmeta data-mint-head property=\"og:description\" content=\"Deploying a Beam app as a REST API\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Slai\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.slai.io/beam/triggers/rest-api\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://slai-docs.mintlify.site/_mintlify/api/og/v2?division=Triggers\u0026amp;title=REST+API\u0026amp;description=Deploying+a+Beam+app+as+a+REST+API\u0026amp;theme=472d36610d7350bc36259636\u0026amp;signature=de2f50683e2c6bccc83efa788c170571a081bb90c9e2c0ce8f23ae8d12b03b9c\">\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=\"REST API - Slai\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Deploying a Beam app as a REST API\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://slai-docs.mintlify.site/_mintlify/api/og/v2?division=Triggers\u0026amp;title=REST+API\u0026amp;description=Deploying+a+Beam+app+as+a+REST+API\u0026amp;theme=472d36610d7350bc36259636\u0026amp;signature=de2f50683e2c6bccc83efa788c170571a081bb90c9e2c0ce8f23ae8d12b03b9c\">\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-docs/SXx20scKi4GaiL1r/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Slai\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#477ff7\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.slai.io/beam/triggers/rest-api\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/beam/triggers/rest-api.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.slai.io/#organization\",\"name\":\"Slai\",\"url\":\"https://docs.slai.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/slai-docs/x8Ejwqb1sXwT0acS/logo/light.svg?fit=max\u0026auto=format\u0026n=x8Ejwqb1sXwT0acS\u0026q=85\u0026s=db8f5b5f184192d8225e18682bdcdd17\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.slai.io#website\",\"name\":\"Slai\",\"url\":\"https://docs.slai.io\",\"publisher\":{\"@id\":\"https://docs.slai.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.slai.io/beam/triggers/rest-api#webpage\",\"url\":\"https://docs.slai.io/beam/triggers/rest-api\",\"name\":\"REST API\",\"description\":\"Deploying a Beam app as a REST API\",\"dateModified\":\"2026-01-06T22:37:44.621Z\",\"isPartOf\":{\"@id\":\"https://docs.slai.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.slai.io/beam/triggers/rest-api#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.slai.io/beam/triggers/rest-api#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Slai\",\"item\":\"https://docs.slai.io\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"REST API\",\"item\":\"https://docs.slai.io/beam/triggers/rest-api\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.slai.io/beam/triggers/rest-api#article\",\"headline\":\"REST API\",\"name\":\"REST API\",\"description\":\"Deploying a Beam app as a REST API\",\"url\":\"https://docs.slai.io/beam/triggers/rest-api\",\"mainEntityOfPage\":{\"@id\":\"https://docs.slai.io/beam/triggers/rest-api#webpage\"},\"dateModified\":\"2026-01-06T22:37:44.621Z\",\"publisher\":{\"@id\":\"https://docs.slai.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.slai.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Slai\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Slai\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/beam/triggers/rest-api.md","siteName":"Slai","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":"/introduction"}]},{"anchor":"Launchpad","href":"https://www.slai.io/launchpad","icon":"rocket-launch","color":{"light":"#6365f1","dark":"#6365f1"}},{"anchor":"Chat with us","href":"https://calendly.com/elimernit/slai-discovery-call","icon":"comment-dots","color":{"light":"#06b5d4","dark":"#06b5d4"}},{"anchor":"Migrate Your Model","href":"https://docs.slai.io/user-guides/migrating-an-existing-model","icon":"comments","color":{"light":"#6365f1","dark":"#6365f1"}},{"anchor":"Beam","hidden":true,"icon":"satellite-dish","groups":[{"group":"Guides","pages":[{"title":"Introduction","description":"Beam is a cloud platform where you can provision infrastructure, develop on remote runtimes from your local machine, and deploy apps as serverless functions — without leaving your IDE","href":"/beam"},{"title":"Quickstart","description":"Get started with Beam in just a few minutes","href":"/beam/getting-started/quickstart"},{"title":"Install Beam","description":null,"href":"/beam/getting-started/install-beam"},{"title":"Deploying an ML Model","description":"A short tutorial on building a sentiment analysis model and deploying it as a REST API with Beam","href":"/beam/getting-started/deploying-an-ml-model"},{"title":"Running a Web Scraper","description":"Let's build a simple web scraper which extracts headlines from The New York Times and uses a BERT model from Huggingface to detect the sentiment of each.","href":"/beam/getting-started/running-a-web-scraper"},{"title":"Stable Diffusion API","description":"Building an API to generate images with stable diffusion","href":"/beam/getting-started/stable-diffusion-gpu"},{"title":"Integration into CI/CD","description":"You can integrate Beam into an existing CI/CD process to deploy your code automatically.","href":"/beam/getting-started/ci-integration"}]},{"group":"Triggers","pages":[{"title":"REST API","href":"/beam/triggers/rest-api"},{"title":"Webhook","description":"Deploy async functions on Beam","href":"/beam/triggers/webhook"},{"title":"Scheduled Cron Jobs","description":"Scheduling tasks on Beam","href":"/beam/triggers/cron"}]},{"group":"Data","pages":[{"title":"Outputs","description":"Read and write files from inside a Beam environment","href":"/beam/data/outputs"},{"title":"Persistent Volumes","description":"A readable and writable data store that will persist across tasks","href":"/beam/data/persistent-volumes"}]},{"group":"Deployment","pages":[{"title":"Logging and Monitoring","description":"After deploying, you can view the traffic and container logs on your task in the dashboard.","href":"/beam/deployment/logging-and-monitoring"}]},{"group":"Tools","pages":[{"title":"CLI","description":"Build and deploy Beam apps directly from the command line","href":"/beam/tools/cli"},{"title":"SDK","description":"The library for creating and managing Beam apps","href":"/beam/tools/sdk"}]},{"group":"Account","pages":[{"title":"API Keys","description":"API keys are used to access the CLI and SDK","href":"/beam/account/api-keys"},{"title":"Secrets Management","description":"Beam includes a secrets manager that allows you to use secrets across your projects.","href":"/beam/account/secrets-management"},{"title":"Pricing and Billing","description":null,"href":"/beam/account/pricing-and-billing"}]},{"group":"Security","pages":[{"title":"Terms and Conditions","description":"These are the terms the Slai Machine Learning Platform is provided under.","href":"/beam/security/terms-and-conditions"},{"title":"Privacy Policy","description":null,"href":"/beam/security/privacy-policy"}]}]}]},"basePath":"","title":"REST API - Slai","deploymentId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","buildId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-BQ4tbj_9.js","lightbox-handle-r17bVUz3.js"]}