Files
SpacetimeDB/docs/build/http/database/index.html
T
Julien Lavocat c20c30524b Remove old docs
2025-10-21 12:12:01 +02:00

267 lines
66 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-HTTP API/database" data-has-hydrated="false">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v3.9.1">
<title data-rh="true">/v1/database | SpacetimeDB docs</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://docs.spacetimedb.com/http/database"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="/v1/database | SpacetimeDB docs"><meta data-rh="true" name="description" content="The HTTP endpoints in /v1/database allow clients to interact with Spacetime databases in a variety of ways, including retrieving information, creating and deleting databases, invoking reducers and evaluating SQL queries."><meta data-rh="true" property="og:description" content="The HTTP endpoints in /v1/database allow clients to interact with Spacetime databases in a variety of ways, including retrieving information, creating and deleting databases, invoking reducers and evaluating SQL queries."><link data-rh="true" rel="icon" href="/images/favicon.ico"><link data-rh="true" rel="canonical" href="https://docs.spacetimedb.com/http/database"><link data-rh="true" rel="alternate" href="https://docs.spacetimedb.com/http/database" hreflang="en"><link data-rh="true" rel="alternate" href="https://docs.spacetimedb.com/http/database" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://QBC7Z9KXS2-dsn.algolia.net" crossorigin="anonymous"><script data-rh="true" type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"/v1/database","item":"https://docs.spacetimedb.com/http/database"}]}</script><link rel="search" type="application/opensearchdescription+xml" title="SpacetimeDB docs" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.0cb9f7a7.css">
<script src="/assets/js/runtime~main.d71df0f5.js" defer="defer"></script>
<script src="/assets/js/main.31d95d83.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
<svg style="display: none;"><defs>
<symbol id="theme-svg-external-link" viewBox="0 0 24 24"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"/></symbol>
</defs></svg>
<script>document.documentElement.setAttribute("data-theme","light"),document.documentElement.setAttribute("data-theme-choice","light"),function(){try{const c=new URLSearchParams(window.location.search).entries();for(var[t,e]of c)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><div id="__docusaurus"><link rel="preload" as="image" href="https://spacetimedb.com/images/brand.png"><div role="region" aria-label="Skip to main content"><a class="skipToContent_6jFv" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="theme-layout-navbar navbar navbar--fixed-top"><div class="navbar__inner"><div class="theme-layout-navbar-left navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://spacetimedb.com/images/brand.png" alt="SpacetimeDB Logo" class="themedComponent_rvet themedComponent--light_mbAJ"><img src="https://spacetimedb.com/images/brand.png" alt="SpacetimeDB Logo" class="themedComponent_rvet themedComponent--dark_Ncy6"></div></a><div class="navbarSearchContainer_AesG"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search (Command+K)"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div><div class="theme-layout-navbar-right navbar__items navbar__items--right"><a href="https://spacetimedb.com/install" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Install</a><a href="https://spacetimedb.com/pricing" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Pricing</a><a href="https://spacetimedb.com/maincloud" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Maincloud</a><a href="https://spacetimedb.com/blog" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Blog</a><a href="https://spacetimedb.com/community" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Community</a></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="theme-layout-main main-wrapper mainWrapper_hV_y"><div class="docsWrapper_f07g"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_MJiz" type="button"></button><div class="docRoot_Gd2s"><aside class="theme-doc-sidebar-container docSidebarContainer_fSpF"><div class="sidebarViewport_YElg"><div class="sidebar_kjg4"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_AG0n"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/"><span title="Intro" class="categoryLinkLabel_EDYQ">Intro</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/deploying/maincloud"><span title="Deploying" class="categoryLinkLabel_EDYQ">Deploying</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/unity"><span title="Unity tutorial" class="categoryLinkLabel_EDYQ">Unity tutorial</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/unreal"><span title="Unreal Tutorial" class="categoryLinkLabel_EDYQ">Unreal Tutorial</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/cli-reference"><span title="CLI Reference" class="categoryLinkLabel_EDYQ">CLI Reference</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/modules"><span title="Server Module Languages" class="categoryLinkLabel_EDYQ">Server Module Languages</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/sdks"><span title="Client SDK Languages" class="categoryLinkLabel_EDYQ">Client SDK Languages</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/sql"><span title="SQL" class="categoryLinkLabel_EDYQ">SQL</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/subscriptions"><span title="Subscriptions" class="categoryLinkLabel_EDYQ">Subscriptions</span></a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/rls"><span title="Row Level Security" class="linkLabel_dpMB">Row Level Security</span></a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/how-to/incremental-migrations"><span title="How-To" class="categoryLinkLabel_EDYQ">How-To</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/spacetimeauth"><span title="SpacetimeAuth" class="categoryLinkLabel_EDYQ">SpacetimeAuth</span></a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" role="button" aria-expanded="true" href="/http/authorization"><span title="HTTP API" class="categoryLinkLabel_EDYQ">HTTP API</span></a></div><ul class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/http/authorization"><span title="Authorization" class="linkLabel_dpMB">Authorization</span></a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/http/identity"><span title="/v1/identity" class="linkLabel_dpMB">/v1/identity</span></a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/http/database"><span title="/v1/database" class="linkLabel_dpMB">/v1/database</span></a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="categoryLink_ggI5 menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/webassembly-abi"><span title="Internals" class="categoryLinkLabel_EDYQ">Internals</span></a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/appendix"><span title="Appendix" class="linkLabel_dpMB">Appendix</span></a></li></ul></nav></div></div></aside><main class="docMainContainer_dkUT"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_w2oE"><div class="docItemContainer_f71m"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_xsLZ" aria-label="Breadcrumbs"><ul class="breadcrumbs"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_oyay"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">HTTP API</span></li><li class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link">/v1/database</span></li></ul></nav><div class="tocCollapsible_dqme theme-doc-toc-mobile tocMobile_Z34P"><button type="button" class="clean-btn tocCollapsibleButton_QMSE">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><code>/v1/database</code></h1></header>
<p>The HTTP endpoints in <code>/v1/database</code> allow clients to interact with Spacetime databases in a variety of ways, including retrieving information, creating and deleting databases, invoking reducers and evaluating SQL queries.</p>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="at-a-glance">At a glance<a href="#at-a-glance" class="hash-link" aria-label="Direct link to At a glance" title="Direct link to At a glance" translate="no"></a></h2>
<table><thead><tr><th>Route</th><th>Description</th></tr></thead><tbody><tr><td><a href="#post-v1database"><code>POST /v1/database</code></a></td><td>Publish a new database given its module code.</td></tr><tr><td><a href="#post-v1databasename_or_identity"><code>POST /v1/database/:name_or_identity</code></a></td><td>Publish to a database given its module code.</td></tr><tr><td><a href="#get-v1databasename_or_identity"><code>GET /v1/database/:name_or_identity</code></a></td><td>Get a JSON description of a database.</td></tr><tr><td><a href="#post-v1databasename_or_identity"><code>DELETE /v1/database/:name_or_identity</code></a></td><td>Delete a database.</td></tr><tr><td><a href="#get-v1databasename_or_identitynames"><code>GET /v1/database/:name_or_identity/names</code></a></td><td>Get the names this database can be identified by.</td></tr><tr><td><a href="#post-v1databasename_or_identitynames"><code>POST /v1/database/:name_or_identity/names</code></a></td><td>Add a new name for this database.</td></tr><tr><td><a href="#put-v1databasename_or_identitynames"><code>PUT /v1/database/:name_or_identity/names</code></a></td><td>Set the list of names for this database.</td></tr><tr><td><a href="#get-v1databasename_or_identityidentity"><code>GET /v1/database/:name_or_identity/identity</code></a></td><td>Get the identity of a database.</td></tr><tr><td><a href="#get-v1databasename_or_identitysubscribe"><code>GET /v1/database/:name_or_identity/subscribe</code></a></td><td>Begin a WebSocket connection.</td></tr><tr><td><a href="#post-v1databasename_or_identitycallreducer"><code>POST /v1/database/:name_or_identity/call/:reducer</code></a></td><td>Invoke a reducer in a database.</td></tr><tr><td><a href="#get-v1databasename_or_identityschema"><code>GET /v1/database/:name_or_identity/schema</code></a></td><td>Get the schema for a database.</td></tr><tr><td><a href="#get-v1databasename_or_identitylogs"><code>GET /v1/database/:name_or_identity/logs</code></a></td><td>Retrieve logs from a database.</td></tr><tr><td><a href="#post-v1databasename_or_identitysql"><code>POST /v1/database/:name_or_identity/sql</code></a></td><td>Run a SQL query against a database.</td></tr></tbody></table>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="post-v1database"><code>POST /v1/database</code><a href="#post-v1database" class="hash-link" aria-label="Direct link to post-v1database" title="Direct link to post-v1database" translate="no"></a></h2>
<p>Publish a new database with no name.</p>
<p>Accessible through the CLI as <code>spacetime publish</code>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="required-headers">Required Headers<a href="#required-headers" class="hash-link" aria-label="Direct link to Required Headers" title="Direct link to Required Headers" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>A Spacetime token <a href="/http/authorization#authorization-headers">as Bearer auth</a>.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="data">Data<a href="#data" class="hash-link" aria-label="Direct link to Data" title="Direct link to Data" translate="no"></a></h4>
<p>A WebAssembly module in the <a href="https://webassembly.github.io/spec/core/binary/index.html" target="_blank" rel="noopener noreferrer">binary format</a>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns">Returns<a href="#returns" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>If the database was successfully published, returns JSON in the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{ </span><span style="color:#E9F284">&quot;</span><span style="color:#F1FA8C">Success</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: {</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">database_identity</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> string,</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">op</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">created</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6"> |</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">updated</span><span style="color:#E9F284">&quot;</span></span>
<span class="line"><span style="color:#F8F8F2">} }</span></span></code></pre>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="post-v1databasename_or_identity"><code>POST /v1/database/:name_or_identity</code><a href="#post-v1databasename_or_identity" class="hash-link" aria-label="Direct link to post-v1databasename_or_identity" title="Direct link to post-v1databasename_or_identity" translate="no"></a></h2>
<p>Publish to a database with the specified name or identity. If the name doesn&#x27;t exist, creates a new database.</p>
<p>Accessible through the CLI as <code>spacetime publish</code>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="query-parameters">Query Parameters<a href="#query-parameters" class="hash-link" aria-label="Direct link to Query Parameters" title="Direct link to Query Parameters" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>clear</code></td><td>A boolean; whether to clear any existing data when updating an existing database.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="required-headers-1">Required Headers<a href="#required-headers-1" class="hash-link" aria-label="Direct link to Required Headers" title="Direct link to Required Headers" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>A Spacetime token <a href="/http/authorization#authorization-headers">as Bearer auth</a>.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="data-1">Data<a href="#data-1" class="hash-link" aria-label="Direct link to Data" title="Direct link to Data" translate="no"></a></h4>
<p>A WebAssembly module in the <a href="https://webassembly.github.io/spec/core/binary/index.html" target="_blank" rel="noopener noreferrer">binary format</a>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns-1">Returns<a href="#returns-1" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>If the database was successfully published, returns JSON in the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{ </span><span style="color:#E9F284">&quot;</span><span style="color:#F1FA8C">Success</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: {</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">domain</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#BD93F9"> null</span><span style="color:#FF79C6"> |</span><span style="color:#F8F8F2"> string,</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">database_identity</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> string,</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">op</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">created</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6"> |</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">updated</span><span style="color:#E9F284">&quot;</span></span>
<span class="line"><span style="color:#F8F8F2">} }</span></span></code></pre>
<p>If a database with the given name exists, but the identity provided in the <code>Authorization</code> header does not have permission to edit it, returns <code>401 UNAUTHORIZED</code> along with JSON in the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{ </span><span style="color:#E9F284">&quot;</span><span style="color:#F1FA8C">PermissionDenied</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: {</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">name</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> string</span></span>
<span class="line"><span style="color:#F8F8F2">} }</span></span></code></pre>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="get-v1databasename_or_identity"><code>GET /v1/database/:name_or_identity</code><a href="#get-v1databasename_or_identity" class="hash-link" aria-label="Direct link to get-v1databasename_or_identity" title="Direct link to get-v1databasename_or_identity" translate="no"></a></h2>
<p>Get a database&#x27;s identity, owner identity, host type, number of replicas and a hash of its WASM module.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns-2">Returns<a href="#returns-2" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>Returns JSON in the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">database_identity</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: string,</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">owner_identity</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: string,</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">host_type</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: </span><span style="color:#E9F284">&quot;</span><span style="color:#F1FA8C">wasm</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">,</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">initial_program</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: string</span></span>
<span class="line"><span style="color:#F8F8F2">}</span></span></code></pre>
<table><thead><tr><th>Field</th><th>Type</th><th>Meaning</th></tr></thead><tbody><tr><td><code>&quot;database_identity&quot;</code></td><td>String</td><td>The Spacetime identity of the database.</td></tr><tr><td><code>&quot;owner_identity&quot;</code></td><td>String</td><td>The Spacetime identity of the database&#x27;s owner.</td></tr><tr><td><code>&quot;host_type&quot;</code></td><td>String</td><td>The module host type; currently always <code>&quot;wasm&quot;</code>.</td></tr><tr><td><code>&quot;initial_program&quot;</code></td><td>String</td><td>Hash of the WASM module with which the database was initialized.</td></tr></tbody></table>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="delete-v1databasename_or_identity"><code>DELETE /v1/database/:name_or_identity</code><a href="#delete-v1databasename_or_identity" class="hash-link" aria-label="Direct link to delete-v1databasename_or_identity" title="Direct link to delete-v1databasename_or_identity" translate="no"></a></h2>
<p>Delete a database.</p>
<p>Accessible through the CLI as <code>spacetime delete &lt;identity&gt;</code>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="required-headers-2">Required Headers<a href="#required-headers-2" class="hash-link" aria-label="Direct link to Required Headers" title="Direct link to Required Headers" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>A Spacetime token <a href="/http/authorization#authorization-headers">as Bearer auth</a>.</td></tr></tbody></table>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="get-v1databasename_or_identitynames"><code>GET /v1/database/:name_or_identity/names</code><a href="#get-v1databasename_or_identitynames" class="hash-link" aria-label="Direct link to get-v1databasename_or_identitynames" title="Direct link to get-v1databasename_or_identitynames" translate="no"></a></h2>
<p>Get the names this database can be identified by.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns-3">Returns<a href="#returns-3" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>Returns JSON in the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{ </span><span style="color:#E9F284">&quot;</span><span style="color:#F1FA8C">names</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: array</span><span style="color:#FF79C6">&lt;</span><span style="color:#F8F8F2">string</span><span style="color:#FF79C6">&gt;</span><span style="color:#F8F8F2"> }</span></span></code></pre>
<p>where <code>&lt;names&gt;</code> is a JSON array of strings, each of which is a name which refers to the database.</p>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="post-v1databasename_or_identitynames"><code>POST /v1/database/:name_or_identity/names</code><a href="#post-v1databasename_or_identitynames" class="hash-link" aria-label="Direct link to post-v1databasename_or_identitynames" title="Direct link to post-v1databasename_or_identitynames" translate="no"></a></h2>
<p>Add a new name for this database.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="required-headers-3">Required Headers<a href="#required-headers-3" class="hash-link" aria-label="Direct link to Required Headers" title="Direct link to Required Headers" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>A Spacetime token <a href="/http/authorization#authorization-headers">as Bearer auth</a>.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="data-2">Data<a href="#data-2" class="hash-link" aria-label="Direct link to Data" title="Direct link to Data" translate="no"></a></h4>
<p>Takes as the request body a string containing the new name of the database.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns-4">Returns<a href="#returns-4" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>If the name was successfully set, returns JSON in the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{ </span><span style="color:#E9F284">&quot;</span><span style="color:#F1FA8C">Success</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: {</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">domain</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> string,</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">database_result</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> string</span></span>
<span class="line"><span style="color:#F8F8F2">} }</span></span></code></pre>
<p>If the new name already exists but the identity provided in the <code>Authorization</code> header does not have permission to edit it, returns JSON in the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{ </span><span style="color:#E9F284">&quot;</span><span style="color:#F1FA8C">PermissionDenied</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: {</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">domain</span><span style="color:#E9F284">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> string</span></span>
<span class="line"><span style="color:#F8F8F2">} }</span></span></code></pre>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="put-v1databasename_or_identitynames"><code>PUT /v1/database/:name_or_identity/names</code><a href="#put-v1databasename_or_identitynames" class="hash-link" aria-label="Direct link to put-v1databasename_or_identitynames" title="Direct link to put-v1databasename_or_identitynames" translate="no"></a></h2>
<p>Set the list of names for this database.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="required-headers-4">Required Headers<a href="#required-headers-4" class="hash-link" aria-label="Direct link to Required Headers" title="Direct link to Required Headers" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>A Spacetime token <a href="/http/authorization#authorization-headers">as Bearer auth</a>.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="data-3">Data<a href="#data-3" class="hash-link" aria-label="Direct link to Data" title="Direct link to Data" translate="no"></a></h4>
<p>Takes as the request body a list of names, as a JSON array of strings.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns-5">Returns<a href="#returns-5" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>If the name was successfully set, returns JSON in the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{ </span><span style="color:#E9F284">&quot;</span><span style="color:#F1FA8C">Success</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: </span><span style="color:#BD93F9">null</span><span style="color:#F8F8F2"> }</span></span></code></pre>
<p>If any of the new names already exist but the identity provided in the <code>Authorization</code> header does not have permission to edit it, returns <code>401 UNAUTHORIZED</code> along with JSON in the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{ </span><span style="color:#E9F284">&quot;</span><span style="color:#F1FA8C">PermissionDenied</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: </span><span style="color:#BD93F9">null</span><span style="color:#F8F8F2"> }</span></span></code></pre>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="get-v1databasename_or_identityidentity"><code>GET /v1/database/:name_or_identity/identity</code><a href="#get-v1databasename_or_identityidentity" class="hash-link" aria-label="Direct link to get-v1databasename_or_identityidentity" title="Direct link to get-v1databasename_or_identityidentity" translate="no"></a></h2>
<p>Get the identity of a database.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns-6">Returns<a href="#returns-6" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>Returns a hex string of the specified database&#x27;s identity.</p>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="get-v1databasename_or_identitysubscribe"><code>GET /v1/database/:name_or_identity/subscribe</code><a href="#get-v1databasename_or_identitysubscribe" class="hash-link" aria-label="Direct link to get-v1databasename_or_identitysubscribe" title="Direct link to get-v1databasename_or_identitysubscribe" translate="no"></a></h2>
<p>Begin a WebSocket connection with a database.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="required-headers-5">Required Headers<a href="#required-headers-5" class="hash-link" aria-label="Direct link to Required Headers" title="Direct link to Required Headers" translate="no"></a></h4>
<p>For more information about WebSocket headers, see <a href="https://datatracker.ietf.org/doc/html/rfc6455" target="_blank" rel="noopener noreferrer">RFC 6455</a>.</p>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Sec-WebSocket-Protocol</code></td><td><code>v1.bsatn.spacetimedb</code> or <code>v1.json.spacetimedb</code></td></tr><tr><td><code>Connection</code></td><td><code>Updgrade</code></td></tr><tr><td><code>Upgrade</code></td><td><code>websocket</code></td></tr><tr><td><code>Sec-WebSocket-Version</code></td><td><code>13</code></td></tr><tr><td><code>Sec-WebSocket-Key</code></td><td>A 16-byte value, generated randomly by the client, encoded as Base64.</td></tr></tbody></table>
<p>The SpacetimeDB binary WebSocket protocol, <code>v1.bsatn.spacetimedb</code>, encodes messages as well as reducer and row data using <a href="/bsatn">BSATN</a>.
Its messages are defined <a href="https://github.com/clockworklabs/SpacetimeDB/blob/master/crates/client-api-messages/src/websocket.rs" target="_blank" rel="noopener noreferrer">here</a>.</p>
<p>The SpacetimeDB text WebSocket protocol, <code>v1.json.spacetimedb</code>, encodes messages according to the <a href="/sats-json">SATS-JSON format</a>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="optional-headers">Optional Headers<a href="#optional-headers" class="hash-link" aria-label="Direct link to Optional Headers" title="Direct link to Optional Headers" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>A Spacetime token <a href="/http/authorization#authorization-headers">as Bearer auth</a>.</td></tr></tbody></table>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="post-v1databasename_or_identitycallreducer"><code>POST /v1/database/:name_or_identity/call/:reducer</code><a href="#post-v1databasename_or_identitycallreducer" class="hash-link" aria-label="Direct link to post-v1databasename_or_identitycallreducer" title="Direct link to post-v1databasename_or_identitycallreducer" translate="no"></a></h2>
<p>Invoke a reducer in a database.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="path-parameters">Path parameters<a href="#path-parameters" class="hash-link" aria-label="Direct link to Path parameters" title="Direct link to Path parameters" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>:reducer</code></td><td>The name of the reducer.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="required-headers-6">Required Headers<a href="#required-headers-6" class="hash-link" aria-label="Direct link to Required Headers" title="Direct link to Required Headers" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>A Spacetime token <a href="/http/authorization#authorization-headers">as Bearer auth</a>.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="data-4">Data<a href="#data-4" class="hash-link" aria-label="Direct link to Data" title="Direct link to Data" translate="no"></a></h4>
<p>A JSON array of arguments to the reducer.</p>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="get-v1databasename_or_identityschema"><code>GET /v1/database/:name_or_identity/schema</code><a href="#get-v1databasename_or_identityschema" class="hash-link" aria-label="Direct link to get-v1databasename_or_identityschema" title="Direct link to get-v1databasename_or_identityschema" translate="no"></a></h2>
<p>Get a schema for a database.</p>
<p>Accessible through the CLI as <code>spacetime describe &lt;name_or_identity&gt;</code>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="query-parameters-1">Query Parameters<a href="#query-parameters-1" class="hash-link" aria-label="Direct link to Query Parameters" title="Direct link to Query Parameters" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>version</code></td><td>The version of <code>RawModuleDef</code> to return, e.g. 9.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns-7">Returns<a href="#returns-7" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>Returns a <code>RawModuleDef</code> in JSON form.</p>
<details class="details_s63J alert alert--info details_kEk2" data-collapsed="true"><summary>Example response from <code>/schema?version=9</code> for the default module generated by <code>spacetime init</code></summary><div><div class="collapsibleContent_AFoM"><pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">typespace</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">types</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">Product</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">elements</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">some</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">name</span><span style="color:#E9F284">&quot;</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">algebraic_type</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">String</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> ]</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> ]</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">tables</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">person</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">,</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">product_type_ref</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#BD93F9"> 0</span><span style="color:#F8F8F2">,</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">primary_key</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [],</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">indexes</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [],</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">constraints</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [],</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">sequences</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [],</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">schedule</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">none</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">table_type</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">User</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">table_access</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">Private</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> ],</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">reducers</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">add</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">,</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">params</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">elements</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">some</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">name</span><span style="color:#E9F284">&quot;</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">algebraic_type</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">String</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> ]</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">lifecycle</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">none</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">identity_connected</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">,</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">params</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">elements</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">lifecycle</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">some</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">OnConnect</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">identity_disconnected</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">,</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">params</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">elements</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">lifecycle</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">some</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">OnDisconnect</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">init</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">,</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">params</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">elements</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">lifecycle</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">some</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">Init</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">say_hello</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">,</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">params</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">elements</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">lifecycle</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">none</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> ],</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">types</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [</span></span>
<span class="line"><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> {</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">scope</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [],</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">name</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">Person</span><span style="color:#E9F284">&quot;</span></span>
<span class="line"><span style="color:#F8F8F2"> },</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">ty</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#BD93F9"> 0</span><span style="color:#F8F8F2">,</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">custom_ordering</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#BD93F9"> true</span></span>
<span class="line"><span style="color:#F8F8F2"> }</span></span>
<span class="line"><span style="color:#F8F8F2"> ],</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">misc_exports</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> [],</span></span>
<span class="line"><span style="color:#8BE9FE"> &quot;</span><span style="color:#8BE9FD">row_level_security</span><span style="color:#8BE9FE">&quot;</span><span style="color:#FF79C6">:</span><span style="color:#F8F8F2"> []</span></span>
<span class="line"><span style="color:#F8F8F2">}</span></span></code></pre></div></div></details>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="get-v1databasename_or_identitylogs"><code>GET /v1/database/:name_or_identity/logs</code><a href="#get-v1databasename_or_identitylogs" class="hash-link" aria-label="Direct link to get-v1databasename_or_identitylogs" title="Direct link to get-v1databasename_or_identitylogs" translate="no"></a></h2>
<p>Retrieve logs from a database.</p>
<p>Accessible through the CLI as <code>spacetime logs &lt;name_or_identity&gt;</code>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="query-parameters-2">Query Parameters<a href="#query-parameters-2" class="hash-link" aria-label="Direct link to Query Parameters" title="Direct link to Query Parameters" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>num_lines</code></td><td>Number of most-recent log lines to retrieve.</td></tr><tr><td><code>follow</code></td><td>A boolean; whether to continue receiving new logs via a stream.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="required-headers-7">Required Headers<a href="#required-headers-7" class="hash-link" aria-label="Direct link to Required Headers" title="Direct link to Required Headers" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>A Spacetime token <a href="/http/authorization#authorization-headers">as Bearer auth</a>.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns-8">Returns<a href="#returns-8" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>Text, or streaming text if <code>follow</code> is supplied, containing log lines.</p>
<h2 class="anchor anchorWithStickyNavbar_wKCU" id="post-v1databasename_or_identitysql"><code>POST /v1/database/:name_or_identity/sql</code><a href="#post-v1databasename_or_identitysql" class="hash-link" aria-label="Direct link to post-v1databasename_or_identitysql" title="Direct link to post-v1databasename_or_identitysql" translate="no"></a></h2>
<p>Run a SQL query against a database.</p>
<p>Accessible through the CLI as <code>spacetime sql &lt;name_or_identity&gt; &lt;query&gt;</code>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="required-headers-8">Required Headers<a href="#required-headers-8" class="hash-link" aria-label="Direct link to Required Headers" title="Direct link to Required Headers" translate="no"></a></h4>
<table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>A Spacetime token <a href="/http/authorization#authorization-headers">as Bearer auth</a>.</td></tr></tbody></table>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="data-5">Data<a href="#data-5" class="hash-link" aria-label="Direct link to Data" title="Direct link to Data" translate="no"></a></h4>
<p>SQL queries, separated by <code>;</code>.</p>
<h4 class="anchor anchorWithStickyNavbar_wKCU" id="returns-9">Returns<a href="#returns-9" class="hash-link" aria-label="Direct link to Returns" title="Direct link to Returns" translate="no"></a></h4>
<p>Returns a JSON array of statement results, each of which takes the form:</p>
<pre tabindex="0" class="codeBlockStandalone_pMzE thin-scrollbar codeBlockContainer_HZVP theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><code class="codeBlockLines_ckKi"><span class="line"><span style="color:#F8F8F2">{</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">schema</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: ProductType,</span></span>
<span class="line"><span style="color:#E9F284"> &quot;</span><span style="color:#F1FA8C">rows</span><span style="color:#E9F284">&quot;</span><span style="color:#F8F8F2">: array</span></span>
<span class="line"><span style="color:#F8F8F2">}</span></span></code></pre>
<p>The <code>schema</code> will be a <a href="/sats-json">JSON-encoded <code>ProductType</code></a> describing the type of the returned rows.</p>
<p>The <code>rows</code> will be an array of <a href="/sats-json">JSON-encoded <code>ProductValue</code>s</a>, each of which conforms to the <code>schema</code>.</p></div></article><nav class="docusaurus-mt-lg pagination-nav" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/http/identity"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">/v1/identity</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/webassembly-abi"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Module ABI Reference</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_Ea_L thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#at-a-glance" class="table-of-contents__link toc-highlight">At a glance</a></li><li><a href="#post-v1database" class="table-of-contents__link toc-highlight"><code>POST /v1/database</code></a></li><li><a href="#post-v1databasename_or_identity" class="table-of-contents__link toc-highlight"><code>POST /v1/database/:name_or_identity</code></a></li><li><a href="#get-v1databasename_or_identity" class="table-of-contents__link toc-highlight"><code>GET /v1/database/:name_or_identity</code></a></li><li><a href="#delete-v1databasename_or_identity" class="table-of-contents__link toc-highlight"><code>DELETE /v1/database/:name_or_identity</code></a></li><li><a href="#get-v1databasename_or_identitynames" class="table-of-contents__link toc-highlight"><code>GET /v1/database/:name_or_identity/names</code></a></li><li><a href="#post-v1databasename_or_identitynames" class="table-of-contents__link toc-highlight"><code>POST /v1/database/:name_or_identity/names</code></a></li><li><a href="#put-v1databasename_or_identitynames" class="table-of-contents__link toc-highlight"><code>PUT /v1/database/:name_or_identity/names</code></a></li><li><a href="#get-v1databasename_or_identityidentity" class="table-of-contents__link toc-highlight"><code>GET /v1/database/:name_or_identity/identity</code></a></li><li><a href="#get-v1databasename_or_identitysubscribe" class="table-of-contents__link toc-highlight"><code>GET /v1/database/:name_or_identity/subscribe</code></a></li><li><a href="#post-v1databasename_or_identitycallreducer" class="table-of-contents__link toc-highlight"><code>POST /v1/database/:name_or_identity/call/:reducer</code></a></li><li><a href="#get-v1databasename_or_identityschema" class="table-of-contents__link toc-highlight"><code>GET /v1/database/:name_or_identity/schema</code></a></li><li><a href="#get-v1databasename_or_identitylogs" class="table-of-contents__link toc-highlight"><code>GET /v1/database/:name_or_identity/logs</code></a></li><li><a href="#post-v1databasename_or_identitysql" class="table-of-contents__link toc-highlight"><code>POST /v1/database/:name_or_identity/sql</code></a></li></ul></div></div></div></div></main></div></div></div><footer class="theme-layout-footer footer"><div class="container container-fluid"></div></footer></div>
</body>
</html>