Install the lotus-typescript package for use in your typescript server. It is important to note that all input parameters and responses should be in snake_case!
npm install lotus-typescript
yarn add lotus-typescript
Initializing
Follow the steps in the API Overview to get an API key, and then set it in your code. Additionally, if you’re self-hosting, you can set the host to your self-hosted instance.
import Lotus = require("lotus-typescript")//If the line above presents erros, use this import below//const {Lotus} = require("lotus-typescript/dist/index.js");const api_key= "YOUR API KEY";const lotus = new Lotus(api_key, { host: "https://api.uselotus.io/", // You can omit this line if using Lotus Cloud});
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Lotus","colors":{"primary":"#C3986B","light":"#FFECD2","dark":"#3A3A3A"},"favicon":"https://mintcdn.com/lotus/HlrVno1vSHfnJwCd/favicon.png?fit=max\u0026auto=format\u0026n=HlrVno1vSHfnJwCd\u0026q=85\u0026s=f00ab5bfd2b64dc25cf303cb98465466","logo":{"light":"https://mintcdn.com/lotus/HlrVno1vSHfnJwCd/logo/light.svg?fit=max\u0026auto=format\u0026n=HlrVno1vSHfnJwCd\u0026q=85\u0026s=4682f6784b28863e5693f044eeb5cc43","dark":"https://mintcdn.com/lotus/HlrVno1vSHfnJwCd/logo/dark.svg?fit=max\u0026auto=format\u0026n=HlrVno1vSHfnJwCd\u0026q=85\u0026s=72afa819a0c40b3f39e7528d403b1fc8"},"api":{"openapi":"openapi.yaml","mdx":{"server":"https://api.uselotus.io","auth":{"method":"key","name":"X-API-KEY"}}},"background":{"decoration":null,"color":{"light":null,"dark":"#171717"}},"navbar":{"links":[{"label":"GitHub Repo","href":"https://github.com/uselotus/lotus"}],"primary":{"type":"button","label":"Sign Up","href":"https://form.typeform.com/to/pehx2YSQ"}},"footer":{"socials":{"linkedin":"https://www.linkedin.com/company/uselotusio/","twitter":"https://twitter.com/uselotusio","instagram":"https://www.instagram.com/uselotusio/"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"lotus","hasAudioNarration":false,"actualSubdomain":"lotus","customDomains":["docs.uselotus.io"],"gitSource":{"type":"github","owner":"uselotus","repo":"lotus","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a98bddf12e4713d1d355344","clientVersion":"0.0.4377","searchFilterCounts":[{"language":"default","tag":"API Reference","count":60},{"language":"default","tag":"Documentation","count":24},{"language":"default","tag":"Subscriptions","count":11},{"language":"default","tag":"Credits","count":5},{"language":"default","tag":"External Integrations","count":5},{"language":"default","tag":"Subscription Lifecycle","count":5},{"language":"default","tag":"Overview","count":4},{"language":"default","tag":"Customers","count":3},{"language":"default","tag":"Invoices","count":3},{"language":"default","tag":"Deprecated Methods","count":3}]},"assistantConfig":{},"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":"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":"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":"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":"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":"turbopuffer-dual-write","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":"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":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"api-reference/typescript-guide","slug":"/api-reference/typescript-guide","pageMetadata":{"title":"Typescript Library","description":null,"href":"/api-reference/typescript-guide"},"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={code:`code`,em:`em`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`installing`,children:`Installing`}),`\n`,_jsxs(_components.p,{children:[`Install the lotus-typescript package for use in your typescript server. It is important to note that all input parameters and responses should be in `,_jsx(_components.em,{children:`snake_case`}),`!`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`npm`,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:`npm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` lotus-typescript`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`yarn`,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:`yarn`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` add`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` lotus-typescript`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`2`,id:`initializing`,children:`Initializing`}),`\n`,_jsx(_components.p,{children:`Follow the steps in the API Overview to get an API key, and then set it in your code. Additionally, if you’re self-hosting, you can set the host to your self-hosted instance.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,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:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`import`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Lotus`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`\"lotus-typescript\"`}),_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:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`//If`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` the`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` line`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` above`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` presents`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` erros,`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` use`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` this`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` import`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` below`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`//const`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` {Lotus}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`\"lotus-typescript/dist/index.js\"`}),_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:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`const`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` api_key=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"YOUR API KEY\"`}),_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:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`const`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` lotus`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` new`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Lotus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`api_key,`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` host:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.uselotus.io/\",`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` //`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` You`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` can`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` omit`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` this`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` line`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` if`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` using`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Lotus`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Cloud`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})]})}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":"Typescript Library","description":null,"href":"/api-reference/typescript-guide"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Installing","slug":"installing","depth":2,"children":[]},{"title":"Initializing","slug":"initializing","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"lotus","siteName":"Lotus","title":"Typescript Library - Lotus","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-03T00:23:17.805Z","originalFileLocation":"api-reference/typescript-guide.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=\"application-name\" content=\"Lotus\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lotus/MiITvKPMr80Jfh6t/_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/lotus/MiITvKPMr80Jfh6t/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lotus/MiITvKPMr80Jfh6t/_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/lotus/MiITvKPMr80Jfh6t/_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/lotus/MiITvKPMr80Jfh6t/_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/lotus/MiITvKPMr80Jfh6t/_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/lotus/MiITvKPMr80Jfh6t/_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/lotus/MiITvKPMr80Jfh6t/_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/lotus/MiITvKPMr80Jfh6t/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Typescript Library - Lotus\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Lotus\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.uselotus.io/api-reference/typescript-guide\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://lotus.mintlify.site/_mintlify/api/og/v2?division=SDK+Setup\u0026amp;title=Typescript+Library\u0026amp;theme=850f94eaa8b43b0c4fea2974\u0026amp;signature=b9c39793aea0cdc968a31d6562ebed02b9377a53dc23a2970616a8b5e2adb288\">\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=\"Typescript Library - Lotus\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://lotus.mintlify.site/_mintlify/api/og/v2?division=SDK+Setup\u0026amp;title=Typescript+Library\u0026amp;theme=850f94eaa8b43b0c4fea2974\u0026amp;signature=b9c39793aea0cdc968a31d6562ebed02b9377a53dc23a2970616a8b5e2adb288\">\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/lotus/MiITvKPMr80Jfh6t/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Lotus\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#C3986B\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.uselotus.io/api-reference/typescript-guide\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/typescript-guide.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.uselotus.io/#organization\",\"name\":\"Lotus\",\"url\":\"https://docs.uselotus.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/lotus/HlrVno1vSHfnJwCd/logo/light.svg?fit=max\u0026auto=format\u0026n=HlrVno1vSHfnJwCd\u0026q=85\u0026s=4682f6784b28863e5693f044eeb5cc43\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.uselotus.io#website\",\"name\":\"Lotus\",\"url\":\"https://docs.uselotus.io\",\"publisher\":{\"@id\":\"https://docs.uselotus.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.uselotus.io/api-reference/typescript-guide#webpage\",\"url\":\"https://docs.uselotus.io/api-reference/typescript-guide\",\"name\":\"Typescript Library\",\"dateModified\":\"2026-09-03T00:23:17.805Z\",\"isPartOf\":{\"@id\":\"https://docs.uselotus.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.uselotus.io/api-reference/typescript-guide#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.uselotus.io/api-reference/typescript-guide#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Reference\",\"item\":\"https://docs.uselotus.io/api-reference/api-overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SDK Setup\",\"item\":\"https://docs.uselotus.io/api-reference/python-guide\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Typescript Library\",\"item\":\"https://docs.uselotus.io/api-reference/typescript-guide\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.uselotus.io/api-reference/typescript-guide#article\",\"headline\":\"Typescript Library\",\"name\":\"Typescript Library\",\"url\":\"https://docs.uselotus.io/api-reference/typescript-guide\",\"mainEntityOfPage\":{\"@id\":\"https://docs.uselotus.io/api-reference/typescript-guide#webpage\"},\"dateModified\":\"2026-09-03T00:23:17.805Z\",\"publisher\":{\"@id\":\"https://docs.uselotus.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.uselotus.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Lotus\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Lotus\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/typescript-guide.md","siteName":"Lotus","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":"/overview/why-lotus"}]},{"anchor":"API Reference","icon":"square-terminal","groups":[{"group":"API Reference","pages":[{"title":"API Overview","openapi":"GET /api/ping/","href":"/api-reference/api-overview"},{"group":"SDK Setup","pages":[{"title":"Python Library","description":null,"href":"/api-reference/python-guide"},{"title":"Typescript Library","href":"/api-reference/typescript-guide"}]},{"group":"Events","pages":[{"openapi":"POST /api/track/","description":"Tracking product usage is one of the most common operations you'll make in Lotus.\nIt's used to capture any event that you might want to bill on at any point.","title":null,"href":"/api-reference/events/tracking"},{"openapi":"POST /api/verify_idems_received/","title":"Verify Event Ingestion","href":"/api-reference/events/verify-ingestion"}]},{"group":"Customers","pages":[{"title":"Create a customer","openapi":"POST /api/customers/","href":"/api-reference/customers/create-customer"},{"title":"Get a customer","openapi":"GET /api/customers/{customer_id}/","href":"/api-reference/customers/retrieve-customer"},{"title":"List customers","openapi":"GET /api/customers/","href":"/api-reference/customers/list-customers"}]},{"group":"Entitlements","pages":[{"openapi":"GET /api/feature_access/","title":"Get Feature Access","href":"/api-reference/access/feature-access"},{"openapi":"GET /api/metric_access/","title":"Get Metric Access","href":"/api-reference/access/metric-access"}]},{"group":"Subscriptions","pages":[{"openapi":"POST /api/subscriptions/","title":"Create a subscription","href":"/api-reference/subscriptions/create-subscription"},{"title":"Cancel a subscription","openapi":"POST /api/subscriptions/{subscription_id}/cancel/","href":"/api-reference/subscriptions/cancel-subscription"},{"title":"Update a subscription","openapi":"POST /api/subscriptions/{subscription_id}/update/","href":"/api-reference/subscriptions/change-subscription"},{"title":"Switch a subscription's plan","openapi":"POST /api/subscriptions/{subscription_id}/switch_plan/","href":"/api-reference/subscriptions/switch-subscription-plan"},{"title":"Change Prepaid Units","openapi":"POST /api/subscriptions/{subscription_id}/components/{metric_id}/change_prepaid_units/","href":"/api-reference/subscriptions/change-prepaid-units"},{"openapi":"POST /api/subscriptions/{subscription_id}/addons/attach/","title":"Attach an Add-On","href":"/api-reference/subscriptions/attach-addon"},{"openapi":"POST /api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/","title":"Cancel an Add-On","href":"/api-reference/subscriptions/cancel-addon"},{"title":"List subscriptions","openapi":"GET /api/subscriptions/","href":"/api-reference/subscriptions/list-subscriptions"},{"group":"Deprecated Methods","pages":[{"openapi":"POST /api/subscriptions/add/","title":"Create a subscription","href":"/api-reference/subscriptions/create-subscription-old"},{"title":"Cancel a subscription","openapi":"POST /api/subscriptions/cancel/","href":"/api-reference/subscriptions/cancel-subscription-old"},{"title":"Update a subscription","openapi":"POST /api/subscriptions/update/","href":"/api-reference/subscriptions/change-subscription-old"}]}]},{"group":"Plans","pages":[{"title":"List plans","openapi":"GET /api/plans/","href":"/api-reference/plans/list-plans"},{"openapi":"GET /api/plans/{plan_id}/","title":"Get Plan","href":"/api-reference/plans/retrieve-plan"}]},{"group":"Invoices","pages":[{"title":"List invoices","openapi":"GET /api/invoices/","href":"/api-reference/invoices/list-invoices"},{"title":"Get invoice","openapi":"GET /api/invoices/{invoice_id}/","href":"/api-reference/invoices/get-invoice"},{"title":"Get Invoice PDF","openapi":"GET /api/invoices/{invoice_id}/pdf_url/","href":"/api-reference/invoices/get-invoice-pdf"}]},{"group":"Credits","pages":[{"title":"List credits","openapi":"GET /api/credits/","href":"/api-reference/credits/list-credits"},{"title":"Create a credit","openapi":"POST /api/credits/","href":"/api-reference/credits/create-credit"},{"title":"Void credit","openapi":"POST /api/credits/{credit_id}/void/","href":"/api-reference/credits/void-credit"},{"title":"Update credit","openapi":"POST /api/credits/{credit_id}/update/","href":"/api-reference/credits/update-credit"}]}]}]},{"anchor":"Blog","href":"https://www.uselotus.io/journal","icon":"newspaper"},{"anchor":"Github","href":"https://github.com/uselotus/lotus","icon":"github"},{"anchor":"Community","href":"https://join.slack.com/t/lotus-community/shared_invite/zt-1ghi61p9j-ADYbp3tEL~N16AxQr2mlzA","icon":"slack"}]},"basePath":"","title":"Typescript Library - Lotus","deploymentId":"dpl_Ab6nteg7kvyK8iL73naC2n7fmsWK","buildId":"dpl_Ab6nteg7kvyK8iL73naC2n7fmsWK","dynamics":[],"chunks":[]}