/sitesScope sites.writeSDK: @owbase/node only
Create a new site.
Deployment is upload-only: the Git repository parameters are left out (see Publish).
Parameters
Section titled “Parameters”siteId string required
Site ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can’t start with a special char. Max length is 36 chars.
name string required
Site name. Max length: 128 chars.
framework Framework required
Sites framework. Values: analog, angular, nextjs, react, nuxt, vue, sveltekit, astro, tanstack-start, remix, lynx, react-native, vite, other (Node frameworks only on Owbase).
buildRuntime BuildRuntime required
Runtime to use during build step. Values: node-22 (Node 22 only on Owbase).
enabled boolean
Is site enabled? When set to ‘disabled’, users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
logging boolean
When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
timeout number
Maximum request time in seconds.
installCommand string
Install Command.
buildCommand string
Build Command.
startCommand string
Custom start command. Leave empty to use default.
outputDirectory string
Output Directory for site.
adapter Adapter
Framework adapter defining rendering strategy. Allowed values are: static, ssr Values: static, ssr.
fallbackFile string
Fallback file for single page application sites.
buildSpecification string
Build specification for the site deployments.
runtimeSpecification string
Runtime specification for the SSR executions.
deploymentRetention number
Days to keep non-active deployments before deletion. Value 0 keeps all deployments unless the server applies a default retention. New sites default to 30 days.
scopes ProjectKeyScopes[]
List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. Values: project.read, project.write, usage.read, keys.read, keys.write, platforms.read, platforms.write, mocks.read, mocks.write, policies.read, policies.write, project.policies.read, project.policies.write, project.oauth2.read, project.oauth2.write, templates.read, templates.write, stages.read, stages.write, users.read, users.write, sessions.read, sessions.write, teams.read, teams.write, databases.read, databases.write, tables.read, tables.write, columns.read, columns.write, indexes.read, indexes.write, rows.read, rows.write, embeddings.write, collections.read, collections.write, attributes.read, attributes.write, documents.read, documents.write, documentsdb.read, documentsdb.write, documentsdb.collections.read, documentsdb.collections.write, documentsdb.documents.read, documentsdb.documents.write, documentsdb.indexes.read, documentsdb.indexes.write, vectorsdb.read, vectorsdb.write, vectorsdb.collections.read, vectorsdb.collections.write, vectorsdb.documents.read, vectorsdb.documents.write, vectorsdb.indexes.read, vectorsdb.indexes.write, buckets.read, buckets.write, files.read, files.write, tokens.read, tokens.write, functions.read, functions.write, executions.read, executions.write, execution.read, execution.write, sites.read, sites.write, log.read, log.write, providers.read, providers.write, topics.read, topics.write, subscribers.read, subscribers.write, targets.read, targets.write, messages.read, messages.write, rules.read, rules.write, webhooks.read, webhooks.write, monitors.read, monitors.write, alerts.read, locale.read, avatars.read, avatars.write, health.read, assistant.read, migrations.read, migrations.write, schedules.read, schedules.write, vcs.read, vcs.write, insights.read, insights.write, reports.read, reports.write, reviews.read, reviews.write, presences.read, presences.write.
description string
Optional description for the site.
Access: API key with the sites.write scope.
Responses
Section titled “Responses”201Success400Invalid or missing parameter401No session, no permission on the resource or key without the scope429Rate limitEvery error comes as JSON with code, type and message: see Errors.
import { Client, Sites, Framework, BuildRuntime, Adapter, ProjectKeyScopes } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.create({ siteId: '<SITE_ID>', name: '<NAME>', framework: Framework.Nextjs, buildRuntime: BuildRuntime.Node22, enabled: false, // optional logging: false, // optional timeout: 1, // optional installCommand: '<INSTALL_COMMAND>', // optional buildCommand: '<BUILD_COMMAND>', // optional startCommand: '<START_COMMAND>', // optional outputDirectory: '<OUTPUT_DIRECTORY>', // optional adapter: Adapter.Static, // optional fallbackFile: '<FALLBACK_FILE>', // optional buildSpecification: 's-1vcpu-512mb', // optional runtimeSpecification: 's-1vcpu-512mb', // optional deploymentRetention: 0, // optional scopes: [ProjectKeyScopes.ProjectRead], // optional description: '<DESCRIPTION>', // optional});curl -X POST "https://cloud.owbase.dev/v1/sites" \ -H "X-Owbase-Project: <PROJECT_ID>" \ -H "X-Owbase-Key: $OWBASE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"siteId":"<SITE_ID>","name":"<NAME>","framework":"analog","buildRuntime":"node-22"}'{ "$id": "5e5ea5c16897e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "My Site", "description": "Marketing site for the spring launch.", "enabled": false, "live": false, "logging": false, "framework": "react", "deploymentRetention": 7, "deploymentId": "5e5ea5c16897e", "deploymentCreatedAt": "2020-10-15T06:38:00.000+00:00", "deploymentScreenshotLight": "5e5ea5c16897e", "deploymentScreenshotDark": "5e5ea5c16897e", "latestDeploymentId": "5e5ea5c16897e", "latestDeploymentCreatedAt": "2020-10-15T06:38:00.000+00:00", "latestDeploymentStatus": "ready", "scopes": [ "users.read" ], "vars": [ { "$id": "5e5ea5c16897e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "$updatedAt": "2020-10-15T06:38:00.000+00:00", "key": "API_KEY", "description": "Stripe secret key used at checkout.", "value": "myPa$$word1", "secret": false, "resourceType": "function", "resourceId": "myAwesomeFunction" } ], "timeout": 300, "installCommand": "npm install", "buildCommand": "npm run build", "startCommand": "node custom-server.mjs", "outputDirectory": "build", "installationId": "6m40at4ejk5h2u9s1hboo", "providerRepositoryId": "owbase", "providerBranch": "main", "providerRootDirectory": "sites/helloWorld", "providerSilentMode": false, "providerBranches": [ "main", "feat/*" ], "providerPaths": [ "src/**", "!docs/**" ], "buildSpecification": "s-1vcpu-512mb", "runtimeSpecification": "s-1vcpu-512mb", "buildRuntime": "node-22", "adapter": "static", "fallbackFile": "index.html"}The descriptions on this page come from the server API specification (BSD-3-Clause license), and the examples come from the SDK generator (MIT license). The full notices are in the NOTICE file of the @owbase/web and @owbase/node packages.