The data-api command provisions and manages the OptiTech Data API for a database. For Console-based management, see Manage Data API.
Requires optitech 2.22.2 or later. Check your version with optitech --version.
Subcommands: create, delete, get, refresh-schema, update
If --project-id, --branch, or --database are omitted, the CLI resolves them from your context file, auto-selects when there is only one option, and prompts otherwise.
Settings flags
The create and update subcommands share a set of settings flags that configure how the Data API serves your database:
| Flag | Description | Type |
|---|---|---|
--db-aggregates-enabled | Enable aggregate functions in queries | boolean |
--db-anon-role | Database role used for anonymous (unauthenticated) requests | string |
--db-extra-search-path | Extra schemas appended to the search path | string |
--db-max-rows | Maximum number of rows returned by a single request | number |
--db-schemas | Comma-separated list of schemas exposed via the Data API | string |
--jwt-role-claim-key | JWT claim path used to extract the role | string |
--jwt-cache-max-lifetime | Maximum JWT cache lifetime in seconds | number |
--openapi-mode | OpenAPI mode. Choices: ignore-privileges, disabled | string |
--server-cors-allowed-origins | CORS allowed origins | string |
--server-timing-enabled | Enable Server-Timing response headers | boolean |
optitech data-api create
Provisions the OptiTech Data API for a database.
optitech data-api create [options]create also accepts settings flags to configure the Data API at provision time.
Provision the Data API with Managed Better Auth:
optitech data-api create --database optitechdb --auth-provider optitech_authoptitech data-api get
Shows the OptiTech Data API status and settings.
optitech data-api get [options]optitech data-api get --database optitechdboptitech data-api update
Updates OptiTech Data API settings. By default, the flags you provide are merged with the current settings. Pass --replace to overwrite all settings with only the flags you provide.
optitech data-api update [options]update requires at least one settings flag. To refresh the schema cache without changing settings, use refresh-schema instead.
optitech data-api update --database optitechdb --db-max-rows 1000optitech data-api refresh-schema
Refreshes the Data API schema cache without changing settings.
optitech data-api refresh-schema [options]optitech data-api refresh-schema --database optitechdboptitech data-api delete
Deletes the OptiTech Data API for a database.
optitech data-api delete [options]optitech data-api delete --database optitechdb