# CubiBase — full site content Generated: 2026-11-26. Single-file mirror of https://cubibase.com for AI agents. Index: https://cubibase.com/llms.txt · Agent guide: https://cubibase.com/docs/agents · Skill: https://cubibase.com/SKILL.md Each section below mirrors one page; the Source line gives its canonical URL. --- # CubiBase — the backend platform built on PostgreSQL Source: https://cubibase.com/ Also available: [Markdown version](https://cubibase.com/index.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase gives every project its own PostgreSQL database, end-user authentication, a REST API for exposed tables, S3-backed object storage, and TypeScript/JavaScript Functions. One Console manages everything. ## What you get - **Database** — one isolated PostgreSQL database per project; ordinary tables, SQL editor, RLS policies, SQL functions callable over RPC. - **Authentication** — email + password, Google sign-in, anonymous users, TOTP MFA, rotating refresh tokens, external IdPs (RS256/JWKS). - **Data API** — `https://{slug}.api.cubibase.com/rest/v1/{table}` with filters, ordering, pagination; tables are private until you expose operations. - **Storage** — public and private buckets, direct uploads, signed downloads, quotas, durable events. - **Functions** — HTTP, database-event, storage-event, and cron triggers; versioned deployments, encrypted secrets, execution logs. ## For AI agents - Agent guide: https://cubibase.com/docs/agents - Skill file: https://cubibase.com/SKILL.md - MCP server: `npx -y @cubibasehq/mcp` (env `CUBIBASE_TOKEN`, a personal access token from Console → Account → Access tokens) - CLI: `npx -y @cubibasehq/cli` — JSON output, same token - Control API OpenAPI 3.1: https://api.cubibase.com/v1/openapi.json - Per-project Data API OpenAPI: `https://{slug}.api.cubibase.com/rest/v1/openapi.json` - All site content in one file: https://cubibase.com/llms-full.txt ## Start - Console: https://console.cubibase.com - Quickstart: https://cubibase.com/docs/quickstart - Pricing: https://cubibase.com/pricing (Free $0 · Pro $25/month · Business $99/month · additional projects $9/month) - Support: support@cubibase.com --- # Product: a complete backend platform Source: https://cubibase.com/product Also available: [Markdown version](https://cubibase.com/product.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) How CubiBase fits together: a dedicated PostgreSQL database per project, Authentication, Storage, and Functions on one project host, managed from one Console. ## Architecture - Control plane (`api.cubibase.com`): developer accounts, projects, schema management, keys, logs, billing. Authenticated with a session JWT or personal access token (`cb_pat_`). - Data plane (`{slug}.api.cubibase.com`): REST rows, RPC, end-user auth, storage, function invocation. Identified by a publishable key (`cb_pub_`), authorized by an end-user JWT or a project secret key (`cb_sec_`, service actor). - Every project database has four NOSUPERUSER, NOBYPASSRLS roles: DDL, API, SQL, auth. - Row-level security is always enforced; `cubibase.current_user_id()` and `cubibase.current_role()` are available inside policies. ## Docs - Introduction: https://cubibase.com/docs - Architecture detail: https://cubibase.com/docs/architecture - API routes: https://cubibase.com/docs/reference/routes - Error codes: https://cubibase.com/docs/reference/errors --- # Features Source: https://cubibase.com/features Also available: [Markdown version](https://cubibase.com/features.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Everything your backend needs, on one project host. - [A real PostgreSQL database for every project.](https://cubibase.com/features/postgresql) — Every CubiBase project gets its own PostgreSQL database. It is ready when provisioning finishes, other projects cannot query it, and your tables are ordinary PostgreSQL tables you design in the Console and expose over REST. - [Sign-up and sign-in for your application users.](https://cubibase.com/features/authentication) — Every project includes CubiBase Auth: email and password, anonymous sign-ins that convert into real accounts, Google sign-in, and TOTP multi-factor. Users live in your project database, and the access token they receive is the JWT your Data API calls already use. - [Your tables. Your APIs. Automatically.](https://cubibase.com/features/rest-api) — Once you expose a table, CubiBase serves it at https://{slug}.api.cubibase.com/rest/v1/{table}. You do not write a controller for that table. You do choose the operations. A new table starts unexposed, and a request still needs a publishable key plus an end-user JWT. - [See your data. Shape your database.](https://cubibase.com/features/database-management) — The Console is the developer view of a project database. You create tables, browse and edit rows, write row-level security policies, and manage functions, triggers, indexes, types, and views — all in the public schema. These are developer tools in the Console, separate from the Data API your application calls. - [Access you control. Data you protect.](https://cubibase.com/features/security) — CubiBase separates project identity from user identity. The publishable key tells the Data API which project you are calling. The end-user JWT tells it which subject to apply. Row policies on the API role decide which rows that subject can touch. None of this is a certification, an SLA, or a promise that a mis-designed policy is safe. - [File storage inside every project.](https://cubibase.com/features/storage) — CubiBase Storage keeps your files in private, encrypted object storage and the file catalog in your project’s PostgreSQL database. Apps upload directly with short-lived authorizations, every download is metered, and private buckets require a key, a user session, or a signed link. - [Your code, next to your data.](https://cubibase.com/features/functions) — CubiBase Functions run your TypeScript and JavaScript in an isolated, managed runtime. Four trigger types share one execution pipeline: HTTPS endpoints, committed database changes, storage object events, and cron schedules. --- # Same platform. Different ways to split the work. Source: https://cubibase.com/solutions Also available: [Markdown version](https://cubibase.com/solutions.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase is one product. These pages describe three situations where the project boundary matters, so you can see which shape fits the application you are about to build. - [A PostgreSQL backend your mobile app can call.](https://cubibase.com/solutions/mobile-apps) — CubiBase fits a mobile app that needs relational data, user accounts, and a REST API, without a separate backend service for every screen. The app calls https://{slug}.api.cubibase.com over HTTPS: /auth/v1 to sign users up and in, /rest/v1 for the data. - [One PostgreSQL backend for the product you are shipping.](https://cubibase.com/solutions/saas) — A small SaaS product can keep its accounts and relational data in one CubiBase project. Users sign up through CubiBase Auth; customers, plans, and the records they own live in the same database. The API role returns a row only when the user column matches the JWT subject, if you set that column up. - [A separate backend for each client application.](https://cubibase.com/solutions/agencies) — Agencies often repeat the same foundation: a database, a small API, and a way to look at the data when a client asks. CubiBase gives each client application its own project, database, and API host, under the same developer login. --- # See how CubiBase compares. Source: https://cubibase.com/comparison Also available: [Markdown version](https://cubibase.com/comparison.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase against four backend platforms, on the things you can verify: a real PostgreSQL database in every project, one predictable price per organization, and quotas where you decide what happens: stop at the limit, or pay only for what you use beyond it, up to a spending limit you set. - [CubiBase vs Supabase](https://cubibase.com/comparison/supabase) — A bigger included database, cheaper additional projects, and pay-per-use beyond the plan with a spending limit you set. - [CubiBase vs Firebase](https://cubibase.com/comparison/firebase) — Real PostgreSQL and SQL, with a flat monthly plan instead of per-read and per-write billing. - [CubiBase vs Convex](https://cubibase.com/comparison/convex) — Plain HTTPS any client can call, standard PostgreSQL backups, and one organization price instead of per-developer seats. - [CubiBase vs Appwrite](https://cubibase.com/comparison/appwrite) — PostgreSQL is the core of every project, and additional projects cost $9 instead of $15. Competitor pricing was read from each vendor's public pricing page on November 24, 2026. CubiBase plans: https://cubibase.com/pricing. --- # CubiBase pricing Source: https://cubibase.com/pricing Also available: [Markdown version](https://cubibase.com/pricing.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Three plans. Every plan includes one project. Add more projects for $9/month each on Pro and Business. Every plan includes a PostgreSQL database per project, authentication, REST API, storage, and Functions. Prices in USD; paid plans bill monthly through Stripe, self-serve in the Console. Database storage is allocated per project; all other consumption quotas are shared across your organization. Upgrade your plan without changing your project count. ## Plans | Plan | Price | Projects | Database size | File storage | Total bandwidth | Monthly active users | API requests | Function invocations | Function compute | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | Free | $0 forever | 1 | 500 MB per project | 2 GB shared | 15 GB per month · shared | 50,000 shared | 500,000 per month · shared | 500,000 per month · shared | 10,000 GB-seconds per month · shared | | Pro | $25/month | 1 included · $9/mo each additional | 10 GB per project | 100 GB shared | 500 GB per month · shared | 100,000 shared | 1,000,000 per month · shared | 2,000,000 per month · shared | 50,000 GB-seconds per month · shared | | Business | $99/month | 1 included · $9/mo each additional | 10 GB per project | 250 GB shared | 750 GB per month · shared | 500,000 shared | 5,000,000 per month · shared | 6,000,000 per month · shared | 300,000 GB-seconds per month · shared | ### Free — $0 For side projects and first prototypes. - A PostgreSQL database per project - Auth: email + password, TOTP MFA - REST API for exposed tables - Storage: public and private buckets - Functions: TypeScript/JavaScript on 4 trigger types - Console: tables, rows, SQL, keys, files, functions - MCP, CLI and Agent Skills included - Upgrade to Pro for additional projects - Paused after 14 days without activity ### Pro — $25/month For products with real users. - Everything in Free - Additional projects at $9/month, each with its own database - Daily backups kept 7 days - Never paused for inactivity - Bring your own IdP (RS256 / JWKS) - Priority email support ### Business — $99/month For teams running several client apps. - Everything in Pro - 1 included project · additional at $9/month - Daily backups kept 14 days - Highest shared quotas: MAU, bandwidth, functions - Onboarding help and a named support contact ## Included on every plan - **A PostgreSQL database per project** — Each project gets its own database, with tables, rows, and SQL in the Console. - **REST API** — Expose a table and call it over HTTPS with your project keys. - **Authentication** — Email and password sign-in, sessions, and TOTP multi-factor authentication. - **Row-level security** — Policies and user columns limit each request to the rows it may read. - **File storage** — Public and private buckets, with signed links for private files. - **Functions** — TypeScript or JavaScript on HTTP, database, storage, and cron triggers. ## Compare: Projects and database | Projects and database | Free | Pro | Business | | --- | --- | --- | --- | | Included projects | 1 | 1 | 1 | | Additional project per month | not available | $9 | $9 | | PostgreSQL database per project | yes | yes | yes | | Database size per project | 500 MB | 10 GB | 10 GB | | REST API for exposed tables | yes | yes | yes | | Row-level security and user columns | yes | yes | yes | | Console: tables, rows, SQL, keys | yes | yes | yes | ## Compare: Shared organization quotas | Shared organization quotas | Free | Pro | Business | | --- | --- | --- | --- | | Monthly active users | 50,000 | 100,000 | 500,000 | | API requests per month | 500,000 | 1,000,000 | 5,000,000 | | Total bandwidth per month (API + file delivery) | 15 GB | 500 GB | 750 GB | | API bandwidth sublimit per month | 5 GB | 25 GB | 100 GB | | Object storage | 2 GB | 100 GB | 250 GB | | Storage write operations per month | 10,000 | 100,000 | 300,000 | | File download requests per month | 100,000 | 250,000 | 2,000,000 | | Combined CloudFront requests per month | 1,000,000 | 1,500,000 | 7,000,000 | ## Compare: Authentication | Authentication | Free | Pro | Business | | --- | --- | --- | --- | | Auth: email + password | yes | yes | yes | | TOTP multi-factor authentication | yes | yes | yes | | Bring your own IdP (RS256 / JWKS) | no | yes | yes | | Adjustable auth rate limits | no | yes | yes | ## Compare: Storage | Storage | Free | Pro | Business | | --- | --- | --- | --- | | Public and private buckets | yes | yes | yes | | Signed file access | yes | yes | yes | | Maximum file size | 50 MB | 1 GB | 5 GB | ## Compare: Functions | Functions | Free | Pro | Business | | --- | --- | --- | --- | | Functions (TypeScript / JavaScript) | yes | yes | yes | | Functions per project | 5 | 25 | 100 | | Function invocations per month (shared) | 500,000 | 2,000,000 | 6,000,000 | | Function compute per month (shared) | 10,000 GB-s | 50,000 GB-s | 300,000 GB-s | | Function execution timeout | 5 sec | 30 sec | 60 sec | | Function memory | 128 MB | 256 MB | 512 MB | | Concurrent function executions per project | 5 | 20 | 50 | | Scheduled functions per project | 2 | 10 | 50 | | Function execution log retention | 3 days | 14 days | 30 days | ## Compare: Lifecycle and support | Lifecycle and support | Free | Pro | Business | | --- | --- | --- | --- | | Daily backup retention | none | 7 days | 14 days | | Inactivity policy | Pause after 14 idle days | Never paused | Never paused | | Spending protection (quotas refuse by default) | yes | yes | yes | | Optional additional usage with spending limits | no | opt-in | opt-in | | MCP, CLI and Agent Skills | yes | yes | yes | | Support | Email | Priority email | Priority + onboarding | ## Additional usage (Pro & Business) Need more resources? Enable additional usage on your paid plan and pay only for what you consume. Set a monthly spending limit to remain in control of your costs. | Resource | Price | Billing unit | How it is measured | | --- | --- | --- | --- | | PostgreSQL storage | $0.20 per GB-month | GB-month | Time-weighted excess capacity across the billing period — you pay for how much and how long, not the peak | | File storage | $0.03 per GB-month | GB-month | Time-weighted excess capacity across the billing period — you pay for how much and how long, not the peak | | File bandwidth | $0.03 per GB | GB | Cumulative usage above the included monthly quota | | API bandwidth | $0.09 per GB | GB | Cumulative usage above the included monthly quota | | API requests | $3 per million requests | 1 million requests | Cumulative usage above the included monthly quota | | CDN requests | $4 per million requests | 1 million requests | Cumulative usage above the included monthly quota | | Authentication | $0.50 per 1,000 additional MAU | 1,000 additional MAU | Cumulative usage above the included monthly quota | | Function invocations | $1 per million invocations | 1 million invocations | Cumulative usage above the included monthly quota | | Function compute | $3 per 100,000 GB-seconds | 100,000 GB-seconds | Cumulative usage above the included monthly quota | - **Off until you turn it on** — Additional usage is disabled by default. Nothing is metered for payment until an organization owner or billing admin enables it in Console → Billing → Additional Usage and accepts the pricing. Without activation, quotas keep refusing operations exactly as before — there are no automatic unexpected charges. - **Paid plans only** — Free does not support paid overages. Additional usage is available on Pro and Business, at the same rates on both plans. - **Spending limits you control** — Choose a monthly limit for additional usage — $5, $10, $25, $50, $100, a custom amount, or no limit with explicit confirmation. Limits cover additional resource usage only, never your base plan, additional projects, prorations or taxes. Alerts arrive at 50%, 75%, 90% and 100% of the limit; at the limit, new billable consumption is blocked where technically possible while included quotas, billing access and deletion keep working. Metering delays (especially CDN traffic and ongoing storage) mean a small bounded overshoot is possible — the limit is a control, not an absolute invoice cap. - **Storage bills by time, not by peak** — Database and file storage overages use time-weighted excess capacity (GB-month): holding 50 GB over your allowance for half a month bills about half of a full month. Database excess is measured independently per project — spare capacity in one database never offsets another database’s excess. - **No double billing on bandwidth** — API bandwidth is part of your total bandwidth allowance. API traffic beyond the API sublimit bills at the API rate; file delivery uses whatever included total bandwidth remains. The same outbound byte is never billed twice and there is no separate total-bandwidth charge. - **API and CDN requests are independent** — API request and CDN request quotas are counted separately: one API request served through the CDN consumes both. If both allowances are exhausted and additional usage is enabled, both overage rates apply to that request. - **Projects stay a flat add-on** — Additional projects remain $9/month each — a fixed subscription item, not metered usage. Shared organization quotas do not grow with additional projects; only the per-project database comes with each one. - **Billing units for overages** — Included quotas use binary units (1 GB = 1024 MB), unchanged. Overage billing uses decimal units (1 GB = 1,000 MB = 1,000,000,000 bytes); only the excess above your included quota is converted and billed. Usage is aggregated continuously and reported to Stripe hourly; the Usage page always shows the live estimate, and the Stripe invoice is the final word. Enable additional usage and set your spending limit in Console → Billing → Additional Usage (https://console.cubibase.com/billing/additional-usage). ## Pricing FAQ **How do I pay for Pro or Business?** In the Console. Choose Get Pro or Get Business, sign in, and complete the Stripe checkout on the Billing page. Payment methods, invoices, plan changes, and cancellation are managed there too. Prices on this page are the published monthly rates. **Are quotas per project or per organization?** Database storage is allocated per project. All other consumption quotas are shared across your organization. Each project has its own PostgreSQL database with an independent storage quota (500 MB on Free, 10 GB on paid plans and additional projects). Monthly active users, API requests, bandwidth, object storage, storage operations, download requests, CloudFront requests, and Function invocations and compute are pooled across all projects in your organization. Buying additional projects adds project slots and per-project database storage — it never increases the shared quotas. **How do additional projects work?** Every plan includes one project. On Pro and Business, each additional project is $9/month with its own 10 GB database; Free cannot purchase additional projects — upgrade to Pro first. Project billing follows your actual project count: when you create a project, Stripe adds $9/month prorated for the rest of your cycle (the Console shows the exact next-invoice preview before you confirm); when you delete one, the quantity drops and Stripe credits the unused time on the next invoice. Your billing cycle does not reset. Switching between Pro and Business keeps your project count and charges unchanged. Additional projects are a fixed subscription item — they are never part of metered additional usage. Example: Pro with 5 projects is $61/month ($25 + 4 × $9). **What counts as a monthly active user?** An end user who authenticates at least once during the billing cycle, counted once per organization across all projects. Users from your own identity provider are not counted. MAU is a shared organization quota, not a per-project registered-user count. **What happens when I reach a quota?** By default, the affected operation is refused with a clear error showing the limit and your reset date, and the Console warns you at 50%, 75%, 90% and 100% utilization. Nothing is billed automatically. If the account stays over its plan limits for 7 days, its projects are suspended until you upgrade or reduce usage. On Pro and Business you can instead enable additional usage (Console → Billing → Additional Usage): consumption beyond the included quota then bills at the published per-unit rates under a monthly spending limit you choose. Nothing is ever deleted because a quota was reached, and projects reactivate automatically once the account fits its plan. Upgrading raises the limits on the same projects and databases. **How do the file storage quotas work?** Object storage is one shared organization capacity (2 GB on Free, 100 GB on Pro, 250 GB on Business), enforced on the server before an upload is authorized, so concurrent uploads cannot exceed it. File delivery draws on your shared total bandwidth allowance (see the bandwidth FAQ below). Maximum single file size is 50 MB, 1 GB, or 5 GB by plan. Reaching a storage limit blocks new uploads or downloads but never deletes files; deleting objects frees capacity immediately. Sizes use binary units (1 GB = 1024 MB). **How does bandwidth accounting work?** Total bandwidth is one shared organization allowance covering everything delivered to your users: API responses and file downloads (15 GB on Free, 500 GB on Pro, 750 GB on Business per month). API bandwidth is a sublimit of that total, not an extra allowance (5 GB, 25 GB, 100 GB): on Pro, using the full 25 GB of API bandwidth still leaves 475 GB for file delivery. Hitting the API sublimit never blocks your remaining file bandwidth. Bandwidth counts outbound bytes delivered to customers — not uploads or internal transfers — and resets with your billing cycle. Sizes use binary units (1 GB = 1024 MB). **How do CubiBase Functions quotas work?** Functions are included on every plan: TypeScript/JavaScript code triggered by HTTP, database events, storage events, or cron schedules. Function count, concurrency and schedules are limited per project; invocations and compute (GB-seconds) are metered per organization per billing cycle, shared across all projects. Every executed run counts — success, failure and timeout alike — while requests rejected by the gateway (auth, signature, quota) are not counted. At a limit, new invocations are refused until the cycle resets or you upgrade — unless you have enabled additional usage on a paid plan, in which case excess invocations and compute bill at the published rates under your spending limit. The Console's Usage page always shows the live values. **What is additional usage, and how do I enable it?** Additional usage lets Pro and Business organizations keep consuming resources beyond the included quotas and pay only for the excess, at the per-unit rates in the Additional Usage table above. It is disabled by default: an organization owner or billing admin enables it in Console → Billing → Additional Usage, reviews the exact rates, and chooses a monthly spending limit ($5, $10, $25, $50, $100, a custom amount, or no limit with explicit confirmation). Until then, quotas behave exactly as before — operations are refused at the limit and nothing is billed automatically. Free does not support paid overages. Disabling additional usage stops future metered charges but does not cancel usage already validly accrued. **Is the spending limit a guaranteed cap on my invoice?** It is a spending control, not an absolute guarantee. CubiBase meters usage continuously and blocks new billable consumption when the estimated additional-usage spend reaches your limit, but some metering sources — especially CDN traffic and ongoing storage capacity — arrive with a delay, so a small bounded overshoot is possible. The limit applies to additional resource usage only; your base plan, additional projects, prorations and taxes are separate. Alerts arrive at 50%, 75%, 90% and 100% of the limit, and billing access, included quotas and deletion always keep working. **How are storage overages calculated?** By time-weighted excess capacity, not peak size. Database storage is measured independently per project: only the part above your per-project allowance bills, and unused capacity in one database never offsets another database’s excess. File storage is one shared organization capacity. In both cases the excess is integrated over time as GB-months: holding 50 GB over the allowance for half a billing period costs about half of the full-month rate. Included quotas use binary units (1 GB = 1024 MB); overage billing uses decimal GB (1 GB = 1,000,000,000 bytes) applied only to the excess. **Can one request be charged twice — API and CDN?** API request and CDN request quotas are independent: an API request served through the CDN consumes both allowances, and if both are exhausted with additional usage enabled, both overage rates apply (at the current rates, one million such requests would bill $3 for API requests plus $4 for CDN requests). Bandwidth is different: each outbound byte is billed at most once — API traffic beyond the API sublimit bills at the API bandwidth rate, file delivery uses the remaining included total bandwidth, and there is no separate total-bandwidth charge. **Are the additional usage rates final?** Yes — every additional usage rate shown here is final production pricing. You always review and accept the exact rates shown in the Console before any additional-usage charge can accrue, and a monthly spending limit keeps you in control. **What happens to a Free project I stop using?** After 14 days without activity (no API, auth, or Console use) a Free project is paused and we email you. Resume it from the Console within 60 days and it is back instantly — the database is untouched. After 60 days paused we take a full PostgreSQL backup (.backup file), keep it, and remove the live database to stop storage costs. You can download the backup anytime, and resuming an archived project restores the database automatically. Pro and Business projects are never paused for inactivity. **Is there an uptime SLA?** No plan publishes an uptime percentage or a service-level agreement today. Support tiers describe how your email is queued, not a response-time guarantee. **Are backups included?** Paid plans include daily database backups: kept 7 days on Pro and 14 days on Business. Archived Free projects get a full PostgreSQL backup (.backup, pg_dump custom format) that is kept and downloadable from the Console, and resuming restores it automatically. Free does not include a daily backup schedule for active projects — plan your own export routine for data you cannot lose. Quota model (catalog v4.5): database storage per project; all other consumption quotas shared per organization. Additional projects increase project slots only — shared quotas stay unchanged. No uptime SLA is published. This page describes the product, not a service-level agreement. --- # CubiBase FAQ Source: https://cubibase.com/faq Also available: [Markdown version](https://cubibase.com/faq.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) ## Getting started **What is CubiBase?** CubiBase is a PostgreSQL backend platform. You create a project, CubiBase provisions a database for that project, and your application calls the project’s REST API and auth endpoints. The Console is where you manage tables, rows, policies, functions, triggers, indexes, types, views, and API keys. **How does CubiBase differ from building a REST API manually?** A handwritten API needs a database, controllers, and an authorization check for every table. In CubiBase you create the table, choose which operations to expose, and call https://{slug}.api.cubibase.com/rest/v1/{table}. You still design the schema and decide which column identifies the end user. **Do I need to know PostgreSQL?** You need enough SQL and schema design to model your application. CubiBase does not hide PostgreSQL. It gives you a real database, a Console for tables and rows, and REST so your app does not need a handwritten controller for each exposed table. **Can I use CubiBase for mobile applications?** Yes. A mobile app calls the project host over HTTPS. Send the publishable key and the user’s JWT. There is no CubiBase mobile SDK in this release. Any client that can make an HTTP request can use the Data API. **Can I manage multiple projects?** Yes. Each project has its own slug, database, and API host. A developer account can own more than one project. CubiBase does not currently publish an API for inviting other developers onto a project. ## Database and REST API **Does each project get its own PostgreSQL database?** Yes. Creating a project queues provisioning. When provisioning finishes, that project has its own database. Projects do not share a project database, and your developer account is stored separately from project data. **How are REST APIs generated?** The Data API serves any exposed table at /rest/v1/{table}. A new table is not exposed. You turn on select, insert, update, or delete for that table. The request must send the project’s publishable key and an end-user JWT. List results come back as JSON in a data array. **Can I run SQL queries?** Yes, from the Console. The SQL editor accepts one read-only statement, such as SELECT, and runs it in a read-only transaction on the project’s SQL role. Schema changes go through the Database screens — tables, policies, functions, triggers, indexes, types, and views — not through that editor. Results are capped. From your application, custom logic runs through functions: grant Data API EXECUTE and call POST /rest/v1/rpc/{name}. **Are new tables public on the internet?** No. Creating a table does not expose it. Until you allow select, insert, update, or delete, the Data API treats the table as not found for that operation. ## Authentication **Does CubiBase include authentication for my app’s users?** Yes. Every project has CubiBase Auth on the project host: /auth/v1/signup, sign-in and refresh at /auth/v1/token, logout, anonymous sign-ins, Google sign-in, and TOTP multi-factor. Users live in the auth schema of your project database, passwords are hashed with Argon2id, and sessions use short-lived access JWTs with rotating refresh tokens. You can also verify RS256 tokens from your own identity provider via a JWKS URL. **How does authentication work?** Two different people authenticate. You sign in to the Console as a developer. Your application’s users either sign up through CubiBase Auth or sign in with your own identity provider. Either way each Data API request carries a JWT: HS256 signed with the project’s secret, or RS256 checked against a JWKS URL you configure. The verified subject becomes the user id for row policies. **Can visitors use my app before creating an account?** Yes, with anonymous sign-ins. Enable Allow anonymous sign-ins in the project’s Auth → Providers settings and POST /auth/v1/signup/anonymous returns a real session without credentials. When the visitor registers with email + password or links Google, the same account is upgraded in place: the user id, sessions, and data are preserved. **Does CubiBase support Google sign-in?** Yes. Google is a built-in OAuth/OIDC provider, configured per project in Auth → Providers. You create a Web application OAuth client in the Google Cloud Console, register the redirect URI CubiBase shows you, and paste the Client ID and secret into the Console. Apps use the redirect flow (/auth/v1/authorize) or verify a Google ID token directly (/auth/v1/token?grant_type=id_token). The docs have the step-by-step guide. **Can I require multi-factor authentication?** Yes, per project. Enable MFA and users can enroll an authenticator app with a TOTP secret. Make it required and sign-in returns a challenge until the user presents a valid code, and Data API requests need an MFA-verified session. **Does CubiBase send verification emails to my end users?** Not yet. By default, signup marks the email verified immediately (autoconfirm). If you turn autoconfirm off, new users start unverified. Console emails for developer accounts, such as verification and password reset, are a separate flow that does send email. ## Security and access **How does CubiBase restrict access to data?** The publishable key only identifies the project. The JWT subject is applied for that transaction. If you name a text user column when you create the table, the API role can only access rows where that column matches the subject. Row Level Security is enabled and forced on tables created in CubiBase. The Console uses a separate SQL role so the project developer can manage rows. **Does the publishable key return rows by itself?** No. A request without an end-user bearer token is rejected, even when the publishable key is valid. The key answers “which project is this?” The token answers “which user is this?” ## Storage and Functions **Does CubiBase include file storage, realtime, or functions?** File storage, yes: every project includes Storage with public and private buckets, direct uploads from the client, signed download links, and server-enforced storage and bandwidth quotas. Functions, yes: TypeScript and JavaScript functions on HTTPS endpoints, database events, storage events, and cron schedules, with quotas and logs included on every plan. Realtime subscriptions are not included. ## Pricing and plans **What does CubiBase cost, and is there an uptime SLA?** Plans are published: Free at $0, Pro at $25 per month, and Business at $99 per month. Every plan includes one project; additional projects are $9 per month on Pro and Business (not available on Free). Database storage is allocated per project; all other consumption quotas are shared across your organization. Upgrades are self-serve in the Console, billed monthly through Stripe. No uptime SLA is published on any plan. **What happens if my account goes over its plan quota?** By default, new signups or writes are refused and reads keep working. If the account stays over its limits, we email a warning and give 7 days to fix it. After those 7 days all of the account’s projects are suspended (the API returns 403 project_suspended) until you upgrade or reduce usage. Nothing is deleted, and projects reactivate automatically once the account fits its plan. On Pro and Business you can also enable additional usage beforehand, so consumption beyond the included quotas bills at published per-unit rates under a spending limit you choose, instead of being refused. **What is additional usage, and can it surprise me with charges?** Additional usage is optional metered billing for consumption beyond your included quotas, available on Pro and Business only. It is disabled by default and can only be enabled by an organization owner or billing admin in Console → Billing → Additional Usage, after reviewing the exact rates and choosing a monthly spending limit ($5, $10, $25, $50, $100, a custom amount, or no limit with explicit confirmation). Until you enable it, quotas refuse operations exactly as before — nothing is billed automatically. Free does not support paid overages. Rates and rules: https://cubibase.com/pricing (Additional usage section). **Can I downgrade my plan?** Yes, self-serve in the Console. Before a downgrade is confirmed, CubiBase checks your usage against the target plan: the number of projects (paused projects count), each project’s database size, and your shared object storage. If anything does not fit, the Console lists exactly what to resolve — delete projects or objects — and the change is refused until then. CubiBase never deletes databases or files to complete a downgrade. Monthly consumption already above the smaller allowance is simply blocked until the next cycle reset. Switching between Pro and Business applies immediately with Stripe prorations and preserves all purchased project slots and their charges; only the base plan price changes. **Can a project be paused for inactivity?** On the Free plan, yes. A project with no API, auth, or Console activity for 14 days is paused and the owner is emailed. Resume it from the Console within 60 days and it is active again instantly. After 60 days paused, CubiBase takes a full PostgreSQL backup (.backup file), keeps it, and removes the live database to stop storage costs. You can download the backup anytime, and Resume restores the database automatically. Paid plans are never paused for inactivity. --- # Privacy policy Source: https://cubibase.com/privacy Also available: [Markdown version](https://cubibase.com/privacy.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) This is a draft for legal review. It is not in effect, it has no effective date, and it is not a binding policy or contract until TradingPlus Inc. adopts it. ## 1. Who we are CubiBase is a developer platform operated by TradingPlus Inc., 9450 SW Gemini Dr, PMB 49313, Beaverton, OR 97008-7105, United States. Privacy questions go to support@cubibase.com. This draft describes the CubiBase marketing website at cubibase.com and the CubiBase service developers use through the Console and the APIs. It does not describe other products that TradingPlus Inc. may offer. ## 2. Scope The draft covers personal information TradingPlus processes to run the website and the developer platform. It also explains customer application data, which is different. If a practice is not described here, do not assume it. Several operational facts are listed for counsel in the internal review notes and are intentionally left open. ## 3. Two kinds of information Developer-account information is about you as a CubiBase customer: your email, password hash, session, projects, and how you use the Console. TradingPlus decides why that information is processed for the purpose of providing the platform. Application data is the content you and your users store in a project database. That may include your end users’ names, messages, or other records. You decide what that database contains and which tables are exposed. For that data, the intended relationship is that you are the controller (or the equivalent under your local law) and TradingPlus processes it to provide the platform. A data processing addendum is not published and is not offered by this draft. ## 4. Developer account information When you register, CubiBase stores the email address you submit and an Argon2id hash of your password. The password itself is not stored. The metadata database also stores project records, membership in projects you create, API key metadata, and audit events for actions such as creating a table or a key. - Email verification and password reset use single-use tokens. - A publishable API key is stored so the Data API can recognize the project. A secret key, if you create one, is shown once and stored only as a hash. - The Data API does not authenticate with that secret key in the current engine. ## 5. Authentication and account security The Console keeps the developer access token and refresh token in HTTP-only cookies named cb_access and cb_refresh. A CSRF cookie, cb_csrf, is not HTTP-only because the Console’s own requests need to read it. Refresh tokens rotate. These cookies are set by the Console, which is a separate application from this marketing website. Application requests carry an end-user JWT. CubiBase verifies it and uses the subject as the user id for that transaction. CubiBase Auth can also create and authenticate your application’s users: their emails, Argon2id password hashes, session records, and MFA factors are stored in the auth schema of your project database, and auth events are logged. For that data you remain the controller, as described above. Alternatively you can verify tokens from your own identity provider. A development issuer can mint a token for a user id you choose while you are building, when that issuer is enabled. ## 6. Usage logs and technical information API responses include a request id. The engine logs error events with that id. This draft does not state a log retention period, and it does not claim that logs are free of personal information. Confirm the log fields and retention before this policy is adopted. Standard hosting data, such as IP address, user agent, and the URL requested, may be processed by the website host and by the API host to deliver the service and to investigate abuse. The exact fields depend on the host configuration and are part of the review. ## 7. Cookies and analytics The marketing website loads Firebase Analytics, which uses Google Analytics 4, in production builds. The Firebase project is cubibase-firebase. The measurement ID is G-28D90H53PS. This is not the Firebase project used by the CubiBase Console. Google may receive pages viewed, referrer, approximate location derived from IP address, browser, device, and similar technical data, and may set its own cookies, including cookies named _ga. We use that measurement to see which public pages are used. This code does not configure Google advertising features or a remarketing audience. Analytics starts about a second and a half after the page renders, then loads the Firebase script. It does not run during static prerender, and the local development server does not send hits unless VITE_FIREBASE_ANALYTICS=true. A consent banner is not implemented in this version. Counsel should decide whether visitors in the EEA, the UK, or other regions must opt in before analytics runs, and this draft should be updated to match that decision. The marketing site does not set its own account cookies. Console session cookies are described in section 5. You can block cookies in your browser. If you block Google’s cookies, the page still loads. Blocking them may not stop every network request to Google. ## 8. Why information is processed - To create and secure your developer account. - To provision a project database and serve the Console and the Data API. - To verify end-user tokens you configure and apply row policies. - To measure use of the public website, as described above. - To answer a message you send to support@cubibase.com. - To investigate abuse and to enforce the acceptable use draft if those terms are adopted. This draft does not rely on a named legal basis such as “legitimate interests” or “contract.” The basis depends on the law that applies, which counsel must confirm. ## 9. Application data You choose the tables, columns, and rows. People described in those rows are usually your users, not CubiBase’s accounts. You are responsible for having a lawful basis to collect their information and for telling them how your application works. CubiBase’s generated REST API will return a row when the request satisfies the key, the token, the exposure flags, and any row policy on that table. Do not put secrets you cannot rotate into a table you then expose. The publishable key is not a substitute for a careful schema. ## 10. Controller and processor For developer-account information and marketing-site measurement, TradingPlus is acting for itself. For application data stored in a project database, the draft’s intended allocation is that the customer determines the purposes of that data and TradingPlus processes it to host the project. That allocation is not a signed data processing addendum. Do not cite this page as a DPA. ## 11. Service providers Google LLC processes Firebase Analytics for the marketing website, as configured in this repository. Amazon Web Services hosts the marketing website’s static files (S3 and CloudFront), as recorded in this repository’s infrastructure notes. Those two statements are about the public website. A subprocessor list for project databases, email delivery, and secret storage is not published. The engine can be configured with different adapters, so this page will not guess which vendors store customer databases. Counsel should approve a list before the policy names them. ## 12. Storage and international transfers This draft does not promise that developer accounts, project databases, logs, or analytics stay in the United States or the European Union. Google and Amazon may process website traffic in more than one country. Where a project database runs is an operational fact that must be written down before this policy states a region. ## 13. Security measures in the product The current engine hashes developer and end-user passwords with Argon2id, keeps Console session tokens in HTTP-only cookies, provisions a separate database per project, and creates request roles that cannot bypass row-level security. Tables created through CubiBase have row-level security enabled and forced. The Data API requires a publishable key and an end-user JWT. End-user refresh tokens rotate and are stored as hashes. The SQL editor accepts one read-only statement. The public website is served over HTTPS. This draft does not claim encryption at rest, a penetration test, a bug-bounty program, or a compliance certification. Those items are open until there is something specific to cite. ## 14. Retention Fixed retention periods are not published. Developer account records and project databases are kept while the account and project exist, subject to deletion behavior that still needs to be confirmed, including backups. Google’s analytics retention follows the Firebase and Google Analytics settings on the cubibase-firebase project. This draft does not restate a Google default as if TradingPlus had chosen it. ## 15. Deletion A project owner can delete a project through the control API the Console uses. This draft does not promise that backups disappear at the same moment, because backup behavior has not been stated. A self-serve control to delete the developer account itself was not found in the engine. To ask for account deletion, email support@cubibase.com from the address on the account. We will not invent a completion deadline on this page. ## 16. Privacy rights Depending on where you live, you may have rights to access, correct, delete, or export personal information, or to appeal a decision. This draft does not name a statute, a response deadline, or an appeal process. Email support@cubibase.com with the right you want to exercise and the email on the account. We may need to verify that you control the account. Requests about application data should go to the developer who runs that application. TradingPlus will assist that developer when a processing addendum, once it exists, requires it. The product, as built, does not include a feature that sells personal information. This sentence is a description of the software, not a legal warranty under any particular state privacy law. ## 17. Children CubiBase is a developer tool. It is not directed at children under 13, and we do not knowingly register a child under 13 as a developer. If you believe a child’s personal information was submitted as a developer account, email support@cubibase.com. Application data is controlled by the customer. Do not build an application for children on CubiBase unless you are prepared to meet the laws that apply to you. The minimum age to hold a developer account is part of the terms draft and is not settled. ## 18. Changes When a reviewed policy replaces this draft, the page will say so and will carry an effective date. Until that happens, this page stays marked as a draft. Continuing to use a future service after an adopted policy is posted is a question for the terms, not a trick hidden here. ## 19. Contact TradingPlus Inc., 9450 SW Gemini Dr, PMB 49313, Beaverton, OR 97008-7105, United States. Email support@cubibase.com. There is no published Data Protection Officer and no published EU or UK representative. Do not invent one from this page. --- # Terms of service Source: https://cubibase.com/terms Also available: [Markdown version](https://cubibase.com/terms.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) This is a draft for legal review. It is not in effect, it has no effective date, and it is not a binding policy or contract until TradingPlus Inc. adopts it. ## 1. The agreement These draft terms are between TradingPlus Inc. (“TradingPlus”) and the developer or organization that creates a CubiBase account (“you”). CubiBase is the platform: a Console, a control API, a project PostgreSQL database, and a Data API. They do not apply to unrelated TradingPlus products. Because this is a draft, creating an account does not by itself mean you have accepted a finished contract. Counsel must adopt a version, give it an effective date, and decide how acceptance works (for example, a checkbox at registration). ## 2. Eligibility The working proposal is that you must be at least 18 years old and able to form a contract, or that you act for an organization that can. Confirm the age threshold before adoption. You must register with an email address you can verify. The engine refuses to create a project until that email is verified. ## 3. Accounts You are responsible for the email, password, and session on your account, and for actions taken with that session. Tell TradingPlus at support@cubibase.com if you believe the account is compromised. The Console stores session tokens in HTTP-only cookies. You are responsible for signing out on a shared computer. ## 4. Access to the platform TradingPlus grants a limited, revocable, non-exclusive right to use CubiBase to build and run applications, subject to an adopted acceptable use policy. You do not receive rights to the engine source code, the Console source code, or another customer’s project. The Data API host for a project is https://{slug}.api.cubibase.com. Your application must send that project’s publishable key and an end-user JWT. You will not bypass host checks, probe other tenants, or present a key that belongs to a project you do not administer. ## 5. Projects A project is created by a verified developer and is owned by that developer’s membership. Provisioning then creates a database for that project. You choose the slug, the tables, the exposure flags, and the auth provider. CubiBase does not currently offer an invite API, so do not assume coworkers can be added. You will not register a slug in order to block another person, and you will not suggest that a project is an official CubiBase service. ## 6. Your data You keep ownership of the application data you store in a project database. TradingPlus does not claim your rows, your schema, or your users as its content. You grant TradingPlus the rights needed to host, back up, transmit, and display that data for the purpose of running the project, and to remove it when a project is deleted or the law requires removal. The backup mechanics are not specified in this draft. ## 7. Your responsibilities - Design a schema that matches what your application should reveal. - Set exposure only for operations you intend clients to call. - Choose a user column when end users must not read each other’s rows. The generated policy is equality on one text column. - Use CubiBase Auth or your own sign-in for end users, and the development token issuer only while building. - Give your users the notices their law requires. CubiBase’s privacy draft is about the platform, not a privacy policy for your app. - Do not upload data you have no right to store. ## 8. Credentials The publishable key identifies the project. It is expected to be present on client requests and it does not, by itself, return rows. You still revoke it if it leaks. Secret keys created in the control API are shown once and stored as a hash. The Data API does not accept them in the current engine. Do not ship a secret in a mobile or web client on the theory that it will authorize rows. You are responsible for the JWKS URL, issuer, and audience you configure. Point them at an identity provider you trust. Do not point a production project at a development secret you have pasted into a public repository. ## 9. Acceptable use The acceptable use draft at /acceptable-use is part of this draft. If both are adopted, a violation is a violation of the terms. Read that page before you test the service. Unsolicited scanning and traffic that harms other tenants are not allowed. ## 10. Limits and fair use The Data API caps list size (limit cannot exceed 1000), caps function (RPC) result sets at 10000 rows, and the SQL editor caps statement length, runtime, and returned rows. Plan quotas (projects per account, database size and end users per project) are published on the pricing page. When a quota is reached, new signups or writes are refused. An account that stays over its plan limits after a 7-day grace period has all of its projects suspended until it upgrades or reduces usage; data is not deleted for exceeding a quota. Free-plan projects without activity for 14 days are paused; after 60 days paused, the database is backed up to a downloadable .backup file and the live database is removed to stop storage costs. The backup is retained, and resuming the project restores it. Paid plans are not paused for inactivity. TradingPlus may apply further operational limits to protect the service. ## 11. Billing Monthly plan prices and quotas are published on the pricing page. Taxes, trials, and refunds are not. Creating a Console account does not start a paid subscription; paid plans are self-serve upgrades in the Console, billed monthly through Stripe, with payment methods, invoices, plan changes, and cancellation managed on the Console billing page. The price and the renewal terms have to be presented before they apply. Do not read a refund right into this page. None is stated. ## 12. Suspension and termination TradingPlus may suspend a project or an account that threatens the platform, other customers, or the law, or that violates an adopted acceptable use policy. The draft does not promise a notice period. Notice will be given when it would not make the harm worse. You may stop using CubiBase at any time. How long data remains after you stop is covered in the next section and is not fully specified. ## 13. Export and deletion While a project is active, you can read rows in the Console and, for exposed tables, through the Data API. The SQL editor can run a single read-only statement. A Free project archived for inactivity has a full-database .backup file (pg_dump custom format) that the owner can download from the Console at any time; resuming the project restores that backup automatically. A managed backup schedule or on-demand dump for active projects is not a published feature. Project deletion is available to the project owner through the control API. This draft does not promise an export window after deletion, and it does not state when backups are overwritten. Confirm both before adoption if customers will rely on them. ## 14. Third-party infrastructure CubiBase runs on infrastructure TradingPlus operates or contracts. The marketing site is hosted on Amazon Web Services. The database host for projects is not named in this draft, because the public policy should follow the deployment that is actually in service. Outages and data loss at a provider can affect CubiBase. No uptime percentage is promised. ## 15. Intellectual property TradingPlus and its licensors own CubiBase, including the software, the logo, and the website text. You receive no trademark license. You may state, factually, that your application uses CubiBase. You may not use the logo in a way that implies a partnership. Feedback you choose to send may be used to improve the product without an obligation to pay you. Do not send feedback you are not free to give. ## 16. Warranties The proposed warranty clause, which counsel must approve, is that CubiBase is provided as available, without warranties of merchantability, fitness for a particular purpose, title, or non-infringement, and without a warranty that the service will be uninterrupted or error free. Row-level security does not fix a policy you did not create. Some jurisdictions do not allow an exclusion of certain warranties. If that applies, the exclusion applies only to the extent allowed. ## 17. Limitation of liability The proposed limitation, which counsel must approve, is that TradingPlus is not liable for indirect, incidental, special, consequential, or lost-profit damages, or for loss of data, even if advised of the possibility. A dollar cap is not stated in this draft. Do not insert a figure from another company’s terms. Counsel should set a cap, or decide not to, with knowledge of the pricing that does not yet exist. Some jurisdictions do not allow certain limitations. If that applies, the limitation applies only to the extent allowed. ## 18. Changes to the service or the terms The platform will change. Features described on the website match the engine at the time they were written and can be added or removed. An adopted terms page should say how changes are announced. This draft suggests posting the new terms on this site and, for a material change, sending email to the address on the account. It does not set a number of days. A change that adds a fee is covered by the billing section and needs its own presentation. ## 19. Notices TradingPlus may send notices to the email on your account. You may send notices to support@cubibase.com and by mail to TradingPlus Inc., 9450 SW Gemini Dr, PMB 49313, Beaverton, OR 97008-7105, United States. A notice is not received merely because a page on the marketing site changed, until an adopted term says otherwise. ## 20. Governing law The proposal, subject to confirmation, is that Oregon law governs these terms, without regard to conflict-of-law rules, and that state or federal courts located in Oregon are the venue. Consumer protections that cannot be waived still apply. Counsel should confirm whether arbitration, a class waiver, or a different venue is wanted. None of those is adopted by this draft. Do not treat this paragraph as a forum-selection clause that is already in force. ## 21. Contact TradingPlus Inc., 9450 SW Gemini Dr, PMB 49313, Beaverton, OR 97008-7105, United States. support@cubibase.com. --- # Acceptable use policy Source: https://cubibase.com/acceptable-use Also available: [Markdown version](https://cubibase.com/acceptable-use.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) This is a draft for legal review. It is not in effect, it has no effective date, and it is not a binding policy or contract until TradingPlus Inc. adopts it. ## 1. Purpose This draft describes uses of CubiBase that TradingPlus does not allow. It is meant to be read with the terms draft. CubiBase is a PostgreSQL backend. The rules below cover both the Console and the Data API, and they cover application data you cause the platform to store or send. ## 2. Illegal activity You may not use CubiBase to break criminal, civil, or regulatory law. That includes storing or transmitting material that is illegal to possess, and operating an application whose purpose is fraud. You are responsible for the laws that apply to your users and to the data you put in a project. ## 3. Malware and hostile software You may not use a project to deliver malware, to operate a command channel for malware, or to exploit a person’s device. A table of “payloads” for that purpose is not an acceptable schema. ## 4. Credentials and unauthorized access - Do not store or traffic in stolen passwords, session tokens, or payment instruments. - Do not use CubiBase to collect credentials by deception. - Do not access another customer’s project, database, key, or account. - Do not probe the Data API for slugs you do not own, and do not submit another project’s publishable key. ## 5. Attacks on other services You may not use CubiBase as a source of denial-of-service traffic, credential stuffing, scanning, or any other attack against a third party. You also may not point a project’s JWKS URL at an internal address in order to make the engine request a network it should not reach. The engine already refuses some of those URLs. The rule stands even where a filter fails. ## 6. Spam and phishing You may not use application data or the platform’s email features to send unsolicited bulk email, phishing, or messages that impersonate TradingPlus, CubiBase, or another company. Transactional email that your own users asked for is a different matter and still has to comply with the law that applies to you. ## 7. Computing resources You may not use the SQL editor, the row API, or the Data API to exhaust CPU, connections, or storage, or to interfere with other projects. The product already limits statement time, row counts, and pool size. Staying under a single request’s cap does not make a flood of requests acceptable. Plan quotas are published on the pricing page and enforced as described in the terms draft. Beyond those quotas, TradingPlus may throttle or suspend work that degrades the service. ## 8. Mining You may not use CubiBase compute, including database CPU, to mine cryptocurrency or to perform proof-of-work calculations. CubiBase is not a generic compute platform. ## 9. Security testing You may test the security of your own project, your own keys, and your own client. You may not test another customer’s project. You may not run automated vulnerability scans against cubibase.com, the Console, or the Data API hosts without written permission from TradingPlus. If you find a weakness, email support@cubibase.com with enough detail to reproduce it. Do not exfiltrate other people’s data to prove the point. A bounty program is not published. Do not expect a payment. ## 10. Enforcement TradingPlus may investigate suspected violations, remove data that violates this draft once the policy is adopted, and suspend the project or the account. Where the law requires, TradingPlus may preserve or disclose information. The terms draft describes suspension. There is no published appeal deadline. You can write to support@cubibase.com and explain the context. A response is not guaranteed by this draft. ## 11. Contact Report abuse to support@cubibase.com. Mail: TradingPlus Inc., 9450 SW Gemini Dr, PMB 49313, Beaverton, OR 97008-7105, United States. --- # A real PostgreSQL database for every project. Source: https://cubibase.com/features/postgresql Also available: [Markdown version](https://cubibase.com/features/postgresql.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every CubiBase project gets its own PostgreSQL database. It is ready when provisioning finishes, other projects cannot query it, and your tables are ordinary PostgreSQL tables you design in the Console and expose over REST. ## At a glance - **One database per project** — One slug maps to one database. Requests to the project host reach only that database; other projects cannot query it. - **Provisioning as a job** — The Console shows provisioning, active, or failed. A failed provision can be retried by the project owner. - **Ordinary PostgreSQL tables** — uuid, text, integer, bigint, boolean, timestamptz, jsonb, numeric, and double precision, with one primary key per table. - **Four roles, no superuser** — DDL, API, SQL, and auth roles. Each is NOSUPERUSER and NOBYPASSRLS. - **Managed schemas** — Your tables in public; auth, logs, vault, and storage managed by CubiBase alongside them. - **Read-only SQL editor** — One statement on the SQL role inside a read-only transaction. Schema changes go through the Database screens. ## What “dedicated” means here Each project has a slug, a status, and its own database. Your application data goes in that database. Your developer account, Console sessions, and the list of your projects are stored separately. - One slug, such as example-project, maps to one database, such as example_project_db. - Requests are routed by the project host, such as example-project.api.cubibase.com. A client cannot point a request at another project. - Provisioning is a job. The Console can show whether the project is still provisioning, active, or failed. - A failed provision can be retried by the project owner. A retry does not create a second database for a project that is already active. ## You still use SQL Tables you create through CubiBase are ordinary PostgreSQL tables in the public schema. Column types include uuid, text, integer, bigint, boolean, timestamptz, jsonb, numeric, and double precision. A table needs exactly one primary key. The Console SQL editor is for reading. It runs one read-only statement on a SQL role inside a read-only transaction. Changing columns is a schema operation, not an ad hoc script in that box. ## Four roles, none of them a superuser Provisioning creates four login roles for the project database. Each is NOSUPERUSER and NOBYPASSRLS. - The DDL role owns the tables you create from the Console. - The API role runs Data API requests, and only after you grant an operation by exposing it. - The SQL role serves the Console row browser and the read-only SQL editor. - The auth role runs the sign-up, sign-in, and session flows against the managed auth schema. ## Schemas the platform manages Your tables live in public. Alongside it, provisioning creates managed schemas: auth holds end users, refresh sessions, and MFA factors; logs holds request and auth events written by CubiBase; vault holds project secrets that no request role can read; storage holds the bucket and object catalog for file storage. The SQL role can read auth tables and logs from the Console SQL editor. The Data API serves public tables you expose, and the auth endpoints are the application path to user accounts. ## FAQ **When does the database exist?** After the provisioning job completes and the project status is active. Registration of the project alone does not create the database. **Can two apps share one CubiBase database?** Put them in the same project only if they should share that database. If they should be isolated, create two projects. CubiBase does not offer a shared schema as a substitute for a separate database. ## Related - [Authentication](https://cubibase.com/features/authentication) — The auth schema and the sign-up endpoints in that database. - [Database management](https://cubibase.com/features/database-management) — Create tables and inspect rows from the Console. - [REST API](https://cubibase.com/features/rest-api) — Call the database from your application. - [Quickstart](https://cubibase.com/docs/quickstart) — The path from an empty project to a first request. --- # Sign-up and sign-in for your application users. Source: https://cubibase.com/features/authentication Also available: [Markdown version](https://cubibase.com/features/authentication.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every project includes CubiBase Auth: email and password, anonymous sign-ins that convert into real accounts, Google sign-in, and TOTP multi-factor. Users live in your project database, and the access token they receive is the JWT your Data API calls already use. ## At a glance - **Email + password** — Signup and sign-in at /auth/v1. Passwords are stored only as Argon2id hashes in your own database. - **Anonymous sign-ins** — Visitors get a real session without credentials, then convert in place — same user id, sessions, and data. - **Google sign-in** — Built-in OAuth/OIDC with a browser redirect flow or a verified Google ID token from your mobile or web app. - **TOTP multi-factor** — Enroll an authenticator app per user; make MFA optional or required for the whole project. - **Rotating sessions** — Access tokens live one hour, refresh tokens 30 days. Reuse of a retired token revokes the whole family. - **Bring your own IdP** — Configure a JWKS URL, issuer, and audience and CubiBase verifies RS256 tokens on every Data API request. ## The flows your app calls All auth endpoints live on the project host under /auth/v1 and require the apikey header, the same publishable key as the Data API. The user’s password travels in the request body over HTTPS and is never stored in plain text. - POST /auth/v1/signup creates a user and returns a session: user, accessToken, refreshToken, expiresIn. - POST /auth/v1/signup/anonymous creates a session without credentials, when the project allows it. - POST /auth/v1/token?grant_type=password signs a user in with email and password. - POST /auth/v1/token?grant_type=refresh_token exchanges a refresh token for a new session. - POST /auth/v1/token?grant_type=id_token verifies a Google ID token and returns a session. - GET /auth/v1/authorize?provider=google starts the Google redirect flow. - PATCH /auth/v1/user updates the signed-in user, and converts anonymous users to email + password. - POST /auth/v1/logout revokes the session behind a refresh token. - GET /auth/v1/user returns the signed-in user, read from the bearer token. The access token is HS256, signed with the project’s signing secret. Its sub claim is the user id, and that id becomes cubibase.user_id for Data API transactions. A table with a user column now has a real person behind every row policy check. ## Sessions that rotate and can be revoked By default an access token lives for one hour and a refresh token for 30 days. Refreshing issues a new pair and retires the old refresh token. If a retired refresh token is presented again, CubiBase revokes the whole token family, so a stolen copy stops working. Every Data API request checks that the session behind the token is still live. Revoking a session, or banning a user, takes effect on the next request, not when the access token expires. ## Anonymous users who become real accounts Switch on Allow anonymous sign-ins in the project’s Providers settings and visitors can start using the app immediately: POST /auth/v1/signup/anonymous returns a full session for a user with no email or password. The user id is real, so rows they create under a user-column policy already belong to them. When the visitor registers, the account is converted in place, not copied: PATCH /auth/v1/user with the anonymous bearer token plus an email and password keeps the same user id, sessions, metadata, and data. Linking Google with the anonymous bearer token does the same. In the Console, anonymous users carry an Anonymous badge and a dedicated filter. ## Google sign-in, configured in minutes Google is a built-in OAuth/OIDC provider. Create a Web application OAuth client in the Google Cloud Console, register the redirect URI CubiBase shows you, and paste the Client ID and Client secret into Auth → Providers → Google. The secret is stored encrypted and never displayed again. - Browser flow: GET /auth/v1/authorize?provider=google&redirect_to=… returns the Google consent URL; after consent, CubiBase redirects to your allowlisted app URL with the session tokens in the URL fragment. - Token flow: apps that already hold a Google ID token (Google Sign-In on mobile or web) POST it to /auth/v1/token?grant_type=id_token; CubiBase verifies the RS256 signature, issuer, audience, and expiry. - Linking: send the end-user bearer token with either flow and the Google identity attaches to that user — the anonymous-to-Google upgrade path. - Safety: redirect targets are checked against a per-project allowlist, OAuth states are hashed and single-use, and a verified Google email can attach to a matching existing account. The step-by-step guide — what to click in the Google Cloud Console, where the redirect URI goes, and how your app reads the tokens — is in the docs. ## TOTP multi-factor, per project Turn MFA on in the project’s auth settings and users can enroll an authenticator app: POST /auth/v1/factors returns a TOTP secret and URI, and POST /auth/v1/factors/verify confirms the first code. You can also make MFA required for the whole project. When a user with a verified factor signs in, the password grant returns an MFA challenge instead of a session. The app posts the challenge id and the six-digit code to /auth/v1/token?grant_type=mfa and receives the session. Challenges expire after five minutes. ## Settings you control per project - Signup and password sign-in can each be switched off. - Anonymous sign-ins are opt-in: Allow anonymous sign-ins in Auth → Providers. - Google sign-in is opt-in: enable it and store the OAuth Client ID and secret in Auth → Providers. - Minimum password length defaults to 8 characters. - Access token TTL defaults to 1 hour; refresh token TTL defaults to 30 days. - MFA can be optional or required. - Rate limits per project: 30 signups per hour and 30 sign-ins per minute per IP by default, adjustable. These settings and the user directory are managed from the Console: Auth → Providers, Users, Sessions, Multi-factor, and Rate limits. Auth events are also written to the project’s logs schema, readable from the Console SQL editor. ## What email verification does today By default, signup marks the email as verified immediately (autoconfirm). CubiBase does not send a confirmation email to your end users yet. If you turn autoconfirm off, new users start unverified. Keep that in mind when you design your onboarding. ## Already have an identity provider? You can keep it. Configure the project with a JWKS URL, issuer, and audience, and CubiBase verifies RS256 tokens from that provider on every Data API request. CubiBase Auth and an external provider are alternatives; a project’s requests are checked against the provider configuration you set. While building, a development token issuer can mint an HS256 token for a user id you choose, when that issuer is enabled. Google is built in as a social provider; other social providers and SAML are not available today. ## FAQ **Where do my application users live?** In the auth schema of your project’s own PostgreSQL database, in auth.users. Passwords are stored only as Argon2id hashes. Refresh tokens are stored as hashes too. Google identities are rows in auth.identities, linked to the same user table. **Do I still need my own auth server?** Not for email and password, anonymous sessions, or Google sign-in. Signup, sign-in, refresh, logout, Google OAuth, and TOTP MFA are served by the project host. You still build the screens in your app; CubiBase answers the HTTP calls. **What happens to an anonymous user’s data when they register?** Nothing is moved or lost. Conversion updates the same auth.users row in place: the user id stays, sessions keep working, metadata is merged, and rows written under that id remain theirs. The same applies when they link Google instead of setting a password. **Where do I configure Google sign-in?** Two places. In the Google Cloud Console: an OAuth consent screen and a Web application OAuth client whose Authorized redirect URI is the callback URL CubiBase displays. In the CubiBase Console: Auth → Providers → Google, where you enable the provider and paste the Client ID and Client secret. The docs walk through every click. **Does CubiBase send verification emails to my users?** Not yet. Autoconfirm marks new users verified at signup by default. If you disable it, new users start unverified. Google sign-in marks the email verified when Google reports it verified. Developer-account emails from the Console are a separate flow. **What happens when a refresh token is stolen and reused?** Refresh tokens rotate. When a token that was already replaced is presented again, CubiBase revokes the entire token family and the attacker’s session dies with it. ## Related - [Security](https://cubibase.com/features/security) — How the JWT subject becomes a row policy. - [REST API](https://cubibase.com/features/rest-api) — The calls that consume the access token. - [Google setup guide](https://cubibase.com/docs/auth/google) — Every step in the Google Cloud Console and the CubiBase Console. - [Anonymous sign-ins](https://cubibase.com/docs/auth/anonymous) — Enable the toggle, sign in visitors, convert them later. - [Email and password](https://cubibase.com/docs/auth/email-password) — Sign up a first user, then call a table. --- # Your tables. Your APIs. Automatically. Source: https://cubibase.com/features/rest-api Also available: [Markdown version](https://cubibase.com/features/rest-api.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Once you expose a table, CubiBase serves it at https://{slug}.api.cubibase.com/rest/v1/{table}. You do not write a controller for that table. You do choose the operations. A new table starts unexposed, and a request still needs a publishable key plus an end-user JWT. ## At a glance - **Instant CRUD** — GET lists rows, POST creates one, PATCH and DELETE address a primary key. No controller to write. - **Explicit exposure** — Select, insert, update, and delete are separate switches. A new table starts unexposed; turning a switch off revokes the grant. - **Filters and ordering** — column=op.value with nine operators, order on up to three columns, and limit up to 1000. - **RPC for SQL functions** — Grant Data API EXECUTE and call POST /rest/v1/rpc/{name} with named arguments. Row-level security applies inside the function. - **Two credentials** — The apikey header names the project; the bearer JWT names the user. A valid key alone is not enough. - **Stable error codes** — 401 for missing or invalid credentials, 404 for unexposed tables, 405 for operations you did not turn on. ## The request CubiBase actually accepts The host selects the project. The path selects the table. The apikey header must be an active publishable key for that project. Authorization must be a bearer JWT whose subject CubiBase can verify. - GET /rest/v1/customers lists rows. GET /rest/v1/customers/{id} reads one row. - POST creates a row and returns 201. PATCH and DELETE address one primary key. - Filters use column=op.value. Operators are eq, neq, gt, gte, lt, lte, like, ilike, and is. - order is column.asc or column.desc, with at most three columns. limit defaults to 20 and cannot exceed 1000. - A list response is an object with a data array. A single row is an object with a data value. ## Exposure is explicit Select, insert, update, and delete are separate switches. If select is off, GET is not offered for that table. The API role receives only the grants you turn on. Turning a switch off revokes that privilege. This is the sense in which the API is automatic. CubiBase maps the exposed table to HTTP. It does not publish every table you create, and it does not invent relationships or nested resources. ## Your functions, callable too Logic that spans tables belongs in a SQL function. Write it in the Console, grant Data API EXECUTE, and your app calls it at POST /rest/v1/rpc/{name} with a JSON object of named arguments. The call runs with the end user’s identity, so row-level security applies inside the function. - POST /rest/v1/rpc/customer_count with { "plan_name": "pro" } returns { "data": 2 }. - SETOF functions return an array; void returns null; the envelope is the same data field as table routes. - Revoking EXECUTE removes the endpoint immediately. Private functions answer 404, like missing ones. ## Errors worth handling - 401 missing_api_key or invalid_api_key when the publishable key is absent or wrong. - 401 missing_end_user_token when the bearer token is absent. - 404 when the host is not an active project, or the table is not available for that call. - 405 method_not_allowed when that operation is not exposed. ## FAQ **Is the path /v1/customers or /rest/v1/customers?** The Data API path is /rest/v1/{table} on your project host, for example https://example-project.api.cubibase.com/rest/v1/customers. **Can I select a subset of columns?** Yes. The select query parameter takes a comma-separated list of one to 64 columns. **Can my app run custom SQL logic?** Through functions, not raw SQL. Create a function in the Console, grant Data API EXECUTE, and call POST /rest/v1/rpc/{name}. The SQL editor itself stays a Console tool. ## Related - [Security](https://cubibase.com/features/security) — Why the key and the JWT do different jobs. - [Calling functions (RPC)](https://cubibase.com/docs/data-api/rpc) — Arguments, result shapes, and overload rules. - [PostgreSQL](https://cubibase.com/features/postgresql) — Where those rows actually live. - [Data API docs](https://cubibase.com/docs/data-api) — A worked example for the customers table. --- # See your data. Shape your database. Source: https://cubibase.com/features/database-management Also available: [Markdown version](https://cubibase.com/features/database-management.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) The Console is the developer view of a project database. You create tables, browse and edit rows, write row-level security policies, and manage functions, triggers, indexes, types, and views — all in the public schema. These are developer tools in the Console, separate from the Data API your application calls. ## At a glance - **Tables and columns** — Up to 64 columns with nine PostgreSQL types and defaults like gen_random_uuid() and now(). - **Row browser** — Filter, select, and order with the same syntax as the Data API. Owners and admins edit rows; developers read. - **Policies** — Write PostgreSQL policies with USING and WITH CHECK expressions for the API and Console roles. - **Functions and triggers** — SQL or PL/pgSQL functions with overloads and SECURITY DEFINER, run automatically on INSERT, UPDATE, DELETE, or TRUNCATE. - **Indexes, types, views** — Six index methods, enums and composite types, saved views, and materialized views with a refresh button. - **Read-only SQL editor** — One statement, at most 200 rows, a short timeout. Inspect data here; change schema in the Database screens. ## Tables and columns A new table needs a name, one primary key, and up to 64 columns. You can add a column later. You cannot add a primary key later, and you cannot drop the primary key or the user column used for row policies. Supported types are uuid, text, integer, bigint, boolean, timestamptz, jsonb, numeric, and double precision. Defaults can be gen_random_uuid(), now(), true, or false. ## Rows, filters, and sorting The row browser lists a table with the same filter, select, and order syntax as the Data API. Owners and admins can insert, update, and delete rows from the Console. A developer membership can read. These calls use the SQL role, so they are project-administration operations, not end-user requests. ## Policies, functions, triggers, indexes, types, views The Database menu goes beyond tables. Every object you create lives in the public schema of your project database, owned by the project’s own DDL role. The platform schemas — auth, vault, logs — stay managed and out of reach. - Policies: enable or disable Row Level Security per table, and write PostgreSQL policies with USING and WITH CHECK expressions for the API and Console roles. - Functions: create and replace SQL or PL/pgSQL functions, with overloads, SECURITY DEFINER, and a Data API execute grant. - Triggers: run a function automatically on INSERT, UPDATE, DELETE, or TRUNCATE — before or after, per row or per statement, with WHEN conditions. - Indexes: btree, hash, GIN, GiST, SP-GiST, and BRIN; composite columns, expressions, partial filters, and unique indexes. Constraint-backed indexes are protected. - Types: enums with ordered labels you can add and rename, and composite types for function returns. - Views: saved SELECT queries, plus materialized views with a refresh button and a Data API select grant. ## The SQL editor stays read-only - One statement, at most 8,000 characters. - It must start with select, with, explain, show, values, or table. - The transaction is read-only, with a statement timeout of a few seconds. - The response includes at most 200 rows and says when the result was truncated. Use the editor to inspect data. Use the Database screens when you need a new column, policy, function, or index. ## FAQ **Can I paste a migration file into the SQL editor?** No. The editor rejects anything that is not a single read-only statement. Schema changes go through the Database screens: tables, policies, functions, triggers, indexes, types, and views. **Can I create objects in schemas other than public?** No. The Database managers work only in the public schema of your project database. The auth, vault, and logs schemas are platform-managed and cannot be modified from the Console. **Will the row browser show every end user’s rows?** The Console uses the SQL role, whose table policy allows the developer to manage rows in the project. Application users are limited by the API role and the user-column policy. Those are different paths. ## Related - [PostgreSQL](https://cubibase.com/features/postgresql) — How the project database is provisioned. - [REST API](https://cubibase.com/features/rest-api) — Expose a table after you are ready for application traffic. - [Policies](https://cubibase.com/docs/database/policies) — Write your own row-level security rules. - [Functions and triggers](https://cubibase.com/docs/database/functions) — Database logic that runs where the data lives. - [SQL editor](https://cubibase.com/docs/database/sql-editor) — The limits, with example queries. --- # Access you control. Data you protect. Source: https://cubibase.com/features/security Also available: [Markdown version](https://cubibase.com/features/security.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase separates project identity from user identity. The publishable key tells the Data API which project you are calling. The end-user JWT tells it which subject to apply. Row policies on the API role decide which rows that subject can touch. None of this is a certification, an SLA, or a promise that a mis-designed policy is safe. ## At a glance - **Project isolation** — Each active project has its own database and roles. A request reaches only its own project’s database. - **Key and token, different jobs** — The publishable key names the project and never authorizes a row. The bearer JWT names the user. - **Forced Row Level Security** — Created tables have RLS enabled and forced. A user column binds the API role to cubibase.current_user_id(). - **Your own policies** — Write USING and WITH CHECK expressions per command, permissive or restrictive, validated before PostgreSQL sees them. - **Live session checks** — Every request verifies the session is live and the user is not banned. Revocation takes effect on the next call. - **Hardened Console session** — Argon2id developer passwords, HTTP-only cookies, a CSRF cookie, single-use email tokens, rotating refresh. ## Project isolation Each active project has its own database and its own roles. The Data API will not serve a project that is not active, and a request on one project host cannot reach another project’s data. Your developer account and project settings are stored separately from project data. ## The key and the token do different jobs Send the publishable key in the apikey header. It is meant to live with the client because it does not authorize rows. Treat it as a project credential anyway: revoke it if it leaks, and do not confuse it with a secret. Send the user’s JWT as a bearer token. CubiBase Auth issues HS256 tokens signed with the project’s signing secret when your users sign up or sign in through /auth/v1. Alternatively, CubiBase accepts RS256 when you set a JWKS URL, issuer, and audience for your own identity provider. The verified subject is written to cubibase.user_id for that transaction. For tokens that carry a session id, every request also checks that the session is still live and the user is not banned. A revoked session fails on the next call, even if the access token has not expired. A development issuer can still mint a token for a user id you choose while you are building. The Console can also create a secret key with the prefix cb_sec_. That secret is returned once and stored as a hash. The Data API does not authenticate with it. Do not send it from a client in the expectation that it will return rows. ## Row Level Security Tables created through CubiBase have Row Level Security enabled and forced. If you pass a text column as the user column, CubiBase creates a policy for the API role: a row is visible and writable only when that column equals cubibase.current_user_id(). If you skip the user column, the API role has no isolation policy of its own. The SQL role, used by the Console, has a separate policy so the project developer can work with rows. Forcing RLS does not mean the Console is limited to a single end user. Beyond the created policy, the Policies screen lets you write your own: USING and WITH CHECK expressions per command, permissive or restrictive, targeting the API role, the SQL role, or both. Expressions are validated as single expressions and checked against the table’s columns before PostgreSQL ever sees them. ## Your Console session Developer passwords are hashed with Argon2id. The Console keeps the access and refresh tokens in HTTP-only cookies, so page scripts cannot read them. A CSRF cookie is readable by the Console’s own requests. Email verification and password reset use single-use tokens. Refresh tokens rotate. ## What this page does not claim CubiBase has not published a compliance certification, a residency guarantee, or an uptime SLA. The public endpoints are served over HTTPS. You still choose the user column, the exposure flags, and how your app signs tokens. ## FAQ **Can I rely on the publishable key as the only protection?** No. The Data API rejects a call that has a valid key and no end-user token. You also need a row policy that matches the way your table stores the user id. **Where are developer passwords stored?** Only as Argon2id hashes, stored separately from your project data. This website never sees your password; you sign in on console.cubibase.com. ## Related - [Authentication](https://cubibase.com/features/authentication) — Where the end-user JWT comes from. - [REST API](https://cubibase.com/features/rest-api) — The headers and status codes your app will see. - [Acceptable use](https://cubibase.com/acceptable-use) — The boundary for security testing. - [Privacy draft](https://cubibase.com/privacy) — How account data and application data differ. --- # File storage inside every project. Source: https://cubibase.com/features/storage Also available: [Markdown version](https://cubibase.com/features/storage.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase Storage keeps your files in private, encrypted object storage and the file catalog in your project’s PostgreSQL database. Apps upload directly with short-lived authorizations, every download is metered, and private buckets require a key, a user session, or a signed link. ## At a glance - **Public and private buckets** — Per-bucket visibility, MIME allowlists, and size caps. Folders are path prefixes over opaque physical keys. - **Direct uploads** — A presigned POST pinned to one upload and the exact size. The file goes straight from the client to storage. - **Metered downloads** — Every download counts against bandwidth. Range requests are metered byte-accurately. - **Signed share links** — A signed token scoped to a single object with a short expiry. Public objects also have a stable public URL. - **Hard quotas** — Capacity checked atomically before any upload authorization. At a limit, uploads stop by default — metered additional usage is an explicit opt-in with a spending limit. - **Durable object events** — Created, updated, and deleted events recorded with every catalog change, ready to trigger Functions. ## Public and private buckets A bucket is a named container for objects, unique within the project. Each bucket is public or private, can cap the file size below the plan maximum, and can restrict uploads to an allowlist of MIME types such as image/* or application/pdf. - Public means anonymous read-only access to published files. Uploads, overwrites, and deletions always require authorization. - Private buckets require a project API key, an end-user session, or a short-lived signed download link. - Folders are path prefixes, not real directories: images/avatar.png is a logical path, while the stored object uses an opaque generated key. - Bucket metadata lives in a managed storage schema in the project database — customer code cannot read or write it directly. ## Direct uploads, verified completion An upload takes three steps. Your client starts an upload session; CubiBase reserves the bytes against the project and account quotas and returns a short-lived presigned POST pinned to one upload and the exact declared size. The client posts the file directly to storage. Then the client completes the session: CubiBase checks the stored object’s exact size and MIME type, publishes it at its path, and turns the reservation into committed usage. Completion is idempotent, expired sessions release their reservations automatically, and a failed upload never becomes a downloadable object or emits a creation event. Overwriting an existing path requires an explicit opt-in and accounts for the net change in bytes. ## Metered downloads and signed links Every download — public or private, API or Console — counts against the account’s monthly bandwidth quota. HTTP Range requests are supported and metered byte-accurately; a canceled download counts only the bytes actually delivered. There are no unrestricted download URLs that could bypass the meter. For sharing, CubiBase issues a signed download token scoped to a single object with a short expiry. Public objects also have a stable public URL. ## Quotas enforced on the server Storage limits come from the same subscription as the rest of the platform, shared across your organization: Free includes 2 GB of object storage, Pro 100 GB, Business 250 GB, with 15 GB/500 GB/750 GB of monthly total bandwidth shared by API responses and file delivery (API bandwidth is a sublimit of that total) and a 50 MB/1 GB/5 GB maximum file size. Capacity is checked atomically before any upload authorization is issued, so concurrent uploads cannot race past it. - At a storage limit, new uploads are blocked; downloads, deletions, and upgrades keep working. - When bandwidth is exhausted, downloads are refused until the billing cycle resets; metadata management stays available. - Downgrading below current usage preserves every file and blocks uploads until usage fits the new plan. - No automatic overage charges: by default a quota is a hard stop, not a bill. Paid plans can opt in to metered additional usage with a spending limit. ## Durable object events and function triggers Every finalized upload, overwrite, and deletion records a versioned storage.object.created, storage.object.updated, or storage.object.deleted event in the same database transaction as the catalog change. Events carry the project, bucket, object, path, size, and actor identity — never file contents or credentials. CubiBase Functions consume these events through storage triggers: generate thumbnails, process PDFs, clean up expired files. Configure a bucket, event types, and an optional key prefix in the Console — no polling infrastructure of your own. Function-created objects count toward the same quotas through the same service, and invocation-depth tracking bounds recursive loops. ## FAQ **Do storage credentials ever reach the client?** No. Clients receive only a short-lived presigned POST for one upload with an exact size, or a signed download token for one object. The underlying storage blocks all public access. **What happens to a file when I overwrite it?** The new upload must explicitly opt in to overwriting. CubiBase verifies the new object before replacing the old one and adjusts usage by the net difference in bytes. A storage.object.updated event is recorded. **Is storage isolated between projects?** Yes. Stored objects are namespaced by project and bucket, the catalog lives in each project’s own database, and every request is resolved from the project host and credentials — never from a client-supplied project id. ## Related - [Storage docs](https://cubibase.com/docs/storage) — Buckets, uploads, downloads, and quota errors with real API calls. - [Security](https://cubibase.com/features/security) — Keys, JWTs, and the authorization model Storage reuses. - [Pricing](https://cubibase.com/pricing) — Storage and bandwidth quotas on every plan. --- # Your code, next to your data. Source: https://cubibase.com/features/functions Also available: [Markdown version](https://cubibase.com/features/functions.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase Functions run your TypeScript and JavaScript in an isolated, managed runtime. Four trigger types share one execution pipeline: HTTPS endpoints, committed database changes, storage object events, and cron schedules. ## At a glance - **HTTPS endpoints** — GET, POST, PUT, PATCH, DELETE, and OPTIONS at /functions/{name}, with the exact raw body preserved for signature verification. - **Database events** — After-commit INSERT, UPDATE, and DELETE events captured atomically with your data change. A function failure never rolls back your transaction. - **Storage events** — Object created, updated, and deleted events, filtered by bucket and key prefix. File contents never ride in the payload. - **Cron schedules** — Standard cron expressions in UTC or a configured timezone, with last and next run visibility. Missed runs collapse into one catch-up run. - **Gateway authentication** — JWT, public, secret API key, or internal-only access, enforced before your code runs. Payload signature verification is a separate setting. - **Signed webhooks** — Built-in HMAC-SHA256 with replay protection, or verify Stripe and GitHub signatures yourself on the untouched body. - **Immutable deployments** — Every deploy builds a new version. A failed build leaves the working version serving; activate an older version to roll back. - **Eight templates** — Hello World, Stripe Webhook, GitHub Webhook, Send Email, OpenAI Proxy, Image Processing, Database Change Handler, and Scheduled Cleanup. - **Execution history** — Trigger, version, duration, status, error category, and captured console output for every run, with filters and a delivery queue. - **Encrypted secrets** — Secrets are encrypted at rest, never returned by read APIs, and redacted from logs. Functions get a short-lived, single-invocation credential. - **Enforced quotas** — Invocations and GB-seconds metered per organization, shared across projects. At a limit, invocations are refused with 402 by default; paid plans can opt in to metered additional usage with a spending limit. - **Durable delivery** — Async triggers deliver at least once, with durable retries and a queryable dead-letter queue. Deduplicate on the event id. ## Functions, not SQL functions A CubiBase Function is application code you deploy from the Console: a default-exported async handler that receives the request or event and a context with scoped database, storage and environment access. It runs on Node.js 22 in a separate, isolated environment per project and function, with no platform credentials and no access to other projects. This is different from PostgreSQL SQL functions, which live inside your project database and are managed under Database → SQL Functions. Both exist; they do different jobs. Database Event Triggers bridge them: a committed INSERT, UPDATE or DELETE can invoke a CubiBase Function asynchronously. Execution is regional today. CubiBase does not offer globally distributed edge execution. ## Four ways to run - HTTP: an HTTPS endpoint at https://{project}.api.cubibase.com/functions/{name}, supporting GET, POST, PUT, PATCH, DELETE and OPTIONS, with the exact raw request body preserved for signature verification. - Database: after-commit INSERT/UPDATE/DELETE events on tables you subscribe to, captured atomically with your data change. A function failure never rolls back your transaction. - Storage: object created, updated and deleted events from the existing Storage event stream, filtered by bucket and key prefix. Failed uploads never emit events; file contents never ride in the payload. - Scheduled: standard cron expressions in UTC or a configured timezone, with last/next run visibility. Missed runs collapse into one catch-up run. Database, storage and scheduled executions are asynchronous with at-least-once delivery, durable retries and a queryable dead-letter queue. Deduplicate on the event id — the templates show the pattern. ## Authentication and signed payloads HTTP functions choose an authentication mode enforced by the gateway before your code runs: JWT (the default, using CubiBase Auth tokens), public, secret API key, or internal-only. Payload signature verification is a separate, independent setting. - Built-in HMAC-SHA256: the gateway verifies the exact raw bytes with timestamp tolerance, constant-time comparison and single-use nonces (replay protection). Signing secrets are encrypted, shown once, and rotatable without dropped deliveries. - Custom verification: Stripe, GitHub and other providers keep their own signature schemes. The function receives the untouched body and headers; the Stripe and GitHub templates verify them with constant-time checks. - Secrets are encrypted at rest, never returned by read APIs, and redacted from logs. Functions reach your database and files through scoped CubiBase APIs with a short-lived, single-invocation credential — never a database password. ## Deployments that cannot break production Every deploy builds an immutable version. Your code is bundled, never executed at build time, and imports are limited to Node built-ins plus a pinned dependency allowlist. A successful build atomically switches the active version; a failed build leaves the working version serving. Activate an older version to roll back. ## Start from working code Eight versioned templates generate editable, functional code with the right trigger and security defaults: Hello World, Stripe Webhook, GitHub Webhook, Send Email, OpenAI Proxy, Image Processing, Database Change Handler and Scheduled Cleanup. The Stripe template verifies Stripe-Signature on the raw body, deduplicates deliveries, and walks you through the Dashboard configuration — it never claims the integration is connected until a signed test event succeeds. ## Every run is visible Each invocation records its trigger, deployment version, duration, status, error category and captured console output — bounded, redacted and isolated per project. The Console shows execution history with filters, a delivery queue for async events, and per-function logs. Retention follows your plan. ## Quotas on every trigger Functions use the same subscription as the rest of CubiBase. Function count, concurrent executions and schedules are limited per project; invocations and compute (GB-seconds) are metered per organization per billing cycle, shared across all projects — the same convention as bandwidth. Every trigger type passes the same atomic reservations; there is no side door. By default, at a limit invocations are refused, not billed as overage (paid plans can explicitly enable metered additional usage with a spending limit); exhausting compute also refuses invocations even if invocation capacity remains. The Console’s Usage page shows live consumption, warnings at 50%, 75%, 90% and 100%, and exceeded state; the pricing page lists the current plan values. ## FAQ **Where does my function code actually run?** In a managed Node.js 22 runtime, in an isolated environment per function, with no platform credentials and no access to other projects. Execution is regional. **Can a database event function block or roll back a write?** No — by design. Events are captured in the same transaction as your change but delivered only after commit, asynchronously. Use PostgreSQL constraints or native database triggers for rules that must block the write itself. **Can I use npm packages?** Imports are restricted to Node built-ins and a pinned allowlist (currently the official Stripe SDK). No build scripts run and no per-deploy npm install happens. The allowlist is versioned and will grow deliberately. **Is this globally distributed like edge functions?** No. Execution is regional, which is why the product is called Functions, not Edge Functions. **What happens when I hit a quota?** By default, new invocations are refused with a 402 until the cycle resets or you upgrade; async events retry with backoff and then dead-letter. Concurrency pressure returns 429 to HTTP callers. Nothing is silently over-billed — metered additional usage only applies when a paid organization explicitly enables it with a spending limit. ## Related - [Functions docs](https://cubibase.com/docs/functions) — The programming model, triggers and worked examples. - [Templates](https://cubibase.com/docs/functions/templates) — Eight starting points, including the Stripe webhook. - [Quotas and metering](https://cubibase.com/docs/functions/quotas) — What is counted and the current plan values. - [Storage](https://cubibase.com/features/storage) — The object events storage triggers consume. --- # A PostgreSQL backend your mobile app can call. Source: https://cubibase.com/solutions/mobile-apps Also available: [Markdown version](https://cubibase.com/solutions/mobile-apps.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase fits a mobile app that needs relational data, user accounts, and a REST API, without a separate backend service for every screen. The app calls https://{slug}.api.cubibase.com over HTTPS: /auth/v1 to sign users up and in, /rest/v1 for the data. ## At a glance - **Plain HTTPS** — Any client that can send HTTPS works. There is no CubiBase mobile SDK to install or keep up to date. - **A key that is safe to ship** — The publishable key identifies the project. On its own it does not return a single row. - **Accounts in the project** — Sign-up, sign-in, Google, and TOTP MFA on /auth/v1, with a refresh token that rotates on every use. - **Guests first** — Anonymous sign-ins let people try the app, then register without losing their user id or data. - **Rows per person** — Set a user column and each person reads and writes only their own rows. - **Photos and files** — Upload directly with a short-lived authorization and keep the file path in a relational row. ## A concrete shape Imagine a field inventory app. Products, stock counts, and tasks live in the project database. The iOS or Android client lists tasks with GET /rest/v1/tasks and writes a count with POST or PATCH. There is no CubiBase mobile SDK. The client uses its HTTP stack. - Put the publishable key in the client. It identifies the project and does not return rows alone. - Sign the person up or in through /auth/v1 and keep the refresh token in secure device storage. - Send the access JWT on every Data API call, and refresh it when it expires. - Store that person’s id in a text column, and set that column as the user column, if each person should only see their tasks. - Leave tables unexposed until the app is ready to call them. ## Let people in before they register Turn on anonymous sign-ins and the app can start a real session on first launch with POST /auth/v1/signup/anonymous. The user id is real, so rows the person creates under a user-column policy already belong to them. When they decide to register, PATCH /auth/v1/user with an email and password converts the account in place: same user id, same sessions, same data. Linking Google from the anonymous session does the same. ## What you still build CubiBase does not sync an offline store or send push notifications. If the app must work offline, that cache lives on the device. Photo and file uploads are covered by CubiBase Storage: the app uploads directly with a short-lived authorization and stores the object path in a relational row. The relational records and the files live in the same project. ## FAQ **Which mobile platforms are supported?** Any platform that can send HTTPS. CubiBase does not ship a native SDK, and it does not depend on a particular app store. **Can the app create the end user’s account inside CubiBase?** Yes. POST /auth/v1/signup on the project host creates the user and returns an access JWT and a refresh token. Sign-in, refresh, logout, and TOTP MFA are on the same host. If you already use an identity provider, the Pro and Business plans can verify its RS256 tokens instead. **Can the app use Google Sign-In it already has?** Yes. An app that already holds a Google ID token posts it to /auth/v1/token?grant_type=id_token, and CubiBase verifies it and returns a session. ## Related - [Authentication](https://cubibase.com/features/authentication) — The sign-up and session endpoints your client calls. - [REST API](https://cubibase.com/features/rest-api) — The request your app will send. - [Storage](https://cubibase.com/features/storage) — Direct uploads for photos and files. - [Quickstart](https://cubibase.com/docs/quickstart) — Create the project before you wire the client. --- # One PostgreSQL backend for the product you are shipping. Source: https://cubibase.com/solutions/saas Also available: [Markdown version](https://cubibase.com/solutions/saas.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) A small SaaS product can keep its accounts and relational data in one CubiBase project. Users sign up through CubiBase Auth; customers, plans, and the records they own live in the same database. The API role returns a row only when the user column matches the JWT subject, if you set that column up. ## At a glance - **Customer accounts** — Email and password, Google sign-in, and TOTP multi-factor for the people who use your product. - **Rows scoped by user** — With a user column, a row is visible and writable only when that column equals the JWT subject. - **Your own policies** — Write USING and WITH CHECK policies per command when one owner column is not enough. - **Explicit exposure** — Expose only the operations your product calls. A new table starts unexposed. - **Logic in SQL functions** — Put work that spans tables in a function and call it at POST /rest/v1/rpc/{name}. - **Code on events** — Functions run on HTTPS calls, committed row changes, storage events, or a schedule. ## Model the account on a column you control For a project tracker, a tasks table can carry owner_id as text. Set owner_id as the user column at create time. Ada signs up through /auth/v1/signup, and her access token’s subject is her user id. When her browser calls GET /rest/v1/tasks, the API role is limited to rows whose owner_id equals that subject. Your web app still renders the product. CubiBase answers the auth and data calls. Shared records need a column that matches every subject who should see them, or a policy you write yourself in the Policies screen. CubiBase’s generated policy is equality on one text column. It does not generate organization trees, role matrices, or billing entitlements. ## React to what your customers do A Function can run after a row is committed, for example to write an audit entry when a customer creates an order, or on a cron schedule for nightly cleanup. HTTPS functions receive webhooks with the raw body preserved, so you can verify Stripe or GitHub signatures. Templates for a Stripe webhook, sending email, and scheduled cleanup are included. A function failure never rolls back the customer’s transaction, and asynchronous triggers are delivered at least once, so deduplicate on the event id. ## A single product database Use one project for one product. If a second product must not see those tables, give it another project and another database. CubiBase does not split a project across regions, and it does not attach an uptime SLA to this setup. ## FAQ **Can each of my customers get a separate CubiBase database?** You can create a project per customer. That is a stronger boundary than a user column, and it is more projects to manage. For a typical multi-tenant SaaS app, one project database plus a user column is the model CubiBase generates today. **Does CubiBase bill my customers?** No. CubiBase bills you for your own CubiBase plan. It does not run subscription billing for your customers, though a Function can receive your payment provider’s webhooks. ## Related - [Authentication](https://cubibase.com/features/authentication) — Accounts and sessions for your customers. - [Security](https://cubibase.com/features/security) — How the user column policy is applied. - [Functions](https://cubibase.com/features/functions) — Code that runs on rows, files, and schedules. - [Agencies](https://cubibase.com/solutions/agencies) — When each client should be a separate project. --- # A separate backend for each client application. Source: https://cubibase.com/solutions/agencies Also available: [Markdown version](https://cubibase.com/solutions/agencies.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Agencies often repeat the same foundation: a database, a small API, and a way to look at the data when a client asks. CubiBase gives each client application its own project, database, and API host, under the same developer login. ## At a glance - **A project per client** — Each client app gets its own project, PostgreSQL database, and API host. - **Keys per project** — Rotate one client’s publishable key without touching any other client. - **Separate end users** — Each project has its own auth users, so one client’s customers never mix with another’s. - **Files and functions too** — Storage buckets and Functions belong to the project, alongside its tables. - **Answers from the Console** — The table editor and a read-only SQL editor for the day a client asks about their data. - **Only what the app calls** — Expose the operations each client app needs and leave the rest unexposed. ## Keep client data apart Create one project per client app. Each client gets its own slug, host, and database, and the Data API will not read another project’s tables from that host. That is a sharper boundary than a shared database with a client_id column. The Console lists the projects your developer account owns. CubiBase does not currently provide an invite API, so “the team” is not an automatic shared workspace. Plan account ownership with that limit in mind. ## Hand off a host, not a bespoke server Each app calls its own https://{slug}.api.cubibase.com/rest/v1/{table}. You can keep the schema work in the Console, expose only the operations that client needs, and rotate the publishable key without touching the other clients. ## FAQ **Can a client log in to the Console and edit their own tables?** Only if they have a CubiBase developer account that owns the project. There is no separate “client viewer” role in the current product, and there is no invite flow to add one. **Can I delete a client project when the engagement ends?** Yes. The project owner can delete a project from the Console. Confirm export and backup behavior before you promise a client a retention period. Those periods are not published. ## Related - [PostgreSQL](https://cubibase.com/features/postgresql) — Why a project is a database boundary. - [Product overview](https://cubibase.com/product) — How projects, the Console, and the Data API fit together. - [Contact](https://cubibase.com/contact) — Questions about running several projects. --- # CubiBase vs Supabase Source: https://cubibase.com/comparison/supabase Also available: [Markdown version](https://cubibase.com/comparison/supabase.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Looking for a Supabase alternative? CubiBase gives every project its own PostgreSQL database with authentication, storage, and functions, and more room at the same $25 entry price: a 10 GB database per project, additional projects at $9 per month, and a choice at every quota: stop there, or pay only for what you use beyond it, up to a spending limit you set. ## At a glance | | CubiBase | Supabase | | --- | --- | --- | | Database per project on Pro | 10 GB | 8 GB | | Each additional project | $9/mo | from $10/mo | | Five projects, per month | $61 | from $65 | | Free project pauses after | 14 idle days | 1 week | ## Compare: Plans and projects | Plans and projects | CubiBase (Pro) | Supabase | | --- | --- | --- | | Entry paid plan | Pro $25/mo | Pro from $25/mo | | Additional project | $9/mo, own 10 GB database | From $10/mo compute per project | | Usage beyond the plan | Your choice: stop at the quota, or pay per use up to a monthly limit you set | Spend cap on (hard stop) or off (overage billed) | | Free-plan inactivity | Pause after 14 idle days | Pause after 1 week | | Paid projects paused for inactivity | Never | Never | | Daily backups on the entry paid plan | Yes, kept 7 days | Yes, kept 7 days | ## Compare: Database and API | Database and API | CubiBase (Pro) | Supabase | | --- | --- | --- | | Included disk per project | 10 GB per project | 8 GB, then $0.125/GB | | Database | PostgreSQL, one per project | PostgreSQL, one per project | | REST API for tables | yes | yes | | Row-level security | yes | yes | | SQL functions callable over RPC | yes | yes | | Standard pg_dump export | yes | yes | ## Compare: Auth, storage, and functions | Auth, storage, and functions | CubiBase (Pro) | Supabase | | --- | --- | --- | | Monthly active users included | 100,000 MAU shared | 100,000 MAU, then $0.00325/MAU | | Database and storage event triggers | yes | Database webhooks | | File storage included | 100 GB shared | 100 GB | | Functions included | 25 per project · 2,000,000 invocations/mo | Edge Functions, 2M invocations | | MCP server and CLI | yes | yes | CubiBase columns show the Pro plan ($25/mo). Supabase figures were read from its public pricing page on November 24, 2026. CubiBase MAU, storage, and bandwidth are shared across the organization; database storage is per project. Check supabase.com/pricing for current values. ## More database per project. Cheaper projects after the first. At the same $25 entry price, CubiBase Pro includes a 10 GB PostgreSQL database per project against Supabase's 8 GB. Each additional project is $9 per month with its own 10 GB database, so five projects total $61 per month against $25 plus four compute add-ons from $10 each. At a quota you choose what happens. By default new operations stop with a clear error. Turn on additional usage and you pay only for what you consume beyond the plan, up to a monthly spending limit you pick in dollars. Pro projects are never paused and include daily backups kept 7 days. Source: [Supabase pricing](https://supabase.com/pricing) (read November 24, 2026). ## A real PostgreSQL database, with room to grow Your tables are ordinary PostgreSQL tables with row-level security forced, SQL functions callable at POST /rest/v1/rpc/{name}, and triggers, indexes, types, and views managed from the Console. New tables stay private until you expose select, insert, update, or delete. Every paid project gets 10 GB of database storage, 25% more than Supabase Pro includes before disk billing starts. ## Functions that react to rows, files, and schedules CubiBase Functions run TypeScript or JavaScript on four trigger types: HTTP, committed database changes, storage events, and cron schedules. Every trigger type is on every plan, including Free. Pro includes 25 functions per project and 2,000,000 invocations per month, with versioned deployments, encrypted secrets, and execution logs. ## Operable by AI agents out of the box CubiBase ships an MCP server, a CLI with JSON output, an agent skill file, and per-project OpenAPI generated from the live schema. An agent can propose a schema, expose tables, deploy a function, and read execution logs with a scoped personal access token. ## FAQ **What is a good Supabase alternative?** CubiBase: the same PostgreSQL-per-project model with auth, storage, and functions, at $25 per month with a 10 GB database per project, additional projects at $9 per month, daily backups, and optional pay-per-use beyond the plan, with a monthly spending limit you set. **Is CubiBase cheaper than Supabase for several projects?** Yes, at current published prices. CubiBase Pro is $25 per month with one project included and $9 per month for each additional project. Five projects cost $61, ten cost $106. Supabase Pro starts at $25 per month and adds from $10 per month per additional project, before usage overage. **Can I move my Supabase data to CubiBase?** Yes. Both platforms are PostgreSQL, so your tables map across directly. Recreate them in a CubiBase project from the Console, the CLI, or an AI agent over MCP, load the rows through the Data API, and point your app at the CubiBase REST and auth endpoints. **What happens when I reach a CubiBase quota?** You decide. By default the operation is refused with a clear error and your reset date, and the Console warns you at 50%, 75%, 90%, and 100% utilization; nothing is billed automatically and nothing is deleted. On Pro and Business you can enable additional usage instead: you pay only for what you consume beyond the quota, at published per-unit rates, up to a monthly spending limit you set. ## Related - [PostgreSQL databases](https://cubibase.com/features/postgresql) — What a dedicated database per project means on CubiBase. - [Plans and quotas](https://cubibase.com/pricing) — Every CubiBase quota side by side, Free to Business. - [Quickstart](https://cubibase.com/docs/quickstart) — Create a project, expose a table, call it over HTTPS. --- # CubiBase vs Firebase Source: https://cubibase.com/comparison/firebase Also available: [Markdown version](https://cubibase.com/comparison/firebase.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Looking for a Firebase alternative with a real relational database? CubiBase gives every project its own PostgreSQL database with tables, joins, SQL functions, and row-level security, called over a REST API. Pro is a flat $25 per month with a 10 GB database and 100,000 monthly active users, and reads and writes are included instead of billed per document. ## At a glance | | CubiBase | Firebase | | --- | --- | --- | | Database | PostgreSQL | Documents | | SQL, joins, aggregates | Included | Not available | | Reads and writes | In the plan | Per document | | Paid plan | $25/mo flat | Pay as you go | ## Compare: Data model | Data model | CubiBase (Pro) | Firebase | | --- | --- | --- | | Database | PostgreSQL, one per project | Firestore (documents) or Realtime Database (JSON tree) | | SQL, joins, and aggregates | yes | no | | Row-level security in the database | yes | Security rules at the request layer | | Standard export format | pg_dump .backup | Managed export to Cloud Storage | | REST API for tables | yes | Client SDKs and REST for documents | ## Compare: Pricing model | Pricing model | CubiBase (Pro) | Firebase | | --- | --- | --- | | Paid plan shape | Flat $25/mo (Pro) | Blaze: pay as you go, no flat plan | | Data operations billing | Included in the plan | Per document read, write, and delete | | Usage beyond the plan | Your choice: stop at the quota, or pay per use up to a monthly limit you set | Metered at Google Cloud rates | | Monthly active users included | 100,000 MAU shared | 50,000 with Identity Platform, then per-MAU rates | | Additional project | $9/mo, own database | Usage billed per project | ## Compare: Platform | Platform | CubiBase (Pro) | Firebase | | --- | --- | --- | | Bring your own IdP (RS256 / JWKS) | Included on paid plans | SAML/OIDC via Identity Platform, metered | | Email + password auth | yes | yes | | Functions | TypeScript / JavaScript, 4 trigger types | Cloud Functions | | Database and storage event triggers | yes | yes | | MCP server and CLI | yes | yes | CubiBase columns show the Pro plan ($25/mo). Firebase figures were read from its public pricing page on November 24, 2026. Firebase has no flat paid plan; Blaze bills each product at Google Cloud rates. Check firebase.google.com/pricing for current values. ## A plan you can predict. On Firebase Blaze, Firestore bills per document read, write, and delete plus stored data and egress. Cloud Functions bill per invocation and compute time. The bill follows how your screens query data, not only how many users you have. CubiBase Pro is $25 per month: one project with a 10 GB PostgreSQL database, plus 100,000 monthly active users, 100 GB of object storage, 500 GB of bandwidth, and 2,000,000 function invocations per month. Reads and writes are not metered one by one. At a quota, operations stop by default; turn on additional usage and you pay only for what you use beyond it, up to a monthly limit you set. Source: [Firebase pricing](https://firebase.google.com/pricing) (read November 24, 2026). ## Relational data belongs in PostgreSQL Orders, customers, inventory, and bookings join, aggregate, and carry constraints. In Firestore, a screen that lists fifty orders with their customers is fifty-plus billed document reads every time it loads. In CubiBase it is one REST call against ordinary PostgreSQL tables, included in the plan. You keep SQL. The Console manages tables, indexes, triggers, and views; SQL functions run at POST /rest/v1/rpc/{name}; and row-level security runs inside the database on every request path. ## One auth product, one token, one bill CubiBase Auth covers email and password, anonymous sign-ins that convert in place, Google sign-in, rotating refresh tokens, and TOTP multi-factor authentication, with users stored in your project database. The access JWT it issues is the token your Data API, Storage, and Functions calls send. On paid plans you can bring your own identity provider over RS256/JWKS, and users from your own IdP do not count against the MAU quota. ## Functions that react to rows and files CubiBase Functions run TypeScript or JavaScript on HTTP requests, committed database changes, storage events, and cron schedules, with signed webhook verification for Stripe and GitHub built in. Deployments are versioned, secrets are encrypted, and every execution is logged in the Console. ## FAQ **What is a good Firebase alternative?** For relational data, CubiBase: a PostgreSQL database per project with auth, storage, and functions, at a flat $25 per month on Pro with additional projects at $9 per month. You get SQL, joins, and row-level security in the database, and a bill that does not grow per document read. **Why is Firestore billing hard to predict?** Every document read, write, and delete is a billed operation, so cost follows how screens query data, not only how many users you have. A chatty screen or a missing index multiplies reads. CubiBase includes data operations in the flat plan price. Beyond the quota you choose: stop there, or pay per use up to a monthly spending limit you set. **Can I use PostgreSQL with Firebase?** Firebase offers Cloud SQL for PostgreSQL through SQL Connect, billed separately at Cloud SQL rates. It is a different product from Firestore, with its own bill. On CubiBase, PostgreSQL is the core of every project, included in the plan. **How do I move a Firebase app to CubiBase?** CubiBase serves plain HTTPS and JSON, so there is no client SDK to swap: you point data calls at /rest/v1 and auth calls at /auth/v1. Model your Firestore collections as PostgreSQL tables, transform the exported documents into rows, and the relational schema does the rest. ## Related - [PostgreSQL databases](https://cubibase.com/features/postgresql) — Ordinary tables, SQL, and policies in every project. - [Mobile apps](https://cubibase.com/solutions/mobile-apps) — Calling CubiBase over HTTPS from iOS and Android. - [Plans and quotas](https://cubibase.com/pricing) — What the flat monthly price includes. --- # CubiBase vs Convex Source: https://cubibase.com/comparison/convex Also available: [Markdown version](https://cubibase.com/comparison/convex.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Looking for a Convex alternative built on PostgreSQL? CubiBase gives every project a real PostgreSQL database with SQL, row-level security, and standard pg_dump backups, served over plain HTTPS that any client can call. Convex prices per developer; CubiBase Pro is $25 per month for the whole organization, with a 10 GB database per project. ## At a glance | | CubiBase | Convex | | --- | --- | --- | | Pricing unit | Organization | Developer seat | | Team of three, per month | $25 | $75 + usage | | Database | PostgreSQL | Proprietary | | Export | pg_dump .backup | Snapshot export | ## Compare: Pricing model | Pricing model | CubiBase (Pro) | Convex | | --- | --- | --- | | Paid plan shape | Flat $25/mo (Pro) | Professional $25 per developer/mo | | Pricing unit | Per organization, any team size | Per developer + metered usage | | Usage beyond the plan | Your choice: stop at the quota, or pay per use up to a monthly limit you set | Pay as you go | | Additional project | $9/mo, own database | Per deployment, usage billed | ## Compare: Data model | Data model | CubiBase (Pro) | Convex | | --- | --- | --- | | Database | PostgreSQL, one per project | Proprietary reactive database | | SQL, joins, and aggregates | yes | No SQL; TypeScript queries | | Plain REST API for tables | yes | Client libraries and HTTP API for functions | | Standard export format | pg_dump .backup | Snapshot export | | Row-level security in the database | yes | Authorization in function code | ## Compare: Platform | Platform | CubiBase (Pro) | Convex | | --- | --- | --- | | Auth | Email, Google, anonymous, TOTP, JWKS | Convex Auth and integrations | | File storage included | 100 GB shared | 100 GB on Professional | | Cron schedules | yes | yes | | Typed API surface | Per-project OpenAPI from the live schema | End-to-end TypeScript types | | MCP server and CLI | yes | yes | CubiBase columns show the Pro plan ($25/mo). Convex figures were read from its public pricing page on November 24, 2026. Check convex.dev/pricing for current values. ## Per organization, not per developer. Convex Professional is $25 per developer per month, so a three-person team starts at $75 before usage. Function calls beyond the included amount, action compute, storage, and egress meter on top. The bill grows with the team and with traffic. CubiBase Pro is $25 per month for the organization regardless of team size: one project with a 10 GB PostgreSQL database, additional projects at $9 per month, and 100,000 monthly active users and 100 GB of object storage shared across them. At a quota, operations stop by default; turn on additional usage and you pay only for what you use beyond it, up to a monthly limit you set. Source: [Convex pricing](https://www.convex.dev/pricing) (read November 24, 2026). ## A database you can take with you CubiBase is PostgreSQL underneath. Tables, constraints, indexes, and policies are ordinary PostgreSQL objects, and a project backup is a pg_dump .backup file that restores into any PostgreSQL server. Your data layer stays standard and portable, and any PostgreSQL developer can work on it. Paid plans include daily backups kept 7 days (14 on Business), and Pro projects are never paused for inactivity. ## Any HTTP client, no library required CubiBase serves /rest/v1/{table} with filters, ordering, and pagination as URL parameters, plus /auth/v1, /storage/v1, and /functions on the same project host. A mobile app, a server script, or curl works with no SDK to install or keep current. For typed workflows, each project generates an OpenAPI 3.1 document from its live schema, so types come from the database you actually have. ## Functions with database and storage triggers CubiBase Functions run TypeScript or JavaScript on HTTP requests, committed database changes, storage events, and cron schedules. A new row or a new file can trigger work directly, with at-least-once delivery, execution logs, and encrypted secrets on every plan. ## FAQ **What is a good Convex alternative?** CubiBase: PostgreSQL per project with auth, storage, and functions, served over plain HTTPS at $25 per month for the whole organization on Pro. You keep SQL and standard pg_dump backups, and the price does not grow per developer. **Is CubiBase cheaper than Convex?** For teams, yes, at current published prices. CubiBase Pro is $25 per month for the whole organization, while Convex Professional is $25 per developer per month plus metered usage, so three developers start at $75. **Can I move a Convex app to CubiBase?** Yes. Export your Convex data, design PostgreSQL tables for it, and replace typed function calls with REST calls to /rest/v1 and /auth/v1. The result is a standard relational schema any PostgreSQL tool or developer can work with. **Do I need a client SDK to use CubiBase?** No. Every endpoint is plain HTTPS and JSON with URL-parameter filters, so any HTTP client works. A typed TypeScript client and per-project OpenAPI are available when you want them. ## Related - [REST API](https://cubibase.com/features/rest-api) — The request shape any HTTP client can call. - [PostgreSQL databases](https://cubibase.com/features/postgresql) — Ordinary tables and standard backups. - [Calling functions (RPC)](https://cubibase.com/docs/data-api/rpc) — SQL functions with named JSON arguments. --- # CubiBase vs Appwrite Source: https://cubibase.com/comparison/appwrite Also available: [Markdown version](https://cubibase.com/comparison/appwrite.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Looking for an Appwrite alternative built around PostgreSQL? Every CubiBase project is a PostgreSQL database with auth, storage, and functions on one host, included in the plan. Pro is $25 per month with a 10 GB database per project and additional projects at $9 per month. Appwrite adds $15 per project and prices PostgreSQL separately. ## At a glance | | CubiBase | Appwrite | | --- | --- | --- | | Each additional project | $9/mo | $15/mo | | Ten projects, per month | $106 | $160 | | PostgreSQL | Included | From $10/mo extra | | Free project pauses after | 14 idle days | 1 week | ## Compare: Plans and projects | Plans and projects | CubiBase (Pro) | Appwrite | | --- | --- | --- | | Additional project | $9/mo, own 10 GB database | +$15/mo each | | Usage beyond the plan | Your choice: stop at the quota, or pay per use up to a monthly limit you set | Pay as you go (budget caps available) | | Free-plan inactivity | Pause after 14 idle days | Pause after 1 week | | Entry paid plan | Pro $25/mo | Pro from $25/mo | | Daily backups on the entry paid plan | Yes, kept 7 days | Yes, kept 7 days | ## Compare: Database | Database | CubiBase (Pro) | Appwrite | | --- | --- | --- | | Default database | PostgreSQL | TablesDB (Appwrite-managed) | | PostgreSQL | Every project, included | Dedicated option, from $10/mo per database | | SQL, joins, and aggregates | yes | In the PostgreSQL option | | Standard pg_dump export | yes | For PostgreSQL databases | | Included disk per project | 10 GB per project | Varies by database type | ## Compare: Platform | Platform | CubiBase (Pro) | Appwrite | | --- | --- | --- | | Row-level security in the database | yes | Permissions at the API layer | | Database and storage event triggers | yes | Event-driven functions | | MCP server and CLI | yes | yes | CubiBase columns show the Pro plan ($25/mo). Appwrite figures were read from its public pricing page on November 24, 2026. Check appwrite.io/pricing for current values. ## Additional projects at $9, not $15. Appwrite Pro starts at $25 per month for one project. Each additional project is $15 per month, and PostgreSQL is a dedicated database option priced from $10 per month per database on top of the default TablesDB. Ten projects cost $160 per month before usage, and PostgreSQL costs extra again. CubiBase Pro is $25 per month with one PostgreSQL project included, and each additional project is $9 per month with its own 10 GB database. Ten projects total $106 per month, PostgreSQL included in every one. At a quota, operations stop by default; turn on additional usage and you pay only for what you use beyond it, up to a monthly limit you set. Source: [Appwrite pricing](https://appwrite.io/pricing) (read November 24, 2026). ## PostgreSQL is the core of every project On CubiBase, PostgreSQL is the only datastore. Auth users, the file catalog, and function logs live in schemas of that same database. SQL joins, constraints, triggers, and row-level security are the normal way to model data. Every project includes 10 GB of database storage on paid plans, with daily backups kept 7 days on Pro and 14 days on Business. There is no separate database product to choose, size, or pay for. ## A project per client app Each CubiBase project has its own slug, database, API host, keys, users, files, and functions. An agency can run five client apps on one Pro organization at $61 per month, or ten at $106. On Appwrite Pro, ten projects cost $160 per month at current prices, before any PostgreSQL databases. ## Your data in the most portable format there is Every CubiBase project backup is a standard pg_dump .backup file. Download it from the Console and restore it on any PostgreSQL server you run. ## FAQ **What is a good Appwrite alternative?** For PostgreSQL-first apps, CubiBase: a dedicated PostgreSQL database per project with auth, storage, and functions, at $25 per month on Pro plus $9 per month for each additional project. PostgreSQL is included in every project, not a separate paid database type. **Is Appwrite built on PostgreSQL?** Not by default. Appwrite Cloud’s default database is TablesDB, its own managed store. PostgreSQL is one of the dedicated database types, priced from $10 per month per database. On CubiBase every project is a PostgreSQL database, included in the plan. **Which is cheaper for an agency with several client apps?** CubiBase, at current published prices. Ten projects cost $106 per month on CubiBase Pro ($25 + 9 × $9), each with its own 10 GB PostgreSQL database. On Appwrite Pro, ten projects cost $160 per month before usage, and PostgreSQL databases are priced separately. **Can I take my CubiBase data with me?** Yes. CubiBase is standard PostgreSQL: projects produce a pg_dump .backup file you can download and restore on any PostgreSQL server you run. ## Related - [Agencies](https://cubibase.com/solutions/agencies) — A project and database per client app. - [PostgreSQL databases](https://cubibase.com/features/postgresql) — One database per project, four least-privilege roles. - [Plans and quotas](https://cubibase.com/pricing) — Free, Pro, and Business side by side. --- # CubiBase documentation Source: https://cubibase.com/docs Also available: [Markdown version](https://cubibase.com/docs.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase gives every project a PostgreSQL database, end-user authentication, and a REST API for the tables you expose. These docs cover the engine as it works today. ## What is CubiBase? You create a project in the Console. CubiBase provisions a dedicated PostgreSQL database for it, and your application talks to that database over HTTPS — no server to run, no connection string to manage. - A database per project. Ordinary PostgreSQL tables, plus managed `auth`, `logs`, and `vault` schemas. - Auth for your users. Email + password, anonymous sign-ins, Google sign-in, and TOTP multi-factor, served at `/auth/v1`. - REST for exposed tables. `GET`, `POST`, `PATCH`, and `DELETE` at `/rest/v1/{table}`, with filters, sorting, and pagination. Granted functions are callable at `/rest/v1/rpc/{name}`. - S3-backed storage. Public and private buckets, direct uploads, signed links, and metered downloads at `/storage/v1`. - Functions. TypeScript and JavaScript at `/functions/{name}`, plus database, storage, and cron triggers in an isolated runtime. - A Console for you. Tables, rows, policies, SQL functions, triggers, indexes, types, views, a read-only SQL editor, functions, files, API keys, auth settings, and usage. > **note**: Client SDKs are not published yet. Every example in these docs is a plain HTTP request you can send with `fetch`, `curl`, or any HTTP client. ## Your first request Once a table is exposed, reading it is one request. The host selects the project, the `apikey` header identifies it, and the bearer token identifies the user. This example uses the fictional slug `example-project`. **Request** ```http GET https://example-project.api.cubibase.com/rest/v1/customers?plan=eq.pro&order=name.asc&limit=20 apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` **200 · response** ```json { "data": [ { "id": "8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901", "name": "Mina Cho", "email": "mina@example.com", "plan": "pro", "owner_id": "user_mina" }, { "id": "44ab91c3-0e55-4d72-b018-6f2c8a91bb70", "name": "Priya Shah", "email": "priya@example.org", "plan": "pro", "owner_id": "user_priya" } ] } ``` ## Pick your path - [Quickstart](https://cubibase.com/docs/quickstart) From an empty account to a first authenticated query in five steps. - [How CubiBase works](https://cubibase.com/docs/architecture) The two API surfaces, the project host, and what provisioning creates. - [Authentication](https://cubibase.com/docs/auth) Sign users up, manage sessions, and add Google or MFA. - [Data API](https://cubibase.com/docs/data-api) Query and write rows with filters, sorting, and row policies. - [Database objects](https://cubibase.com/docs/database/policies) Policies, functions, triggers, indexes, types, and views in the public schema. - [Storage](https://cubibase.com/docs/storage) S3-backed files: buckets, direct uploads, signed links, and quotas. - [Functions](https://cubibase.com/docs/functions) TypeScript/JavaScript on HTTP, database, storage, and cron triggers. ## What is documented here These pages describe the engine that exists today: the Data API, CubiBase Auth, the Console tools, and the platform rules for quotas and inactivity. A full control-API reference and client libraries are not published yet — if a command is not in these docs, it is not a supported public interface. ## Additional resources - [Quickstart](https://cubibase.com/docs/quickstart) Create a project, expose a table, call it. - [Feature overview](https://cubibase.com/features) What a project includes, in product terms. - [FAQ](https://cubibase.com/faq) Short answers to common questions. --- # Quickstart Source: https://cubibase.com/docs/quickstart Also available: [Markdown version](https://cubibase.com/docs/quickstart.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Create a project, define a table, expose the operations you want, sign up a user, and call the Data API. About ten minutes, all HTTP. ## 1 · Create a project 1. **Register in the Console** — Create a developer account and verify your email address. Project creation requires a verified email. 2. **Create a project** — Pick a name and a slug. The slug becomes the first label of your API host: `{slug}.api.cubibase.com`. 3. **Wait for provisioning** — Provisioning is queued. The project page shows the status; wait until it reports active before creating tables. **Provisioning state change, illustration.** Project example-project Provisioning → Active. - Database example_project_db - Roles ddl · api · sql · auth - Schemas public · auth · vault · logs Illustration of the state change. Creating a project queues the database; it exists when provisioning finishes. > **important**: The database exists when provisioning finishes, not when you type the project name. Calls to a project that is not active return `404 project_not_found`. ## 2 · Define a table In the Console, open your project and create a table. This guide uses a `customers` table: **customers — example schema** | Column | Type | Notes | | --- | --- | --- | | `id` | `uuid` | Primary key, default `gen_random_uuid()` | | `name` | `text` | Required | | `email` | `text` | Required | | `plan` | `text` | Required | | `owner_id` | `text` | Set as the user column for row-level security | Setting `owner_id` as the user column at creation time makes every row belong to the user whose JWT subject matches it. The policy is created with the table — you cannot attach it later. > **tip**: Skip the user column only for tables every signed-in user may read and write, such as a shared product catalog. ## 3 · Expose the operations you want New tables are not exposed. On the table screen, switch on the operations your app needs — here, `select` and `insert`. Leave `update` and `delete` off until you need them. **customers · exposure illustration.** Operation switches: select (GET) on, insert (POST) on, update (PATCH) off, delete (DELETE) off. Served at /rest/v1/customers for the operations you switched on. With everything off: The Data API treats this table as not found. Nothing is exposed. Illustration. Toggles here do not change any real table. ## 4 · Sign up your first user Copy the publishable key from the project’s API keys screen, then sign a user up. The response contains the `accessToken` your Data API calls need. **Sign up · request** ```http POST https://example-project.api.cubibase.com/auth/v1/signup apikey: cb_pub_EXAMPLE_ONLY Content-Type: application/json { "email": "mina@example.com", "password": "" } ``` > **note**: Email autoconfirm is on by default: the user is verified immediately and CubiBase does not send a confirmation email yet. ## 5 · Call the Data API Send the publishable key in the `apikey` header and the user’s access token as the bearer token. With the `owner_id` policy in place, this user only sees their own rows. **Request** ```http GET https://example-project.api.cubibase.com/rest/v1/customers?plan=eq.pro&order=name.asc&limit=20 apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` **200 · response** ```json { "data": [ { "id": "8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901", "name": "Mina Cho", "email": "mina@example.com", "plan": "pro", "owner_id": "user_mina" }, { "id": "44ab91c3-0e55-4d72-b018-6f2c8a91bb70", "name": "Priya Shah", "email": "priya@example.org", "plan": "pro", "owner_id": "user_priya" } ] } ``` > **tip**: Rows you insert should carry the user’s id in `owner_id`. The policy checks reads and writes: a row with someone else’s id is rejected with `403 forbidden`. ## Additional resources - [Querying rows](https://cubibase.com/docs/data-api/querying) Filters, column selection, sorting, and pagination. - [Sessions and tokens](https://cubibase.com/docs/auth/sessions) Refresh the session before the access token expires. - [Row-level security](https://cubibase.com/docs/database/row-level-security) How the user column becomes a PostgreSQL policy. --- # How CubiBase works Source: https://cubibase.com/docs/architecture Also available: [Markdown version](https://cubibase.com/docs/architecture.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Two HTTP surfaces, one database per project. The Console manages the project through the control API; your application calls the project host. ## The two surfaces **How a request reaches the project database, illustration.** Developer → Console (tables · rows · SQL · keys) → Control plane / Control API (projects · schema · auth settings). Application → Your app (apikey + user JWT) → Project host (example-project.api.cubibase.com: /rest/v1 · /auth/v1 · /storage/v1 · /functions) → One project database, example_project_db (public · auth · storage · logs). Illustration. The Console manages the project; your app calls the project host. | Surface | Who calls it | What it does | | --- | --- | --- | | Control API | The Console (your developer session) | Accounts, projects, tables, rows, SQL, API keys, auth settings, usage | | Data API · `/rest/v1` | Your application | Reads and writes on the tables you expose | | Auth API · `/auth/v1` | Your application | Sign-up, sign-in, sessions, Google, MFA | > **important**: Your application should only call the project host. The control API paths the Console uses are not a public application interface. ## The project host Every project gets a host of the form `https://{slug}.api.cubibase.com`. The engine resolves the project from the trusted `Host` header — it never consults `X-Forwarded-Host` — and validates the publishable key against that project. **Example project** | Piece | Value | | --- | --- | | Slug | `example-project` | | API host | `https://example-project.api.cubibase.com` | | Database | `example_project_db` | | Data API base | `/rest/v1` | | Auth API base | `/auth/v1` | ## What provisioning creates Provisioning creates one PostgreSQL database and four login roles, all `NOSUPERUSER` and `NOBYPASSRLS`: | Role | Used by | Purpose | | --- | --- | --- | | `ddl` | Schema API | Creates and alters tables | | `api` | Data API | Serves exposed tables, limited by grants and row policies | | `sql` | Console | Row browser and the read-only SQL editor | | `auth` | Auth API | Sign-up, sign-in, and sessions against the `auth` schema | Alongside `public`, where your tables live, the database has managed schemas: `auth` (users, sessions, factors, identities), `logs` (request and auth events), `vault` (project secrets no request role can read), and `storage` (the bucket and object catalog, upload sessions, and object events for S3-backed file storage). Developer accounts live separately, in the platform metadata database. ## How a request is authorized 1. The `Host` header selects the project; the `apikey` header must be an active publishable key for it. 2. The bearer JWT is verified (HS256 for CubiBase Auth, or RS256 against your IdP’s JWKS). Its `sub` claim is the user id. 3. For session-bearing tokens, the engine checks the session is still live and the user is not banned. 4. The query runs as the API role with `cubibase.user_id` set to that subject, so row policies apply to every statement. ## Additional resources - [API keys](https://cubibase.com/docs/platform/api-keys) Publishable keys, secret keys, and rotation. - [Row-level security](https://cubibase.com/docs/database/row-level-security) The policy that turns a JWT subject into row access. - [PostgreSQL feature page](https://cubibase.com/features/postgresql) The product view of database isolation. --- # Tables and columns Source: https://cubibase.com/docs/database/tables Also available: [Markdown version](https://cubibase.com/docs/database/tables.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Create tables from the Console. Every table is an ordinary PostgreSQL table in the public schema, with Row Level Security enabled from the start. ## The rules a table follows - Names are lowercase: a letter first, then letters, digits, and underscores (up to 41 characters). - Exactly one primary key column, chosen at creation. You cannot add or drop a primary key later. - Up to 64 columns per table. - Columns can be added and dropped later — except the primary key and the user column used for row policies. > **important**: Decide the user column when you create the table: the ownership policy is created with it. To protect an existing table another way, write your own policy on the Policies screen. ## Column types | Type | PostgreSQL type | Typical use | | --- | --- | --- | | `uuid` | `uuid` | Primary keys, references to user ids | | `text` | `text` | Names, emails, the user column | | `integer` | `integer` | Counters, small numbers | | `bigint` | `bigint` | Large counters, external ids | | `boolean` | `boolean` | Flags | | `timestamptz` | `timestamptz` | Timestamps with time zone | | `jsonb` | `jsonb` | Flexible structured data | | `numeric` | `numeric` | Exact decimals, money | | `double` | `double precision` | Floating-point measurements | Columns are `NOT NULL` by default; mark a column nullable when it may be empty. Available defaults are `gen_random_uuid()`, `now()`, `true`, and `false`. ## A worked example The `customers` table used throughout these docs: **customers** | Column | Type | Constraints | | --- | --- | --- | | `id` | `uuid` | Primary key · default `gen_random_uuid()` | | `name` | `text` | Not null | | `email` | `text` | Not null | | `plan` | `text` | Not null | | `owner_id` | `text` | Not null · user column | With `owner_id` set as the user column, the API role can only read and write rows whose `owner_id` equals the JWT subject of the caller. The Console keeps full access through a separate developer policy. ## Changing a table later | Change | Supported? | How | | --- | --- | --- | | Add a column | Yes | Table screen → add column (not as a primary key) | | Drop a column | Yes | Except the primary key and the user column | | Add a primary key | No | Create the table with the right key | | Attach a user column | No | Recreate the table, or write an equivalent policy on the Policies screen | | Run DDL in the SQL editor | No | The editor is read-only; use the table screen | > **note**: A new table starts unexposed: the Data API treats it as not found until you turn on at least one operation. ## Additional resources - [Exposing tables](https://cubibase.com/docs/database/exposure) Turn on the operations your app needs. - [Row-level security](https://cubibase.com/docs/database/row-level-security) What the user column actually creates. - [Writing rows](https://cubibase.com/docs/data-api/writing) Insert, update, and delete over HTTP. --- # Exposing tables Source: https://cubibase.com/docs/database/exposure Also available: [Markdown version](https://cubibase.com/docs/database/exposure.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) A table is private until you expose it. Select, insert, update, and delete are separate switches, and each one maps to a real PostgreSQL grant. ## One switch per operation **customers · exposure illustration.** Operation switches: select (GET) on, insert (POST) on, update (PATCH) off, delete (DELETE) off. Served at /rest/v1/customers for the operations you switched on. With everything off: The Data API treats this table as not found. Nothing is exposed. Illustration. Toggles here do not change any real table. | Switch | HTTP | PostgreSQL grant to the API role | | --- | --- | --- | | `select` | `GET /rest/v1/{table}` | `GRANT SELECT` | | `insert` | `POST /rest/v1/{table}` | `GRANT INSERT` | | `update` | `PATCH /rest/v1/{table}/{id}` | `GRANT UPDATE` | | `delete` | `DELETE /rest/v1/{table}/{id}` | `GRANT DELETE` | Turning a switch off revokes the grant immediately. A request for an operation that is not exposed returns `405 method_not_allowed`. ## Choosing what to expose - Start with `select` only, and add write operations when a screen needs them. - A shared catalog might expose `select` to everyone; a per-user table pairs writes with a user column. - Exposure is not authorization by itself: every request still needs a publishable key and an end-user JWT. - The Console row browser is unaffected — it uses the SQL role, not the API role. > **warning**: Exposing a table without a user column means every signed-in user can use the exposed operations on every row. Add the policy unless the data is meant to be shared. ## Additional resources - [Row-level security](https://cubibase.com/docs/database/row-level-security) Limit rows per user, not just operations per table. - [Data API overview](https://cubibase.com/docs/data-api) The request shape behind every switch. --- # Row-level security Source: https://cubibase.com/docs/database/row-level-security Also available: [Markdown version](https://cubibase.com/docs/database/row-level-security.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Set a user column when you create a table and CubiBase writes the PostgreSQL policy for you: a row belongs to the user whose id it carries. ## The model Every table created through CubiBase has Row Level Security enabled and forced. Two policies exist from the start, and the Policies screen lets you add, edit, or drop your own: | Policy | Role | Effect | | --- | --- | --- | | Developer policy | `sql` (Console) | Full access, so you can manage every row | | Isolation policy | `api` (Data API) | Only rows where the user column equals the caller’s id | The user column must be a `text` column on the new table — `owner_id` in these docs. Its value is compared to the verified JWT subject, which the engine sets as `cubibase.user_id` for the transaction. ## The policy CubiBase creates For a table `customers` with user column `owner_id`, the isolation policy is equivalent to: **SQL · created for you** ```sql CREATE POLICY customers_api_isolation ON public.customers FOR ALL TO example_project_db_api USING (owner_id = cubibase.current_user_id()) WITH CHECK (owner_id = cubibase.current_user_id()); ``` - `USING` limits which rows the user can read, update, or delete. - `WITH CHECK` limits which rows the user can insert or update into: writing someone else’s id fails with `403 forbidden`. - The check runs inside PostgreSQL, not in application code you have to remember. ## From JWT to rows 1. The user signs in; the access token’s `sub` claim is their user id. 2. Your app sends the token as `Authorization: Bearer …` on a Data API call. 3. The engine verifies the token and sets `cubibase.user_id` for that transaction. 4. PostgreSQL applies the policy: the query only sees rows where `owner_id` matches. > **tip**: Insert rows with the user’s id in the user column. A common pattern is to read the id from the signup response (or the token’s `sub`) and set it on every write. ## What the policy does not do - It is per-row ownership, not roles or teams. For richer rules — statuses, teams, published rows — write your own policies on the Policies screen. - The user-column flag itself only exists at creation; an existing table can get an equivalent rule as a hand-written policy. - It does not replace exposure switches: an unexposed operation is refused before any row is touched. - Anonymous users work exactly like registered users — their id is real, so their rows are theirs. ## Additional resources - [Policies](https://cubibase.com/docs/database/policies) Write your own USING and WITH CHECK rules. - [Tables and columns](https://cubibase.com/docs/database/tables) Where the user column is chosen. - [Anonymous users](https://cubibase.com/docs/auth/anonymous) Visitors get real ids, so their rows are protected too. - [Security overview](https://cubibase.com/features/security) Keys, tokens, roles, and policies together. --- # Policies Source: https://cubibase.com/docs/database/policies Also available: [Markdown version](https://cubibase.com/docs/database/policies.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) The Policies screen manages Row Level Security on your tables: turn RLS on or off per table, and write your own PostgreSQL policies with USING and WITH CHECK expressions. ## How policies fit the role model Every project has two query roles. The `api` role serves Data API requests and is subject to your policies. The `sql` role serves the Console (row browser, SQL editor) and normally has a permissive developer policy so you can manage every row. | Target role | Who uses it | Typical policy | | --- | --- | --- | | `api` | Your application’s end users (Data API) | Restrict rows per user, per team, or per status | | `sql` | You, in the Console | Full access for administration | Tables created with a user column already carry an isolation policy for the `api` role. The Policies screen lists those policies alongside any you add, and lets you edit or drop them. ## Enabling and disabling RLS - Each table row shows whether RLS is enabled and forced. - Disabling RLS makes every grant effective for every row — the policies stay stored but stop being applied. - FORCE RLS applies policies even to the table owner. CubiBase enables it with RLS so nothing slips past by ownership. > **warning**: Turning RLS off on an exposed table removes row restrictions for every signed-in user. Keep it on unless the whole table is meant to be shared. ## Writing a policy | Field | Meaning | | --- | --- | | Command | `ALL`, `SELECT`, `INSERT`, `UPDATE`, or `DELETE` — which statements the policy governs | | `USING` | Which existing rows are visible for SELECT, UPDATE, DELETE | | `WITH CHECK` | Which new or updated rows are allowed for INSERT, UPDATE | | Permissive | Permissive policies combine with OR; restrictive policies combine with AND | | Roles | `api`, `sql`, or both | Expressions are ordinary PostgreSQL boolean expressions. Reference the signed-in user with `cubibase.current_user_id()`, which returns the verified JWT subject for the request: **Example · published notes are readable by everyone** ```text -- Command: SELECT · Role: api · USING: status = 'published' OR owner_id = cubibase.current_user_id() ``` **Example · users may only write their own rows** ```text -- Command: INSERT · Role: api · WITH CHECK: owner_id = cubibase.current_user_id() ``` - INSERT policies accept only WITH CHECK; SELECT and DELETE accept only USING. - For ALL and UPDATE, omitting WITH CHECK reuses the USING expression as the write check. - Expressions must be a single expression — stacked statements are rejected with `400 validation_error`. - Bare column names are checked against the table, so a typo fails fast instead of at query time. ## Editing and dropping - Editing expressions or roles uses ALTER POLICY in place. - Changing the command or the permissive flag recreates the policy inside one transaction, so the table is never left unprotected mid-change. - Dropping a policy takes effect immediately for new requests. > **tip**: Test a policy from your app with a real end-user token. The Console row browser uses the sql role, so it will not show you what the api role sees. ## Additional resources - [Row-level security](https://cubibase.com/docs/database/row-level-security) The user-column policy created with each table. - [Exposing tables](https://cubibase.com/docs/database/exposure) Grants decide the operation; policies decide the rows. - [Views](https://cubibase.com/docs/database/views) Another way to shape what the API can read. --- # SQL Functions Source: https://cubibase.com/docs/database/functions Also available: [Markdown version](https://cubibase.com/docs/database/functions.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Create, edit, and replace SQL or PL/pgSQL functions in the public schema from the Console. Functions power triggers, encapsulate queries, and can be granted to the Data API role. These are PostgreSQL functions — for TypeScript/JavaScript code in the managed runtime, see the CubiBase Functions docs. ## Creating a function The editor takes a name, an argument list, a return type, and a body. Bodies can contain multiple statements — unlike the SQL editor, a function body is a program, not a single query. | Option | Values | Notes | | --- | --- | --- | | Language | `sql`, `plpgsql` | SQL for single queries; PL/pgSQL for logic and loops | | Volatility | `VOLATILE`, `STABLE`, `IMMUTABLE` | Tell the planner how the function behaves | | Security | `INVOKER`, `DEFINER` | DEFINER runs with the function owner’s rights | | Strict | on / off | STRICT returns NULL immediately when any argument is NULL | | Returns set | on / off | `SETOF` for functions that return multiple rows | | Replace | on / off | `CREATE OR REPLACE` keeps existing grants | **Example · PL/pgSQL** ```sql CREATE FUNCTION public.customer_count(plan_name text) RETURNS bigint LANGUAGE plpgsql STABLE SECURITY INVOKER SET search_path = public, pg_catalog AS $$ BEGIN RETURN (SELECT count(*) FROM public.customers WHERE plan = plan_name); END; $$; ``` Every function is created with `SET search_path = public, pg_catalog`, so name resolution cannot be hijacked by objects in other schemas — important for SECURITY DEFINER functions. ## Overloads and dropping - PostgreSQL identifies a function by name plus argument types. Two functions named `search` with different argument types can coexist. - When you drop (or toggle API access on) an overloaded name, the Console asks which signature you mean — pass the argument types, e.g. `id uuid` vs `term text`. - Replacing a function keeps its grants; dropping it removes them. ## Editing a function Every function you created has an Edit button. It opens the same form prefilled with the current definition and saves with `CREATE OR REPLACE`, so existing grants and dependent triggers or views keep working. - Editable: the body, argument defaults, volatility, security (INVOKER/DEFINER), STRICT, and the Data API grant. - Fixed: the name, argument names/types/modes, return type, and language — PostgreSQL identifies a function by that signature and cannot change it in place. To change the signature, create a new function and drop the old one. - Replacing keeps EXECUTE grants; dropping removes them. > **note**: Extension functions cannot be edited — see below. Only functions you created are editable. ## Extension functions are read-only Enabling an extension (Database → Extensions, e.g. `pgcrypto` or `pg_trgm`) installs its functions into the public schema. Those functions belong to the extension, not to you: - Hidden by default: the Functions screen lists only your own functions. Tick “Show extension functions” to see the rest, marked with an `extension: pgcrypto` badge. - Read-only: they cannot be edited, replaced, or dropped — the API refuses with `403 extension_function`. PostgreSQL itself also refuses to drop a function an extension depends on. - They leave only with their extension: disable it on the Extensions screen and its functions disappear together. - You can still grant or revoke Data API EXECUTE on them — that is how you expose e.g. `gen_random_uuid()` over RPC without writing a wrapper. > **note**: The lock survives backups: restoring a project hands your objects back to your project role but never extension members, so a restored database cannot be used to rewrite extension internals. ## Data API execute permission Functions are private by default: the Console’s `sql` role can run them, the `api` role cannot. The Data API execute switch maps to a real grant: **SQL · what the switch runs** ```sql GRANT EXECUTE ON FUNCTION public.customer_count(text) TO example_project_db_api; -- off: REVOKE EXECUTE ON FUNCTION public.customer_count(text) FROM example_project_db_api; ``` With the grant on, the function is callable from your app at `POST /rest/v1/rpc/{name}` on the project host, with the publishable key and the end-user JWT. The body is a JSON object of named arguments; the call runs with the caller’s identity, so RLS applies to SECURITY INVOKER functions. **RPC · request** ```http POST https://example-project.api.cubibase.com/rest/v1/rpc/customer_count apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json { "plan_name": "pro" } ``` > **note**: The grant covers the function itself. Tables the body reads still need their own grants for the api role — expose them in the Console, or the call fails with 403. See Calling functions (RPC) for result shapes, overloads, and errors. ## SECURITY DEFINER, carefully - A DEFINER function runs with its owner’s privileges, so it can bypass the caller’s RLS policies. That is the point — and the risk. - Grant EXECUTE to the api role only when the function is meant to expose that capability. - Validate arguments inside the function; a DEFINER function is a door through your policies. > **warning**: A SECURITY DEFINER function granted to the api role can read or write rows the caller’s policies would block. Review the body before enabling Data API execute. ## Additional resources - [Calling functions (RPC)](https://cubibase.com/docs/data-api/rpc) Call a granted function from your app over the Data API. - [Triggers](https://cubibase.com/docs/database/triggers) Run a function automatically on INSERT, UPDATE, DELETE, or TRUNCATE. - [Types](https://cubibase.com/docs/database/types) Enums and composites for arguments and return values. - [SQL editor](https://cubibase.com/docs/database/sql-editor) Call your function with SELECT to test it. - [CubiBase Functions](https://cubibase.com/docs/functions) TypeScript/JavaScript in the managed runtime — a different feature. --- # Triggers Source: https://cubibase.com/docs/database/triggers Also available: [Markdown version](https://cubibase.com/docs/database/triggers.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Execute a function automatically when rows change. Triggers fire on INSERT, UPDATE, DELETE, or TRUNCATE, before or after the event, per row or per statement. ## The shape of a trigger | Choice | Values | Notes | | --- | --- | --- | | Timing | `BEFORE`, `AFTER` | BEFORE can modify the row being written; AFTER sees the final state | | Events | `INSERT`, `UPDATE`, `DELETE`, `TRUNCATE` | Combine several events in one trigger | | Level | `ROW`, `STATEMENT` | ROW fires per affected row; STATEMENT once per query | | Update of | column list | Fire only when specific columns are updated | | WHEN | boolean expression | A row-level condition, e.g. `NEW.plan <> OLD.plan` | | Function | a public trigger function | Must return `trigger` | - TRUNCATE triggers must be FOR EACH STATEMENT — there are no rows to iterate. - WHEN conditions require FOR EACH ROW. - INSTEAD OF triggers apply to views and are not offered on tables. ## The trigger function A trigger calls a function that returns `trigger`. Create it on the Functions screen (there is a trigger template), then pick it here. Inside the body, `NEW` is the row being written and `OLD` the row being replaced or removed. **Example · stamp updated_at on every update** ```sql CREATE FUNCTION public.set_updated_at() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN NEW.updated_at := now(); RETURN NEW; END; $$; ``` **SQL · what the Console creates** ```sql CREATE TRIGGER customers_set_updated_at BEFORE UPDATE ON public.customers FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); ``` > **tip**: A BEFORE INSERT trigger can fill server-side fields — return NEW with the fields set and every writer gets them, including the Data API. ## Enabling, disabling, dropping - The Triggers screen groups triggers by table and shows timing, events, level, function, and enabled state. - Disabling a trigger keeps its definition but stops it firing — useful while backfilling data. - Dropping the trigger does not drop the function; other triggers may still use it. - Triggers run inside the writing transaction: if the function raises, the whole write is rolled back. > **warning**: Trigger functions run with the privileges of the writing role and are not stopped by RLS on other tables they touch. Keep trigger bodies small and reviewed. ## Additional resources - [Functions](https://cubibase.com/docs/database/functions) Where trigger functions are written and replaced. - [Tables and columns](https://cubibase.com/docs/database/tables) The tables triggers attach to. - [Writing rows](https://cubibase.com/docs/data-api/writing) The writes that fire your triggers. --- # Indexes Source: https://cubibase.com/docs/database/indexes Also available: [Markdown version](https://cubibase.com/docs/database/indexes.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Speed up the queries your app actually runs. Create btree, hash, GIN, GiST, SP-GiST, and BRIN indexes on public tables — single-column, composite, expression, or partial. ## Choosing a method | Method | Good for | | --- | --- | | `btree` | Equality and range queries, sorting — the default and the only unique-capable method | | `hash` | Equality-only lookups | | `gin` | jsonb containment, arrays, full-text search | | `gist` | Geometry, ranges, nearest-neighbour search | | `spgist` | Partitioned data like points and text prefixes | | `brin` | Very large tables whose physical order matches the column (e.g. timestamps) | The Indexes screen lists every index in the public schema with its method, columns or expression, uniqueness, and size on disk. ## Composite, expression, and partial indexes - Composite: pick up to 16 columns, each with ASC/DESC and optional NULLS FIRST/LAST. Column order matters — put the most-filtered column first. - Expression: index a computed value, e.g. `lower(email)`, when your queries filter on that expression. - Partial: add a WHERE filter, e.g. `status = 'active'`, to index only the rows you query. - Unique: btree only; enforces uniqueness like a constraint. **Examples · what the Console creates** ```sql CREATE INDEX customers_plan_name ON public.customers (plan, name); CREATE INDEX customers_email_lower ON public.customers (lower(email)); CREATE INDEX customers_active ON public.customers (owner_id) WHERE status = 'active'; CREATE UNIQUE INDEX customers_email_unique ON public.customers (email); ``` > **note**: Index creation on a large table takes a lock while it builds. Create indexes before the table grows, or during a quiet period. ## Constraint-backed indexes are protected - Primary keys and unique constraints own their indexes. The screen marks them and refuses to drop them — dropping the index would drop the constraint’s enforcement. - Ordinary indexes can be dropped at any time; queries fall back to sequential scans. - Every index costs write speed and storage. Watch the size column and drop indexes your queries no longer use. ## Additional resources - [Querying rows](https://cubibase.com/docs/data-api/querying) The filters and sorts your indexes should serve. - [SQL editor](https://cubibase.com/docs/database/sql-editor) Run EXPLAIN to confirm the planner uses your index. - [Tables and columns](https://cubibase.com/docs/database/tables) Where the primary key index comes from. --- # Types Source: https://cubibase.com/docs/database/types Also available: [Markdown version](https://cubibase.com/docs/database/types.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Define custom enum and composite types in the public schema. Enums give a column a fixed vocabulary; composites bundle fields into one value for functions and PL/pgSQL. ## Enum types An enum is an ordered list of labels. Create one with up to 256 labels, then use it as a column type in the SQL your functions and views run, or as a function argument or return type. **Example · what the Console creates** ```sql CREATE TYPE public.customer_plan AS ENUM ('free', 'pro', 'business'); ``` | Change | Supported? | How | | --- | --- | --- | | Add a label | Yes | At the end, or BEFORE/AFTER an existing label | | Rename a label | Yes | Existing rows keep their value; the label text changes | | Remove a label | No | PostgreSQL cannot drop enum values; recreate the type | | Reorder labels | Only via add position | Use BEFORE/AFTER when adding | > **tip**: Enum order is real: ORDER BY on an enum column sorts by label position, not alphabetically. Add labels in the order you want them sorted. ## Composite types A composite is a named row shape — up to 64 attributes, each with a name and a type. Composites are useful as function return types (especially SETOF) and inside PL/pgSQL. **Example · what the Console creates** ```sql CREATE TYPE public.plan_summary AS (plan text, customers bigint); CREATE FUNCTION public.plan_counts() RETURNS SETOF public.plan_summary LANGUAGE sql STABLE AS $$ SELECT plan, count(*) FROM public.customers GROUP BY plan; $$; ``` ## Rules and limits - Names follow the same rule as tables: a lowercase letter first, then letters, digits, and underscores. - Attribute and argument types can be built-ins (`text`, `numeric(10,2)`, `timestamptz`), arrays (`text[]`), or your own public types (`public.customer_plan`). - Types referenced by columns, functions, or views cannot be dropped until those dependents are removed — the error is `409 object_in_use`. - Platform schemas are off limits: you cannot create types in, or reference types from, auth, vault, logs, or cubibase. ## Additional resources - [Functions](https://cubibase.com/docs/database/functions) Where custom types are most useful. - [Tables and columns](https://cubibase.com/docs/database/tables) The built-in column types. - [Views](https://cubibase.com/docs/database/views) Queries that can return your types. --- # Views Source: https://cubibase.com/docs/database/views Also available: [Markdown version](https://cubibase.com/docs/database/views.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Save a SELECT as a view, or cache it as a materialized view. Views shape what readers see — joins, aggregates, renamed columns — without copying data. ## Creating a view A view is one SELECT (or WITH … SELECT) query stored under a name. Querying the view runs the query against live data. The editor accepts a single statement up to 16,000 characters. **Example · what the Console creates** ```sql CREATE VIEW public.active_customers AS SELECT id, name, plan FROM public.customers WHERE status = 'active'; ``` - Standard views can be replaced in place (CREATE OR REPLACE) as long as column names and types stay compatible. - Views over RLS-protected tables respect the querying role’s policies: the api role sees only the rows its policies allow. - The Console lists each view with its definition and columns. ## Materialized views A materialized view runs the query once and stores the result. Reads are fast and constant; the data is a snapshot until you refresh. CubiBase creates them WITH DATA, so they are usable immediately. | | View | Materialized view | | --- | --- | --- | | Data freshness | Always live | As of the last refresh | | Read cost | Runs the query each time | Reads stored rows | | Replace in place | Yes | No — drop and recreate | | Refresh button | — | Yes: REFRESH MATERIALIZED VIEW | > **note**: Refresh is manual in this release — press Refresh on the view (or call the control route) when you want new numbers. A refresh rebuilds the whole snapshot. ## The Data API select switch Like tables, views start private. The Data API select switch grants SELECT on the view to the `api` role, so queries executed as that role — inside functions or other views — can read it. Turning the switch off revokes the grant immediately. > **note**: The Data API serves tables at /rest/v1 in this release; views are not yet addressable as REST resources. Read a view from the SQL editor, or wrap it in a function. > **warning**: A view can aggregate or join across rows a caller could not read directly. Grant select only when the combined result is meant to be visible, or add a WHERE on cubibase.current_user_id() inside the view. ## Additional resources - [SQL editor](https://cubibase.com/docs/database/sql-editor) Read your views with a SELECT. - [Policies](https://cubibase.com/docs/database/policies) Row rules that views inherit from their tables. - [Indexes](https://cubibase.com/docs/database/indexes) Speed up the queries inside your views. --- # SQL editor Source: https://cubibase.com/docs/database/sql-editor Also available: [Markdown version](https://cubibase.com/docs/database/sql-editor.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Inspect your database with one read-only SQL statement at a time. The editor is for reading; schema changes go through the Database screens — tables, policies, functions, triggers, indexes, types, and views. ## The limits | Rule | Value | | --- | --- | | Statements per run | Exactly one | | Length | At most 8,000 characters | | Allowed prefixes | `select`, `with`, `explain`, `show`, `values`, `table` | | Transaction | Read-only, on the SQL role | | Statement timeout | 3 seconds | | Rows returned | At most 200; the response says when it was truncated | > **important**: The editor will not create a table, add a column, or write a row. Anything that is not a single read-only statement is rejected with `400 invalid_sql`. Schema changes go through the Database screens. ## Useful queries **Count rows per plan** ```sql SELECT plan, count(*) AS customers FROM public.customers GROUP BY plan ORDER BY customers DESC; ``` **Inspect your end users** ```sql SELECT email, is_anonymous, email_verified_at, last_sign_in_at FROM auth.users ORDER BY created_at DESC LIMIT 50; ``` The SQL role can read the managed `auth` and `logs` schemas, so the editor is also how you inspect users, sessions, and request logs. The `vault` schema is not readable from it. ## The response shape **Result · trimmed** ```json { "columns": ["plan", "customers"], "rows": [{ "plan": "pro", "customers": 2 }], "truncated": false, "rowCount": 2, "durationMs": 4, "readOnly": true, "maxRows": 200 } ``` ## Additional resources - [Tables and columns](https://cubibase.com/docs/database/tables) Where schema changes actually happen. - [Functions](https://cubibase.com/docs/database/functions) Test your functions here with SELECT. - [Sessions and tokens](https://cubibase.com/docs/auth/sessions) What the auth tables contain. --- # Data API overview Source: https://cubibase.com/docs/data-api Also available: [Markdown version](https://cubibase.com/docs/data-api.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every exposed table is served at /rest/v1/{table} on your project host. Two headers on every request: the publishable key and the user’s JWT. ## The request shape | Piece | Value | Purpose | | --- | --- | --- | | Host | `https://{slug}.api.cubibase.com` | Selects the project | | Path | `/rest/v1/{table}` | Selects the exposed table | | `apikey` header | Publishable key (`cb_pub_…`) | Identifies the project credential | | `Authorization` header | `Bearer ` | Identifies the end user | **Request** ```http GET https://example-project.api.cubibase.com/rest/v1/customers?plan=eq.pro&order=name.asc&limit=20 apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` **200 · response** ```json { "data": [ { "id": "8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901", "name": "Mina Cho", "email": "mina@example.com", "plan": "pro", "owner_id": "user_mina" }, { "id": "44ab91c3-0e55-4d72-b018-6f2c8a91bb70", "name": "Priya Shah", "email": "priya@example.org", "plan": "pro", "owner_id": "user_priya" } ] } ``` > **note**: The publishable key alone is not enough. A request without a bearer token fails with `401 missing_end_user_token`, even with a valid key. ## Response envelope Every successful response wraps its payload in a `data` field. Lists return an array; single rows and writes return one object. | Call | Status | `data` contains | | --- | --- | --- | | `GET /rest/v1/{table}` | `200` | An array of rows (possibly empty) | | `GET /rest/v1/{table}/{id}` | `200` | One row object | | `POST /rest/v1/{table}` | `201` | The inserted row, all columns | | `PATCH /rest/v1/{table}/{id}` | `200` | The updated row, all columns | | `DELETE /rest/v1/{table}/{id}` | `200` | The deleted row, all columns | | `POST /rest/v1/rpc/{function}` | `200` | The function result: a value, an object, or an array | ## Errors Errors are JSON objects with a stable `code`, a human `message`, and a `requestId` you can match against the project logs. **401 · missing bearer token** ```json { "error": { "code": "missing_end_user_token", "message": "An end-user bearer token is required", "requestId": "req_example" } } ``` | Status | Code | Meaning | | --- | --- | --- | | `401` | `missing_api_key` / `invalid_api_key` | The publishable key is absent or wrong | | `401` | `missing_end_user_token` / `invalid_token` | The bearer JWT is absent or fails verification | | `404` | `not_found` | Unknown table, unexposed table, or missing row | | `405` | `method_not_allowed` | That operation is not exposed for the table | ## What the API does not do - No joins or nested resources: one table request addresses one table. Logic that spans tables belongs in a function, called over RPC. - No bulk writes: `POST` inserts one row; `PATCH` and `DELETE` address one primary key. - No arbitrary SQL from the application — the SQL editor is a Console tool. Functions you write and grant are the supported way to run custom logic. - Tables with composite primary keys are not served by the row-by-id routes. ## Additional resources - [Querying rows](https://cubibase.com/docs/data-api/querying) Filters, select, order, limit, offset. - [Writing rows](https://cubibase.com/docs/data-api/writing) Insert, update, delete, and constraint errors. - [Calling functions (RPC)](https://cubibase.com/docs/data-api/rpc) Run your SQL functions from the app. - [Error codes](https://cubibase.com/docs/reference/errors) The full list, with causes and fixes. --- # Querying rows Source: https://cubibase.com/docs/data-api/querying Also available: [Markdown version](https://cubibase.com/docs/data-api/querying.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Filter with column=op.value, pick columns with select, sort with order, and page with limit and offset. All of it in the query string. ## Filters Any query parameter that is not reserved (`select`, `order`, `limit`, `offset`) is a filter: `column=op.value`. Multiple filters combine with AND. **Operators** | Operator | Meaning | Example | | --- | --- | --- | | `eq` | Equals | `plan=eq.pro` | | `neq` | Not equals | `plan=neq.free` | | `gt` / `gte` | Greater than (or equal) | `age=gte.18` | | `lt` / `lte` | Less than (or equal) | `price=lt.100` | | `like` | Pattern match (case-sensitive) | `name=like.M%25` | | `ilike` | Pattern match (case-insensitive) | `name=ilike.m%25` | | `is` | `null`, `true`, or `false` | `archived_at=is.null` | **Pro customers whose name starts with M** ```http GET https://example-project.api.cubibase.com/rest/v1/customers?plan=eq.pro&name=ilike.m%25 apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` > **tip**: URL-encode the `%` wildcard as `%25` in like/ilike patterns. Values are always bound as parameters — never concatenated into SQL. ## Choosing columns `select` takes a comma-separated list of 1 to 64 columns. Without it, every column is returned. **Only names and emails** ```http GET https://example-project.api.cubibase.com/rest/v1/customers?select=name,email apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ## Sorting `order` takes `column.asc` or `column.desc`, up to three columns separated by commas. **Newest plans first, then name** ```http GET https://example-project.api.cubibase.com/rest/v1/customers?order=plan.desc,name.asc apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ## Pagination | Parameter | Default | Maximum | Notes | | --- | --- | --- | --- | | `limit` | `20` | `1000` | Rows per page | | `offset` | `0` | `100000` | Rows to skip | **Page 3, 25 rows per page** ```http GET https://example-project.api.cubibase.com/rest/v1/customers?order=name.asc&limit=25&offset=50 apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` > **note**: Always pair pagination with a stable `order`. Without it, PostgreSQL does not guarantee row order between pages. ## Reading one row `GET /rest/v1/{table}/{id}` reads a single row by primary key. A missing row — or one the user’s policy hides — returns `404 not_found`. **One customer** ```http GET https://example-project.api.cubibase.com/rest/v1/customers/8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901 apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ## Additional resources - [Writing rows](https://cubibase.com/docs/data-api/writing) The other half of the API. - [Row-level security](https://cubibase.com/docs/database/row-level-security) Why a query may return fewer rows than exist. --- # Writing rows Source: https://cubibase.com/docs/data-api/writing Also available: [Markdown version](https://cubibase.com/docs/data-api/writing.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) POST inserts one row, PATCH updates one row by primary key, DELETE removes it. Each returns the affected row with every column. ## Insert a row `POST /rest/v1/{table}` with a JSON object of column values. Columns with defaults can be omitted. The response is `201` with the full inserted row. **Insert · request** ```http POST https://example-project.api.cubibase.com/rest/v1/customers apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json { "name": "Mina Cho", "email": "mina@example.com", "plan": "pro", "owner_id": "" } ``` > **important**: On a table with a user column, set that column to the calling user’s id (the JWT `sub`). Writing another user’s id fails the policy’s `WITH CHECK` with `403 forbidden`. ## Update a row `PATCH /rest/v1/{table}/{id}` with the fields to change. Only the listed columns are touched; the response is the full updated row. **Update · request** ```http PATCH https://example-project.api.cubibase.com/rest/v1/customers/8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901 apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json { "plan": "team" } ``` ## Delete a row `DELETE /rest/v1/{table}/{id}` removes the row and returns it in `data`. A row that does not exist — or is hidden by the user’s policy — returns `404 not_found`. **Delete · request** ```http DELETE https://example-project.api.cubibase.com/rest/v1/customers/8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901 apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ## Constraint errors PostgreSQL constraints surface as stable error codes, so your app can react without parsing messages: | Status | Code | Cause | | --- | --- | --- | | `409` | `conflict` | Unique constraint violated (e.g. duplicate email) | | `400` | `not_null_violation` | A required column was omitted | | `409` | `foreign_key_violation` | A referenced row does not exist | | `400` | `check_violation` | A value failed a check constraint | | `400` | `invalid_input` | A value does not fit the column type | | `403` | `forbidden` | The row policy rejected the write | > **note**: Bodies are limited to 64 fields, and row ids to 200 characters. `PATCH` and `DELETE` require a table with a single primary key column. ## Additional resources - [Querying rows](https://cubibase.com/docs/data-api/querying) Read back what you wrote. - [Error codes](https://cubibase.com/docs/reference/errors) Every code the engine can return. --- # Calling functions (RPC) Source: https://cubibase.com/docs/data-api/rpc Also available: [Markdown version](https://cubibase.com/docs/data-api/rpc.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) A function you grant to the Data API role is callable at POST /rest/v1/rpc/{name}. Same host, same publishable key, same end-user JWT. Arguments are a JSON object; the result comes back in data. ## The call Write the function in the Console (Database, Functions), then switch on Grant Data API EXECUTE. The function is then served on the project host: **RPC · request** ```http POST https://example-project.api.cubibase.com/rest/v1/rpc/customer_count apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json { "plan_name": "pro" } ``` **200 · response** ```json { "data": 2 } ``` The body is a JSON object keyed by parameter name. Values are bound as parameters and cast to the declared types, so "42" works for an integer and a JSON object feeds a jsonb parameter. Omit a key to use the parameter default; send {} (or no body) for a function without arguments. > **note**: Only POST is served. A function that writes rows is still a POST — the method selects the call, not the effect. Statements run with the api pool’s 8-second timeout. ## What data contains | Return type | `data` | Example | | --- | --- | --- | | Scalar (`integer`, `text`, `jsonb`, …) | The value itself | `{ "data": 2 }` | | `SETOF` a scalar | An array of values | `{ "data": ["a-note", "b-note"] }` | | `SETOF` a table or composite | An array of row objects | `{ "data": [{ "id": "…", "body": "…" }] }` | | Composite / OUT parameters | One row object | `{ "data": { "total": 12, "mine": 3 } }` | | `void` | `null` | `{ "data": null }` | Results are JSON: bigint and numeric arrive as JSON numbers, timestamps as ISO strings. A set-returning function is capped at 10000 rows per call; page inside the function with arguments when you need more. ## Identity and row-level security The call runs as the api role with cubibase.user_id set to the JWT subject, exactly like a table request. A SECURITY INVOKER function sees only the rows the caller’s policies allow: **A function that respects RLS** ```sql CREATE FUNCTION public.my_note_bodies() RETURNS SETOF text LANGUAGE sql STABLE SECURITY INVOKER SET search_path = public, pg_catalog AS $$ SELECT body FROM public.notes ORDER BY body; $$; ``` Two users calling my_note_bodies get two different arrays. SECURITY DEFINER runs as the function owner instead and can bypass the caller’s policies — grant it deliberately and validate arguments inside the body. > **important**: EXECUTE on the function is not a grant on the tables it reads. The api role still needs SELECT (or write) privileges on those tables — expose the table in the Console, or the call fails with 403 forbidden. RLS then narrows the rows per user. ## Overloads and defaults - Parameters are matched by name. Keys you send must exist on the function; required parameters must be present or have defaults. - When several overloads accept the same keys, an exact match wins. A tie answers 300 ambiguous_function with the candidate signatures in details. - Functions with unnamed parameters cannot be called with a JSON object; name the parameters in the Console. - Defaults are applied by PostgreSQL, so the function body sees the same values as a direct SQL call. ## Errors | Status | Code | Meaning | | --- | --- | --- | | `401` | `missing_api_key` / `missing_end_user_token` | Same credential rules as table routes | | `404` | `not_found` | No such function, no EXECUTE grant, or no overload matches the argument names | | `400` | `invalid_body` | Body is not an object, or a value does not fit the parameter type | | `403` | `forbidden` | A policy or a missing table grant blocked the function body | | `300` | `ambiguous_function` | Several overloads match; details lists the signatures | | `408` | `statement_timeout` | The function ran past the statement timeout | | `413` | `result_too_large` | A set-returning function produced more than 10000 rows | > **note**: Constraint failures inside the function surface with the same codes as table writes: conflict, foreign_key_violation, check_violation. RPC calls appear in the project request logs with the argument names and the user id. ## Additional resources - [Functions](https://cubibase.com/docs/database/functions) Writing and granting functions in the Console. - [Row-level security](https://cubibase.com/docs/database/row-level-security) The policies an INVOKER function runs under. - [API routes](https://cubibase.com/docs/reference/routes) Every route on the project host. --- # Authentication overview Source: https://cubibase.com/docs/auth Also available: [Markdown version](https://cubibase.com/docs/auth.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase Auth runs on your project host under /auth/v1. Users live in your project’s database, and the access token they receive is the JWT your Data API calls use. ## How it fits together **Sign-up flow, illustration.** Your app (email + password) → POST /auth/v1/signup → CubiBase Auth (Argon2id hash) → INSERT auth.users → Your database (example_project_db). Response: 201 · session with accessToken, refreshToken, expiresIn: 3600. Illustration. Sign-up returns the JWT your Data API calls use. - Users are rows in `auth.users` inside your project’s PostgreSQL database — not a shared directory. - Passwords are stored only as Argon2id hashes; refresh tokens are stored as hashes too. - The `accessToken` is an HS256 JWT whose `sub` is the user id. Send it as the bearer token on Data API calls. - A table with a user column filters rows by that id automatically. ## Sign-in methods - [Email and password](https://cubibase.com/docs/auth/email-password) Sign up, sign in, and the password rules. - [Anonymous users](https://cubibase.com/docs/auth/anonymous) Let visitors in first; convert them in place later. - [Google sign-in](https://cubibase.com/docs/auth/google) OAuth redirect flow and ID-token flow, step by step. - [Multi-factor (TOTP)](https://cubibase.com/docs/auth/mfa) Authenticator apps, challenges, and required MFA. Already have an identity provider? Configure the project to verify its RS256 tokens instead — see External identity providers. ## The endpoints at a glance | Endpoint | Purpose | Bearer token? | | --- | --- | --- | | `POST /auth/v1/signup` | Create a user, return a session | No | | `POST /auth/v1/signup/anonymous` | Create an anonymous session | No | | `POST /auth/v1/token?grant_type=password` | Sign in | No | | `POST /auth/v1/token?grant_type=refresh_token` | Refresh a session | No | | `POST /auth/v1/token?grant_type=mfa` | Complete an MFA challenge | No | | `POST /auth/v1/token?grant_type=id_token` | Verify a Google ID token | Optional (links) | | `GET /auth/v1/authorize?provider=google` | Start the Google flow | Optional (links) | | `GET /auth/v1/callback` | Google redirects back here | No | | `POST /auth/v1/logout` | Revoke a session | No | | `GET /auth/v1/user` | Read the signed-in user | Yes | | `PATCH /auth/v1/user` | Update the user; convert anonymous | Yes | | `POST /auth/v1/factors` | Enroll a TOTP factor | Yes | | `POST /auth/v1/factors/verify` | Confirm the first code | Yes | | `DELETE /auth/v1/factors/{factorId}` | Remove a factor | Yes | > **note**: Every endpoint requires the `apikey` header with the project’s publishable key — the same key as the Data API. The callback is the exception: Google’s redirect carries no headers, so the single-use state is its security boundary. ## Project settings All of this is configured per project in Console → Auth: providers, password rules, token lifetimes, MFA, rate limits, the user directory, and sessions. | Setting | Default | | --- | --- | | Signup enabled | On | | Password sign-in enabled | On | | Minimum password length | 8 characters | | Email autoconfirm | On (no confirmation email is sent yet) | | Access token lifetime | 1 hour | | Refresh token lifetime | 30 days | | Anonymous sign-ins | Off | | Google sign-in | Off | | MFA | Off (optional or required when on) | | Signup rate limit | 30 per hour per IP | | Sign-in rate limit | 30 per minute per IP | ## Additional resources - [Sessions and tokens](https://cubibase.com/docs/auth/sessions) Rotation, reuse detection, and revocation. - [External identity providers](https://cubibase.com/docs/auth/external-idp) Bring your own RS256 / JWKS provider. - [Authentication feature page](https://cubibase.com/features/authentication) The product view of CubiBase Auth. --- # Email and password Source: https://cubibase.com/docs/auth/email-password Also available: [Markdown version](https://cubibase.com/docs/auth/email-password.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) POST /auth/v1/signup creates a user and returns a session. Sign in later with the password grant; the access token is the JWT for your Data API calls. ## Sign up **Sign up · request** ```http POST https://example-project.api.cubibase.com/auth/v1/signup apikey: cb_pub_EXAMPLE_ONLY Content-Type: application/json { "email": "mina@example.com", "password": "" } ``` **201 · response (trimmed)** ```json { "user": { "id": "3f2b8c1e-9a47-4d02-b6e5-1c8f0a3d7e29", "email": "mina@example.com", "emailVerifiedAt": "2026-11-18T09:12:44.000Z", "providers": ["email"], "mfaEnabled": false }, "accessToken": "", "refreshToken": "", "tokenType": "Bearer", "expiresIn": 3600 } ``` - The password must meet the project’s minimum length — 8 characters by default — and must not equal the email address. - An optional `data` object is stored as the user’s metadata. - The response carries the `user`, an `accessToken`, a `refreshToken`, and the expiry. - A duplicate email returns `409 user_exists`. > **note**: Email autoconfirm is on by default: the user is marked verified at signup and no confirmation email is sent. Turn autoconfirm off to manage verification yourself through the control API. ## Sign in **Sign in · request** ```http POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=password apikey: cb_pub_EXAMPLE_ONLY Content-Type: application/json { "email": "mina@example.com", "password": "" } ``` A correct email and password return the same session shape as signup. Wrong credentials return `401 invalid_credentials` — the same error whether the email exists or not. > **important**: If the user has a verified TOTP factor and MFA is on for the project, the password grant returns an MFA challenge instead of a session. See Multi-factor (TOTP). ## Using the session 1. Store the `refreshToken` safely on the client. 2. Send the `accessToken` as `Authorization: Bearer …` on Data API calls. 3. When it expires (1 hour by default), refresh with `grant_type=refresh_token` and store the new pair. 4. On sign-out, `POST /auth/v1/logout` with the refresh token revokes the session. **Refresh · request** ```http POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=refresh_token apikey: cb_pub_EXAMPLE_ONLY Content-Type: application/json { "refreshToken": "" } ``` ## Read and update the user `GET /auth/v1/user` returns the signed-in user from the bearer token. `PATCH /auth/v1/user` updates the password or metadata (and converts anonymous users — see Anonymous users). **Read the current user** ```http GET https://example-project.api.cubibase.com/auth/v1/user apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ## Additional resources - [Sessions and tokens](https://cubibase.com/docs/auth/sessions) What rotation and reuse detection mean for your client. - [Multi-factor (TOTP)](https://cubibase.com/docs/auth/mfa) The challenge flow after password sign-in. - [Data API](https://cubibase.com/docs/data-api) Where the access token goes next. --- # Sessions and tokens Source: https://cubibase.com/docs/auth/sessions Also available: [Markdown version](https://cubibase.com/docs/auth/sessions.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Access tokens live for one hour; refresh tokens for 30 days and rotate on every refresh. Reusing a replaced refresh token revokes the whole family. ## The token pair | Token | Format | Default lifetime | Use | | --- | --- | --- | --- | | `accessToken` | HS256 JWT | 1 hour | Bearer token on Data API and user endpoints | | `refreshToken` | Opaque, stored hashed | 30 days | Exchange for a new pair; never sent to the Data API | The access token’s claims include `sub` (the user id), `email`, `session_id`, `amr` (how the session authenticated: `pwd`, `mfa`, `oauth`, or empty for anonymous), and the expiry. Both lifetimes are configurable per project. ## The session lifecycle **Session lifecycle, illustration.** 1. Sign in (accessToken · 1 h). Email and password return an access JWT and a refresh token. 2. Refresh (refreshToken · rotates). A new pair is issued and the old refresh token is retired. 3. Reuse detected (family revoked). A retired token presented again revokes the whole family. 4. Revoke (session_revoked). Logout or a Console revoke fails the session on the next request. Illustration with fictional tokens. It does not query CubiBase. ## Refreshing **Refresh · request** ```http POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=refresh_token apikey: cb_pub_EXAMPLE_ONLY Content-Type: application/json { "refreshToken": "" } ``` - A refresh issues a new access token and a new refresh token, and retires the old one. - The session id stays the same across refreshes, so the Console shows one session, not dozens. - Store the new pair atomically: the old refresh token is dead the moment the response arrives. > **warning**: If a replaced refresh token is presented again — a replayed copy, a stolen backup — CubiBase revokes the entire token family. The user signs in again; the attacker’s copy stops working. Treat `401 invalid_refresh_token` as “sign in again”, not “retry”. ## Revocation is immediate Every Data API request checks that the session behind the token is still live and the user is not banned. Revoking a session (logout, or the Console’s Sessions screen) or banning a user takes effect on the next request — not when the access token expires. **Logout · request** ```http POST https://example-project.api.cubibase.com/auth/v1/logout apikey: cb_pub_EXAMPLE_ONLY Content-Type: application/json { "refreshToken": "" } ``` | Situation | Next request returns | | --- | --- | | Session revoked | `401 session_revoked` | | User banned | `403 user_banned` | | Project requires MFA, session lacks it | `401 mfa_required` | | Access token expired | `401 invalid_token` | ## Additional resources - [Email and password](https://cubibase.com/docs/auth/email-password) Where the first pair comes from. - [Multi-factor (TOTP)](https://cubibase.com/docs/auth/mfa) Sessions that carry an MFA verification. --- # Anonymous users Source: https://cubibase.com/docs/auth/anonymous Also available: [Markdown version](https://cubibase.com/docs/auth/anonymous.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Let visitors use your app before they create an account. An anonymous user is a real user with a real id — and converting them later keeps every row they wrote, with a password or with Google (no password needed). ## Enable anonymous sign-ins 1. **Open the provider settings** — Console → your project → Auth → Providers → Anonymous users. 2. **Switch on Allow anonymous sign-ins** — The setting is off by default. Turning it off later blocks new anonymous sessions but does not touch existing ones. > **note**: Anonymous sign-ins follow the project signup switch and the signup rate limit, and anonymous users count toward the plan’s end-user quota. ## Sign a visitor in `POST /auth/v1/signup/anonymous` needs no email or password. CubiBase creates a real user in `auth.users` with `is_anonymous` set and returns the same session shape as a normal signup. **Anonymous sign-in · request** ```http POST https://example-project.api.cubibase.com/auth/v1/signup/anonymous apikey: cb_pub_EXAMPLE_ONLY Content-Type: application/json { "data": { "cart": ["item-1"] } } ``` **201 · response (trimmed)** ```json { "user": { "id": "3f2b8c1e-9a47-4d02-b6e5-1c8f0a3d7e29", "email": null, "isAnonymous": true, "providers": [], "mfaEnabled": false }, "accessToken": "", "refreshToken": "", "tokenType": "Bearer", "expiresIn": 3600 } ``` The access token works like any other end-user JWT: its `sub` is the user id, so rows written with a user column already belong to that visitor. ## Convert to a real account An anonymous visitor becomes a real account in place — same user id, same rows. There are two ways to do it, and Google never asks for a password: | Path | What the visitor does | What you send | | --- | --- | --- | | Email + password | Types an email and chooses a password | `PATCH /auth/v1/user` with the anonymous bearer token, `email`, and `password` | | Google | Clicks “Continue with Google” — Google proves who they are | The anonymous bearer token on `/auth/v1/authorize` or `grant_type=id_token` | > **important**: With Google, the Google account is the credential: CubiBase sets the email from the verified Google profile and clears `is_anonymous` — no password is created or required. The visitor signs in with Google from then on. - The user id does not change on either path — the rows they created stay theirs. - Existing sessions keep working; no re-login is forced. - Metadata is merged with the Google profile (name, picture). ## Path 1 · email and password When the visitor is ready to register with an email, convert the account with `PATCH /auth/v1/user`, sending the anonymous bearer token plus an email and a password. **Convert · same user id** ```http PATCH https://example-project.api.cubibase.com/auth/v1/user apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json { "email": "mina@example.com", "password": "" } ``` > **important**: On this endpoint conversion requires both email and password in one request (`400 conversion_requires_credentials` otherwise). A duplicate email returns `409 user_exists`. If the visitor prefers Google, use Path 2 instead — no password needed. ## Path 2 · Google (no password) The trick is one header: send the anonymous user’s access token as `Authorization: Bearer …` on the Google sign-in request. CubiBase then links the Google identity to that user instead of creating a new one. Both Google flows support it. ### Browser redirect flow 1. **Start the flow with the anonymous bearer token** — Call GET /auth/v1/authorize?provider=google&redirect_to=… with the apikey header and the anonymous access token as the bearer. CubiBase remembers the user id inside the single-use state. 2. **The visitor consents at Google** — Open the returned url in the browser. Google shows its consent screen — no CubiBase password is involved at any point. 3. **The callback converts the account** — Google redirects back to CubiBase, which links the identity to the remembered user: the email comes from the Google profile, is_anonymous is cleared, and the user id stays the same. 4. **Store the new session** — The browser lands on your redirect_to with a fresh token pair in the URL fragment (amr: ["oauth"]). Replace the anonymous pair with it; the old anonymous session keeps working until it expires or is revoked. **Authorize · with the anonymous bearer token** ```http GET https://example-project.api.cubibase.com/auth/v1/authorize?provider=google&redirect_to=https%3A%2F%2Fapp.example.com%2Fauth%2Fcallback apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ### ID-token flow (mobile and web SDKs) If your app already holds a Google ID token from Google Sign-In, post it to the id_token grant with the same anonymous bearer token. The response is a normal session for the converted user. **Link a Google ID token · same user id** ```http POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=id_token apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json { "provider": "google", "idToken": "" } ``` > **warning**: Without the anonymous bearer token, Google sign-in creates a brand-new user — the visitor’s anonymous rows stay behind on the old id. Always send the header while the visitor is still anonymous. > **note**: Because an anonymous user has no email yet, any Google account can be linked. A Google account already linked to another user returns `409 identity_exists`. The email-match rule (`409 email_mismatch`) only applies to users who already have an email. ## Managing anonymous users In the Console user directory, anonymous users carry an Anonymous badge and can be filtered separately. From the SQL editor you can inspect them directly: **SQL · count anonymous users** ```sql SELECT count(*) AS anonymous_users FROM auth.users WHERE is_anonymous; ``` ## Additional resources - [Google sign-in](https://cubibase.com/docs/auth/google) Both Google flows in depth — the bearer-token header is what converts an anonymous user. - [Row-level security](https://cubibase.com/docs/database/row-level-security) Why anonymous rows are already protected. - [Quotas](https://cubibase.com/docs/platform/quotas) Anonymous users count toward the end-user limit. --- # Google sign-in Source: https://cubibase.com/docs/auth/google Also available: [Markdown version](https://cubibase.com/docs/auth/google.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Create an OAuth client in the Google Cloud Console, paste its credentials into CubiBase, and register the callback URL. Two flows: browser redirect, or a Google ID token your app already holds. ## Configure it step by step Everything happens in two places: console.cloud.google.com for the Google side, and Console → project → Auth → Providers → Google for the CubiBase side. 1. **Google: select or create a project** — Open console.cloud.google.com and pick the Google Cloud project for your app. 2. **Google: configure the OAuth consent screen** — APIs & Services → OAuth consent screen. Choose External, fill in the app name and the support and developer contact emails, and add the scopes openid, email, and profile. While the app is in Testing, only listed test users can sign in; publish to production when you are ready for everyone. 3. **Google: create an OAuth client** — APIs & Services → Credentials → Create credentials → OAuth client ID → Web application. 4. **Google: register the redirect URI** — Copy the Authorized redirect URI that the CubiBase Google section displays — it looks like https://{slug}.api.cubibase.com/auth/v1/callback?provider=google&project={projectId}. Paste it exactly, query parameters included. 5. **CubiBase: enable the provider** — In Auth → Providers → Google, tick Enable Google sign-in, paste the Client ID and Client secret, and save. The secret is stored encrypted and never shown again; the section shows a Secret stored badge instead. 6. **CubiBase: allowlist your app’s URLs** — In the same form, fill the App redirect allowlist with the URLs in your app that should receive the session — one per line; a trailing * allows prefix matches. Loopback HTTP redirect URLs are always allowed for native and local development. > **warning**: The redirect URI must match character for character, including the `provider` and `project` query parameters. A mismatch is the most common cause of Google’s “redirect_uri_mismatch” error. ## The browser redirect flow **Google sign-in redirect flow, illustration.** Your app asks for a consent url → GET /auth/v1/authorize?provider=google → CubiBase Auth (single-use state) → browser opens Google consent → Google (user consents) → redirect to /auth/v1/callback → CubiBase callback (verifies code + state) → 302 · your redirect_to with #access_token=… refresh_token=… expires_in=3600. Illustration. The session rides in the URL fragment, which browsers never send to servers. Your app starts the flow with `GET /auth/v1/authorize?provider=google&redirect_to={your callback URL}`, sending the publishable key. The response contains a `url`: send the browser there. **1 · Start the flow** ```http GET https://example-project.api.cubibase.com/auth/v1/authorize?provider=google&redirect_to=https%3A%2F%2Fapp.example.com%2Fauth%2Fcallback apikey: cb_pub_EXAMPLE_ONLY ``` **2 · Response: open this url** ```json { "url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=…&redirect_uri=…&response_type=code&scope=openid%20email%20profile&state=…", "state": "", "expiresAt": "2026-11-20T10:10:00.000Z" } ``` Google shows its consent screen and redirects back to the CubiBase callback, which verifies the response and redirects the browser to your `redirect_to` with the session in the URL fragment (the part after `#`). **3 · Your callback page reads the fragment** ```text https://app.example.com/auth/callback#access_token=&refresh_token=&token_type=Bearer&expires_in=3600&expires_at=2026-11-20T11%3A00%3A00.000Z ``` > **tip**: Read the tokens from `location.hash` on your callback page and store them like any CubiBase session. Fragments are never sent to servers or access logs. If the user denies consent or something fails, the same redirect carries an `error` query parameter instead. ## The ID-token flow (mobile and web SDKs) If your app already obtains a Google ID token — Google Sign-In on Android, iOS, or the web — skip the redirect flow and POST it to `/auth/v1/token?grant_type=id_token` with the publishable key. **Verify a Google ID token** ```http POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=id_token apikey: cb_pub_EXAMPLE_ONLY Content-Type: application/json { "provider": "google", "idToken": "" } ``` CubiBase verifies the token’s RS256 signature against Google’s published keys, the issuer, the audience (your Client ID), and the expiry, then returns a normal session. Pass a `nonce` to bind the token to your sign-in attempt. ## Identity rules (both flows) | Situation | What happens | | --- | --- | | Google account has signed in before | Signs straight in | | Request carries an end-user bearer token | The Google identity links to that user — the anonymous upgrade path | | Verified Google email matches an existing user | The identity attaches to that account | | New Google account | Signs up a new user (the signup switch applies) | | User has a verified factor, project requires MFA | `403 mfa_required` — Google alone does not satisfy MFA | > **tip**: Converting an anonymous visitor? Send their access token as `Authorization: Bearer …` on the authorize request (or on the id_token grant). The Google identity then links to that same user — no password involved. Step by step in Anonymous users → Path 2. > **note**: Linking checks the email: a Google account whose email differs from the signed-in user’s email is refused with `409 email_mismatch`. Anonymous users have no email yet, so any Google account links and converts them. A Google account already linked to another user returns `409 identity_exists`. ## Additional resources - [Anonymous users](https://cubibase.com/docs/auth/anonymous) The conversion path Google linking completes. - [Sessions and tokens](https://cubibase.com/docs/auth/sessions) The session both flows return. - [Multi-factor (TOTP)](https://cubibase.com/docs/auth/mfa) Why Google sign-in still asks for a code sometimes. --- # Multi-factor authentication (TOTP) Source: https://cubibase.com/docs/auth/mfa Also available: [Markdown version](https://cubibase.com/docs/auth/mfa.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Users enroll an authenticator app; sign-in then returns a challenge that a six-digit code completes. MFA can be optional per user or required for the whole project. ## Enable MFA for the project 1. **Open the MFA settings** — Console → your project → Auth → Multi-factor. 2. **Enable MFA** — Users can now enroll a TOTP authenticator. Optionally make MFA required: every session must then include a verified factor. ## Enroll an authenticator `POST /auth/v1/factors` with the bearer token returns a TOTP secret and an `otpauth://` URI. Render the URI as a QR code (or show the secret for manual entry), then confirm the first code with `POST /auth/v1/factors/verify`. **1 · Enroll · response** ```json { "factorId": "b2e6f0a4-7c19-4d83-9e51-6a0c2d8b4f37", "secret": "", "uri": "otpauth://totp/CubiBase%20example-project:mina%40example.com?secret=…&issuer=…" } ``` **2 · Verify the first code** ```http POST https://example-project.api.cubibase.com/auth/v1/factors/verify apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json { "factorId": "b2e6f0a4-7c19-4d83-9e51-6a0c2d8b4f37", "code": "123456" } ``` > **note**: A factor only counts after the first code verifies. Remove a factor with `DELETE /auth/v1/factors/{factorId}`; the Console can also remove factors for a user. ## Sign-in with a challenge When a user with a verified factor signs in with a password, the token grant returns an MFA challenge instead of a session: **Password grant · MFA challenge** ```json { "mfaRequired": true, "challengeId": "9d41c7a2-5b18-4e6f-a0d3-2e7b9c4f1a58", "factorId": "b2e6f0a4-7c19-4d83-9e51-6a0c2d8b4f37", "expiresAt": "2026-11-18T09:17:44.000Z" } ``` Post the challenge id and the current code to complete the sign-in. Challenges expire after five minutes and are single-use. **Complete the challenge** ```http POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=mfa apikey: cb_pub_EXAMPLE_ONLY Content-Type: application/json { "challengeId": "9d41c7a2-5b18-4e6f-a0d3-2e7b9c4f1a58", "code": "123456" } ``` The response is a normal session whose tokens carry `amr: ["pwd", "mfa"]` — the proof Data API requests check when the project requires MFA. ## Required MFA - Every session must include a verified factor; sessions without it fail Data API calls with `401 mfa_required`. - A user without a factor cannot sign in until they enroll: the password grant returns `403 mfa_enrollment_required`. - Google sign-in does not replace MFA for users with a verified factor — they must use password + TOTP. - Code attempts are rate-limited (10 per minute per IP by default). ## Additional resources - [Sessions and tokens](https://cubibase.com/docs/auth/sessions) How the amr claim travels with the session. - [Email and password](https://cubibase.com/docs/auth/email-password) The grant that starts the challenge. --- # External identity providers Source: https://cubibase.com/docs/auth/external-idp Also available: [Markdown version](https://cubibase.com/docs/auth/external-idp.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) If your users already sign in elsewhere, keep that provider. Configure a JWKS URL, issuer, and audience, and CubiBase verifies its RS256 tokens on every request. ## Configure the provider | Setting | Purpose | | --- | --- | | JWKS URL | Where CubiBase fetches the provider’s public signing keys (HTTPS, cached 5 minutes) | | Issuer (`iss`) | Must match the token’s issuer claim | | Audience (`aud`) | Must match the token’s audience claim | | Allowed algorithms | The token’s `alg` must be allowed for the project | On every Data API request, CubiBase verifies the RS256 signature against the JWKS, checks issuer, audience, and expiry, and uses the verified `sub` as the user id for the transaction — so user-column policies work with your own ids. > **important**: CubiBase Auth and an external provider are alternatives: a project’s requests are checked against the provider configuration you set. Google is the built-in social provider; other social buttons and SAML are not part of the current engine. ## Development tokens While building, a development endpoint can issue an HS256 token for a user id you choose, when that issuer is enabled for the project. Use it to seed data and test policies before your real sign-in is wired up. > **warning**: Development tokens are for building, not production traffic. Switch the project to your real provider (or CubiBase Auth) before you ship. ## Plan availability Bring-your-own-IdP (RS256 / JWKS) is available on the Pro and Business plans. The Free plan uses CubiBase Auth. ## Additional resources - [Authentication overview](https://cubibase.com/docs/auth) The built-in alternative: CubiBase Auth. - [Row-level security](https://cubibase.com/docs/database/row-level-security) How the verified sub becomes row access. - [Plans](https://cubibase.com/pricing) Where external IdP support sits. --- # API keys Source: https://cubibase.com/docs/platform/api-keys Also available: [Markdown version](https://cubibase.com/docs/platform/api-keys.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) The publishable key identifies your project to the API. It is meant to live in your client — but it never authorizes rows by itself. ## Two kinds of key | Key | Prefix | Where it lives | What it does | | --- | --- | --- | --- | | Publishable | `cb_pub_` | Your app (browser, mobile) | Identifies the project on every Data API and Auth call | | Secret | `cb_sec_` | Server-side only (trusted servers, AI agents) | Authenticates Data API and RPC calls as the service actor; shown once, stored hashed | > **important**: Never ship a secret key in a browser or mobile client. It acts with service-level access to every row a service policy grants. Keep it on your server or in an agent environment. ## Using the secret key (service actor) A secret key authenticates REST and RPC calls without an end-user JWT. Send it as the `apikey` header or as `Authorization: Bearer`. The request runs with `cubibase.role = 'service'` and an empty `cubibase.user_id()`. Row-level security still applies — a table without a service policy returns no rows. **Service request** ```http GET https://example-project.api.cubibase.com/rest/v1/customers apikey: cb_sec_… ``` Grant service access explicitly with a policy, for example `cubibase.current_role() = 'service'` for SELECT, or keep service access limited to SECURITY DEFINER functions. Every service write is recorded in the audit log. ## Using the publishable key Send it in the `apikey` header on every request to the project host — Data API and Auth alike. The engine checks it against the project resolved from the host. **Every request carries both headers** ```http GET https://example-project.api.cubibase.com/rest/v1/customers apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` | Situation | Response | | --- | --- | | No `apikey` header | `401 missing_api_key` | | Key not valid for this project | `401 invalid_api_key` | | Valid key, no bearer token and no secret key | `401 missing_end_user_token` | ## Keeping keys safe - The publishable key is public by design, but treat it as a project credential: it names your project to the API. - Row access comes from the end-user JWT and the table’s policies — not from the key. - Manage keys from Console → project → API keys: create, revoke, and rotate. - If a key leaks and you want it dead, revoke it; requests using it fail immediately. ## Additional resources - [How CubiBase works](https://cubibase.com/docs/architecture) Where the key check sits in the request path. - [Row-level security](https://cubibase.com/docs/database/row-level-security) What actually authorizes rows. --- # Personal access tokens Source: https://cubibase.com/docs/platform/access-tokens Also available: [Markdown version](https://cubibase.com/docs/platform/access-tokens.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Personal access tokens (cb_pat_…) authenticate the Control API without an interactive login — for scripts, CI, and AI agents. Create them in Console → Account → Access tokens. ## What a token is A personal access token (PAT) is a developer credential for the Control API at api.cubibase.com. It carries the permissions of the account that created it, narrowed by a scope and an optional project restriction. Tokens are shown once at creation and stored only as SHA-256 hashes. | Scope | Allows | | --- | --- | | read | GET routes: list projects, schema, rows, logs, usage | | write | Everything in read, plus creating and modifying projects, tables, policies, keys | | admin | Everything in write, plus destructive operations such as project deletion | Scopes are cumulative: write includes read, admin includes write. A token can also be restricted to a single project, and can carry an expiration date. ## Creating and using a token 1. **Open the Console** — Account → Access tokens → Create token. Pick a name, scope, optional project restriction and expiry. 2. **Copy the token** — The cb_pat_… value is shown exactly once. Store it in a secret manager or environment variable. 3. **Call the Control API** — Send Authorization: Bearer cb_pat_… on any api.cubibase.com route within the token’s scope. **List projects with a PAT** ```bash curl https://api.cubibase.com/v1/projects \ -H "Authorization: Bearer cb_pat_…" ``` > **note**: Tokens cannot manage other tokens: the /v1/auth/tokens routes require an interactive session. This prevents a leaked token from minting new credentials. ## Rate limits and revocation - Token requests are rate-limited per token. A throttled request returns 429 with a Retry-After header — wait that many seconds and retry. - Revoke a token from the same Console page; requests using it fail immediately with 401. - Every token records a last-used timestamp so you can find and revoke stale credentials. - Errors always carry a stable machine code and a requestId, e.g. {"error":{"code":"insufficient_scope","message":"…","requestId":"…"}}. ## Additional resources - [Using CubiBase with AI agents](https://cubibase.com/docs/agents) MCP server, CLI, and the agent workflow built on these tokens. - [API keys](https://cubibase.com/docs/platform/api-keys) The project-level keys for the Data API. --- # Quotas and suspension Source: https://cubibase.com/docs/platform/quotas Also available: [Markdown version](https://cubibase.com/docs/platform/quotas.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Each plan sets project slots, an independent database quota per project, and consumption quotas shared across your organization. Hitting a limit refuses new growth — reads keep working, and data is never deleted for exceeding a quota. ## What the plans limit | Quota | Scope | Measured as | | --- | --- | --- | | Project slots | Organization | Every plan includes one project; paid plans add purchased additional-project slots. Paused projects still count | | Database size | Per project | The project database’s size on disk, independent for every project | | Monthly active users | Organization (shared) | Unique end users who authenticated this cycle, across all projects | | API requests per month | Organization (shared) | Data API requests across all projects | | Total bandwidth per month | Organization (shared) | Outbound bytes delivered to customers this cycle — API responses plus file delivery, combined | | API bandwidth sublimit per month | Organization (shared) | API response bytes this cycle; a sublimit of total bandwidth, not an extra allowance | | Object storage | Organization (shared) | Ready objects across all projects, plus bytes reserved by in-flight uploads | | Storage write operations | Organization (shared) | Completed uploads and server-side writes this cycle | | File download requests | Organization (shared) | Authorized downloads this cycle | | CloudFront requests | Organization (shared) | Combined API and file-delivery edge requests this cycle | | Function invocations and compute | Organization (shared) | Executed runs and GB-seconds this cycle | | Maximum file size | Technical (per operation) | The smaller of the plan maximum and the bucket’s own cap | Database storage is allocated per project; all other consumption quotas are shared across the organization. Buying additional projects adds project slots and per-project database storage — it never increases the shared quotas. Total bandwidth covers API responses and file delivery together; the API bandwidth sublimit never blocks your remaining file bandwidth. The numbers for each plan are on the pricing page. The Console’s Usage page shows consumption against every limit, with warnings at 50%, 75%, 90% and 100%. > **Optional additional usage (V4.5)**: By default every limit below is a hard stop. Pro and Business organizations can explicitly enable additional usage in Console → Billing → Additional Usage: consumption beyond the included quotas is then billed at published per-unit rates under a monthly spending limit the organization sets, instead of being refused. Free plans are never eligible, nothing is enabled automatically, and reaching the spending limit returns 402 spending_limit_reached while included quotas, billing access and deletion keep working. Rates and rules are on the pricing page. ## When a project hits a limit | Limit reached | What is refused | What keeps working | | --- | --- | --- | | Project slots | Creating another project (`402 quota_exceeded`). Free: upgrade to Pro required. Paid: purchase additional project slots | All existing projects keep working | | Monthly active users | New signups and first-time activations (`402 quota_exceeded`) | Sign-ins, reads, writes by existing active users | | Database size | New writes (`402 quota_exceeded`) | All reads | | Object storage | New uploads (`402 STORAGE_ACCOUNT_QUOTA_EXCEEDED`) | Downloads within bandwidth, deletions, upgrades | | Total bandwidth (API + file delivery) | Further downloads and API responses once the combined allowance is exhausted (`402 quota_exceeded`) | Metadata, listings, uploads; resets next billing cycle | | API bandwidth sublimit | Further API responses (`402 quota_exceeded`) | File downloads against remaining total bandwidth keep working | > **note**: Nothing is deleted when a quota is reached. Remove data or users you no longer need, or upgrade the plan, and the refused operations resume. ## Account suspension If the whole account stays over its plan limits — too many projects, an oversized database, or too many end users — we email a warning and start a 7-day grace period. Organizations with additional usage enabled and spending headroom are not suspended for billed excess (database storage, end users); the excess is metered under their spending limit instead. Project-slot limits always apply: additional projects are a fixed subscription item, never metered usage. 1. **Warning email** — The account is over its limits. The 7-day grace period starts. 2. **Still over after 7 days** — All of the account’s projects are suspended: the Data API, auth, and Console tools stop serving them and return 403 project_suspended. 3. **Back within limits** — Suspension ends automatically. Upgrade to Pro or Business, or delete projects, data, or users — suspended projects reactivate on their own. > **important**: Data is never deleted for exceeding a quota. Upgrading applies the higher limits to the same projects and databases — nothing is migrated. ## Changing plans Upgrades and downgrades are self-serve in the Console and prorated by Stripe. Switching between Pro and Business changes only the base plan: every purchased project slot and its monthly add-on charge stays exactly as it is. Before any change is confirmed, the Console shows a consolidated preview: the new monthly total, your unchanged purchased project slots, and — for downgrades — whether your current usage fits the smaller plan. 1. **Upgrades** — Apply immediately with prorations. Switching between Pro and Business preserves your purchased project slots, their quantity and their charges — only the base plan price changes. 2. **Downgrade validation** — CubiBase checks your project count (paused projects count), each project’s database size against the target per-project quota, and your shared object storage. If anything does not fit, the change is refused with a list of exactly what to resolve. 3. **Resolve, then confirm** — Delete projects or objects you no longer need. Purchased project slots stay purchased across paid plan changes; reducing them is a separate, explicit action scheduled for the next renewal. A scheduled slot reduction must be cancelled before a plan change. Nothing is ever deleted automatically to make a downgrade fit. 4. **Monthly consumption** — If this cycle’s consumption already exceeds a smaller allowance, that resource is blocked after the downgrade until the next cycle reset — reads keep working and no data is deleted. > **note**: Returning to Free happens by cancelling the subscription in the Stripe billing portal; the plan stays active until the period end. The same usage checks apply before the Free limits take effect. ## Additional resources - [Plans and limits](https://cubibase.com/pricing) The numbers per plan. - [Pause, archive, restore](https://cubibase.com/docs/platform/lifecycle) The separate inactivity policy for Free projects. --- # Pause, archive, restore Source: https://cubibase.com/docs/platform/lifecycle Also available: [Markdown version](https://cubibase.com/docs/platform/lifecycle.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Free projects must stay in use. After 14 idle days a project is paused; after 60 paused days it is archived to a downloadable backup. Nothing is ever lost. ## The inactivity timeline **Free-plan inactivity timeline.** 1. Active (serving traffic). API, auth, and Console work normally. Any request or Console visit counts as activity. 2. Paused (after 14 idle days). Free projects only. Requests return 403 project_paused; the database is untouched. Resume is instant. 3. Archived (after 60 paused days). A full .backup file is stored and the live database is removed. The backup is kept, never auto-deleted. 4. Restored (Resume anytime). CubiBase recreates the database and restores the backup: tables, rows, users, and policies included. Illustration of the Free-plan inactivity timeline. Paid plans are never paused for inactivity. Activity means a Data API or auth request, or opening the project in the Console. Paid plans (Pro and Business) are never paused for inactivity. ## Paused (day 14) - The API and auth return `403 project_paused`; the owner is emailed. - The database is left intact — nothing is archived yet. - Resume from the Console project page with one click. While the database exists, the resume is instant. - Reminder emails arrive around day 30, day 45, and one week before the deadline. ## Archived (day 60 of being paused) - CubiBase takes a full PostgreSQL backup (`pg_dump` custom format, a `.backup` file) and stores it. - The live database is removed to stop storage costs. - The backup is kept — it is not auto-deleted — and the project’s API keys and configuration survive. > **note**: An archived project is not lost. Download the `.backup` file from the Console project page at any time, or click Resume to bring the project back. ## Restoring Resume on an archived project recreates the database and restores the backup automatically — tables, rows, users, and row-level security policies included. The project is active again with the same slug, host, and keys. You can also restore the `.backup` on your own PostgreSQL server: **Restore on your own server** ```text pg_restore -d my_database example-project.backup ``` ## Additional resources - [Quotas and suspension](https://cubibase.com/docs/platform/quotas) The other reason a project can stop serving. - [Plans](https://cubibase.com/pricing) Paid plans are never paused for inactivity. --- # Storage overview Source: https://cubibase.com/docs/storage Also available: [Markdown version](https://cubibase.com/docs/storage.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) S3-backed object storage on your project host at /storage/v1. Public and private buckets, direct browser uploads, metered downloads, and server-enforced quotas. ## How Storage is organized Each project has buckets, and each bucket holds objects at logical paths such as `images/avatar.png`. Folders are path prefixes only — nothing is created for them. The catalog (buckets, objects, upload sessions, events) lives in a managed `storage` schema in your project’s PostgreSQL database. The file bytes live in the deployment’s private, encrypted S3 bucket under opaque platform-generated keys; your filenames never become S3 keys. | Piece | Where it lives | Who can touch it | | --- | --- | --- | | Bucket and object metadata | Project database, `storage` schema | The engine only — not the Data API or SQL roles’ writes | | File bytes | Private S3 bucket, encrypted at rest | The engine’s IAM role; clients via short-lived authorizations | | Quota accounting | Central metadata database | The engine, atomically per upload and download | ## Authentication Storage reuses the platform credentials. Every request carries the `apikey` header with the project’s publishable key. Writes and private reads additionally need an `Authorization: Bearer` token: either an end-user JWT from CubiBase Auth, or a secret API key (`cb_sec_…`) for trusted server code. Public-bucket reads need only the publishable key. | Credential | Can do | | --- | --- | | Publishable key alone | Read objects in public buckets (metered) | | Publishable key + user JWT | Upload, list, read, and delete according to bucket visibility and object ownership | | Publishable key + secret API key | Full project-scoped access — still subject to every quota | | Signed download token | Read exactly one object until the token expires | > **important**: Secret API keys are server-side credentials. Never ship them in a browser or mobile bundle. Quotas, project isolation, and audit logging apply to them exactly like to any other caller. ## Route map | Call | Purpose | | --- | --- | | `POST /storage/v1/buckets` | Create a bucket | | `GET /storage/v1/buckets` | List buckets | | `GET /storage/v1/buckets/{bucket}` | Bucket configuration | | `PATCH /storage/v1/buckets/{bucket}` | Update visibility, size cap, MIME allowlist | | `DELETE /storage/v1/buckets/{bucket}` | Delete the bucket and its objects | | `POST /storage/v1/objects/upload` | Start an upload (reserves quota, returns the S3 policy) | | `POST /storage/v1/uploads/{id}/complete` | Verify and finalize the uploaded object | | `GET /storage/v1/uploads/{id}` | Upload session status | | `GET /storage/v1/objects` | List objects by bucket, prefix, and search | | `GET /storage/v1/objects/{id}` | Object metadata | | `GET /storage/v1/objects/{id}/content` | Download (metered; Range supported) | | `POST /storage/v1/objects/{id}/sign` | Short-lived signed download link | | `GET /storage/v1/public/{bucket}/{path}` | Anonymous public-bucket read (metered) | | `DELETE /storage/v1/objects/{id}` | Delete an object | | `GET /storage/v1/usage` | This project’s storage and bandwidth consumption | **List objects · prefix browsing** ```http GET https://example-project.api.cubibase.com/storage/v1/objects?bucket=avatars&prefix=images/&delimiter=true&limit=50 apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ## In the Console Open a project and choose Storage. The overview shows project, account, and bandwidth quotas with warnings at 50%, 75%, 90%, and 100%. Buckets manages visibility and limits; Files is a prefix-based browser with drag-and-drop uploads, downloads, share links, and deletion. Console traffic passes through the same quota and event machinery as the API — there is no unmetered side door. - [Buckets](https://cubibase.com/docs/storage/buckets) Create and configure public and private buckets. - [Uploading files](https://cubibase.com/docs/storage/uploads) The three-step direct-to-S3 upload contract. - [Downloads and sharing](https://cubibase.com/docs/storage/downloads) Public URLs, authorized reads, and signed links. - [Quotas and errors](https://cubibase.com/docs/storage/quotas) Limits per plan and the machine-readable error codes. ## Additional resources - [Storage security](https://cubibase.com/docs/storage/security) Isolation, path safety, and what public really means. - [Object events](https://cubibase.com/docs/storage/events) The durable event contract and function triggers. - [Storage feature page](https://cubibase.com/features/storage) The product-level overview. --- # Buckets Source: https://cubibase.com/docs/storage/buckets Also available: [Markdown version](https://cubibase.com/docs/storage/buckets.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) A bucket is a named container with a visibility mode, an optional file size cap, and an optional MIME allowlist. Names are unique within the project. ## Create a bucket Bucket names are 2–63 characters: lowercase letters, digits, dots, dashes, and underscores, starting with a letter or digit. Creating, updating, and deleting buckets requires a secret API key (or a Console owner/admin session). **POST /storage/v1/buckets** ```http POST https://example-project.api.cubibase.com/storage/v1/buckets apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json { "name": "avatars", "public": true, "allowedMimeTypes": ["image/*"] } ``` | Field | Type | Meaning | | --- | --- | --- | | `name` | string, required | Unique within the project | | `public` | boolean, default `false` | `true` = anonymous read-only downloads | | `fileSizeLimitBytes` | integer or null | Per-bucket cap; can only lower the plan maximum | | `allowedMimeTypes` | string[] or null | Allowlist of exact types or `type/*` wildcards; null allows any | ## Public versus private - Public: anyone with the publishable key can read published objects at `/storage/v1/public/{bucket}/{path}`. Reads are metered against bandwidth. - Private: reads require an end-user JWT, a secret API key, or a signed download token. Listing private metadata always requires authorization. - Neither mode allows anonymous uploads, overwrites, or deletions. Public is a read setting, not a write setting. - Visibility can be flipped at any time with `PATCH`; existing signed links keep their expiry. ## Size cap and MIME allowlist The effective maximum file size is the smaller of the plan limit and the bucket cap. The MIME allowlist is checked twice: against the declared type when the upload starts, and against the verified content type reported by S3 at completion — a client cannot sneak a disallowed type past it by lying in the request. > **note**: Deleting a bucket deletes every object inside it from S3 and the catalog, and returns the bytes to your quota. The Console asks for confirmation; the API does not. ## Additional resources - [Uploading files](https://cubibase.com/docs/storage/uploads) Start an upload into your new bucket. - [Quotas and errors](https://cubibase.com/docs/storage/quotas) How the plan and bucket caps interact. --- # Uploading files Source: https://cubibase.com/docs/storage/uploads Also available: [Markdown version](https://cubibase.com/docs/storage/uploads.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Uploads go directly from the client to S3. The engine reserves quota first, issues a short-lived policy pinned to one staging key and the exact size, then verifies and finalizes the object. ## The three-step contract 1. **Start the upload** — POST the bucket, logical path, exact size in bytes, and MIME type. The engine validates the path, checks the plan and bucket limits, and atomically reserves the bytes against both the project and the account quota. If any limit would be exceeded, the request fails before any authorization is issued. 2. **POST the file to S3** — Build a multipart form: every field from the response’s upload.fields first, then Content-Type, then the file part last. POST it to upload.url. The policy pins the exact staging key and a content-length-range equal to the declared size, so S3 itself rejects any other size or destination. 3. **Complete the session** — POST to /storage/v1/uploads/{id}/complete. The engine heads the staged object, verifies its exact size and MIME type, copies it to its final key, converts the reservation into committed usage, and records the creation event — all in one transaction. Completion is idempotent: calling it twice returns the same object. **1 · Start the upload** ```http POST https://example-project.api.cubibase.com/storage/v1/objects/upload apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json { "bucket": "avatars", "path": "images/mika.png", "sizeBytes": 182344, "mimeType": "image/png", "overwrite": false } ``` **Response (trimmed)** ```json { "uploadId": "f2c6…", "objectId": "9b1e…", "bucket": "avatars", "path": "images/mika.png", "upload": { "url": "https://.s3..amazonaws.com", "fields": { "key": "staging//", "policy": "…", "x-amz-signature": "…" }, "method": "POST" }, "expiresAt": "2026-11-20T10:10:00.000Z" } ``` **3 · Complete** ```http POST https://example-project.api.cubibase.com/storage/v1/uploads//complete apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ## Browser example **JavaScript · fetch + FormData** ```ts const start = await fetch(`https://example-project.api.cubibase.com/storage/v1/objects/upload`, { method: 'POST', headers: { apikey: PUBLISHABLE_KEY, authorization: `Bearer ${userJwt}`, 'content-type': 'application/json', }, body: JSON.stringify({ bucket: 'avatars', path: `images/${file.name}`, sizeBytes: file.size, mimeType: file.type, overwrite: false, }), }).then((r) => r.json()); const form = new FormData(); for (const [k, v] of Object.entries(start.upload.fields)) form.append(k, v); form.append('Content-Type', file.type); form.append('file', file); // must be the last part await fetch(start.upload.url, { method: 'POST', body: form }); await fetch(`https://example-project.api.cubibase.com/storage/v1/uploads/${start.uploadId}/complete`, { method: 'POST', headers: { apikey: PUBLISHABLE_KEY, authorization: `Bearer ${userJwt}` }, }); ``` ## Overwrites and expiry - A path that already holds a ready object rejects the upload with `409 storage_object_exists` unless you pass `overwrite: true`. - Overwrite accounting uses the net change: replacing a 1 MB file with a 2 MB file commits +1 MB, not +2 MB. - Sessions expire (default 5 minutes). An expired session releases its reservation and can never be completed; start a new upload. - Failed or abandoned uploads never produce a downloadable object and never emit a creation event. Staging keys are cleaned up by a lifecycle rule and a cleanup worker. > **warning**: The declared size must equal the actual file size exactly. S3 enforces the content-length-range, and completion re-verifies the size — a mismatch fails the session and releases the reservation. ## Additional resources - [Downloads and sharing](https://cubibase.com/docs/storage/downloads) Read the file back. - [Quotas and errors](https://cubibase.com/docs/storage/quotas) What a rejected reservation looks like. --- # Downloads and sharing Source: https://cubibase.com/docs/storage/downloads Also available: [Markdown version](https://cubibase.com/docs/storage/downloads.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every download streams through the engine and is metered byte-accurately against the account’s monthly bandwidth. Public URLs, authorized reads, and signed links all use the same metered path. ## Public files Objects in public buckets are readable by logical path with only the publishable key. The route is stable and safe to embed in `` tags or share. Private buckets return `404` on this route — they look absent, not forbidden. **Public read** ```http GET https://example-project.api.cubibase.com/storage/v1/public/avatars/images/mika.png apikey: cb_pub_EXAMPLE_ONLY ``` ## Private files Read private objects by id with an end-user JWT or a secret API key. `GET /storage/v1/objects/{id}` returns metadata only; the bytes come from `/content`. **Authorized read** ```http GET https://example-project.api.cubibase.com/storage/v1/objects//content apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ## Signed download links To share a private file without sharing credentials, sign it. The token is scoped to exactly one object, expires after a short deployment-configured lifetime (5 minutes by default), and cannot open any other object. Anyone with the link can read that one file until expiry — and the download counts against bandwidth like any other. **Sign an object** ```http POST https://example-project.api.cubibase.com/storage/v1/objects//sign apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer Content-Type: application/json {} ``` The response’s `url` is the download URL with the token attached: `/storage/v1/objects/{id}/content?token=…`. Expired or tampered tokens are rejected with `401`. ## Ranges, cancellation, and metering - `Range: bytes=start-end` is supported and returns `206` with a truthful `Content-Range`. Only the requested bytes are billed. - A canceled download is billed only for the bytes actually delivered; the rest of the reservation is refunded. - If the remaining monthly budget is smaller than the file, the engine delivers a partial `206` response capped at the budget, then refuses further downloads with `402`. - There are no presigned S3 GET URLs anywhere in the platform: every billable byte passes the meter. > **note**: Engine-proxied delivery is the current design so quota enforcement is real-time. A CDN/edge delivery path that preserves the same accounting is planned future work. ## Deleting objects Deletion requires write authorization. The engine removes the bytes from S3 first and only then decrements usage and records the deletion event — usage never drops for a file that still exists. **Delete** ```http DELETE https://example-project.api.cubibase.com/storage/v1/objects/ apikey: cb_pub_EXAMPLE_ONLY Authorization: Bearer ``` ## Additional resources - [Quotas and errors](https://cubibase.com/docs/storage/quotas) Bandwidth limits and reset behavior. - [Storage security](https://cubibase.com/docs/storage/security) Token scoping and isolation. --- # Storage quotas and errors Source: https://cubibase.com/docs/storage/quotas Also available: [Markdown version](https://cubibase.com/docs/storage/quotas.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every storage limit is enforced on the server before the operation happens. By default quotas are hard stops, never automatic charges, and reaching one never deletes a file. Paid plans can opt in to metered additional usage with a spending limit. ## Limits per plan | Quota | Free | Pro | Business | | --- | --- | --- | --- | | Object storage (organization, shared) | 2 GB | 100 GB | 250 GB | | Monthly total bandwidth (organization; API + file delivery) | 15 GB | 500 GB | 750 GB | | Monthly API bandwidth sublimit (organization) | 5 GB | 25 GB | 100 GB | | Monthly file download requests (organization) | 100,000 | 250,000 | 2,000,000 | | Monthly storage write operations (organization) | 10,000 | 100,000 | 300,000 | | Maximum file size | 50 MB | 1 GB | 5 GB | Sizes use binary units: 1 GB = 1024 MB = 1,073,741,824 bytes. Object storage is one shared organization capacity across all projects; it is checked atomically when an upload reserves bytes, so concurrent uploads cannot race past it. Bandwidth, download requests and write operations reset with the organization’s billing cycle. Buying additional projects does not increase these shared quotas. ## Behavior at the limits | Limit reached | Blocked | Still available | | --- | --- | --- | | Organization storage | New uploads | Downloads (within bandwidth), deletions, upgrades | | Monthly bandwidth | Further downloads | Metadata, listings, uploads, deletions | | Maximum file size | That upload | Smaller files | | Downgrade below usage | New uploads until usage fits | All existing files, downloads within the new bandwidth | > **note**: Deleting objects frees capacity immediately. Upgrading raises the limits on the same project — nothing is migrated or deleted. ## Error codes Quota and access failures return the platform error envelope with a stable machine-readable code and details describing the limit and current consumption. **402 · quota exceeded** ```text HTTP/1.1 402 Payment Required { "error": { "code": "STORAGE_PROJECT_QUOTA_EXCEEDED", "message": "Project storage limit reached…", "details": { "quota": "storage_project_bytes", "limit": 1073741824, "used": 1073741824 } } } ``` | Status | Code | Meaning | | --- | --- | --- | | `402` | `STORAGE_PROJECT_QUOTA_EXCEEDED` | A legacy per-project storage cap is full (grandfathered plans) | | `402` | `STORAGE_ACCOUNT_QUOTA_EXCEEDED` | The organization’s shared storage capacity is full | | `413` | `STORAGE_FILE_TOO_LARGE` | The file exceeds the plan or bucket maximum | | `402` | `STORAGE_BANDWIDTH_QUOTA_EXCEEDED` | The monthly total bandwidth budget (API + file delivery) is exhausted | | `403` | `STORAGE_BUCKET_ACCESS_DENIED` | The caller cannot access this bucket | | `410` | `STORAGE_UPLOAD_EXPIRED` | The upload session expired; start a new one | | `404` | `STORAGE_OBJECT_NOT_FOUND` | No such object — or it is private and you cannot see it | | `409` | `storage_object_exists` | The path is taken; pass `overwrite: true` to replace | | `415` | `storage_mime_not_allowed` | The MIME type is not in the bucket allowlist | Private objects never leak their existence: an unauthorized caller gets the same `404` as for a missing object. ## Additional resources - [Platform quotas](https://cubibase.com/docs/platform/quotas) Database and end-user limits alongside storage. - [Pricing](https://cubibase.com/pricing) The published numbers per plan. --- # Storage security Source: https://cubibase.com/docs/storage/security Also available: [Markdown version](https://cubibase.com/docs/storage/security.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Storage reuses the platform’s identity and authorization model. Project isolation, path safety, and token scoping are enforced on the server, not delegated to the client. ## Project and tenant isolation - The project is resolved from the request host and the API key — a client-supplied project id is never authoritative. - Physical S3 keys are namespaced by project and bucket uuids; the catalog lives in each project’s own database. - A key from one project presented to another project’s host is rejected. - Secret API keys are privileged within their project only: they cannot cross projects, bypass quotas, or skip audit logging. ## Path and key safety - Logical paths are validated: relative only, no `..` segments, no backslashes, no control characters, no empty or dot segments, no leading or trailing slash. - Filenames never become S3 keys. The physical key is an opaque platform-generated identifier, so path tricks cannot reach another object. - Upload policies pin one exact staging key and the exact declared size; a leaked policy cannot write anywhere else or store more bytes than were reserved. - Staging objects are never publicly downloadable and are cleaned up on expiry. ## Tokens and credentials - Signed download tokens are scoped to one object and one project, expire quickly, and are verified server-side; tampered or expired tokens fail with `401`. - AWS credentials never reach clients. The S3 bucket blocks all public access, enforces TLS-only access and server-side encryption, and is reachable only through the engine’s least-privilege IAM role. - Public buckets expose read-only object bytes — never listings of private metadata, never write paths. > **important**: Treat secret API keys like database passwords: server-side only. For browser and mobile clients use the publishable key plus end-user JWTs, and signed links for sharing. ## Additional resources - [API keys](https://cubibase.com/docs/platform/api-keys) Publishable versus secret keys. - [Downloads and sharing](https://cubibase.com/docs/storage/downloads) Signed links in practice. --- # Object events Source: https://cubibase.com/docs/storage/events Also available: [Markdown version](https://cubibase.com/docs/storage/events.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every committed object change records a durable, versioned event in the project database. CubiBase Functions can subscribe to these events through storage triggers. ## The event contract Three event types are defined: `storage.object.created`, `storage.object.updated`, and `storage.object.deleted`. Each event is schemaVersion 1 and carries identity and metadata — never file contents or credentials. **storage.object.created** ```json { "schemaVersion": 1, "eventId": "3f7a…", "eventType": "storage.object.created", "projectId": "4c8d…", "bucketId": "a11b…", "objectId": "9b1e…", "path": "images/mika.png", "sizeBytes": 182344, "mimeType": "image/png", "actorId": "user_mika", "source": "storage-api", "correlationId": "f2c6…", "timestamp": "2026-11-20T10:05:00.000Z" } ``` | Field | Meaning | | --- | --- | | `eventId` | Unique id; consumers deduplicate on it | | `projectId` / `bucketId` / `objectId` | The exact identities involved | | `path` / `sizeBytes` / `mimeType` | Logical path and verified metadata | | `actorId` / `source` | Who made the change: user id or null; `storage-api`, `console`, `edge-function`, or `system` | | `correlationId` | Ties the event to the upload session or request | | `timestamp` | ISO-8601 commit time | ## Durability and delivery - Events are written to a transactional outbox in the same database transaction as the catalog change — an event exists if and only if the change committed. - A failed or expired upload never emits a creation event. - Delivery is at-least-once with retries and exponential backoff; exhausted retries land in a queryable dead-letter state, never silently discarded. - Consumers must be idempotent on `eventId`. The schema is versioned so future fields (causation, invocation depth) can be added without breaking consumers. ## Processing events with CubiBase Functions CubiBase Functions subscribe to these events through storage triggers configured in the Console — pick a bucket, the event types (created, updated, deleted), and an optional key prefix. The event is delivered asynchronously after the storage operation commits, with at-least-once semantics, retries, and dead-letter handling. The handler contract and a working example are on the Storage event functions page. Functions read source objects and write derived objects through the scoped CubiBase Storage API with a short-lived, single-invocation credential. Function-created objects count toward the same project and account quotas through the same service, and processing traffic is distinguished from external delivery without creating an accounting bypass. Recursion is bounded by invocation-depth tracking: events caused by a function carry `causationId` and a depth counter, and chained function-triggered executions stop at a fixed maximum depth. Typical scenarios: generate image thumbnails on upload, process PDFs into derived files or application data, and run scheduled cleanup of expired files — all through the same authorization and quota machinery as any other client. The Image Processing and Scheduled Cleanup templates start from working code. > **note**: The `source` field keeps the wire value `edge-function` for events caused by function executions — it is a stable enum from the original event contract, not a claim of globally distributed edge execution. CubiBase Functions run in a regional managed runtime. ## Additional resources - [Storage overview](https://cubibase.com/docs/storage) The API surface today. - [Storage event functions](https://cubibase.com/docs/functions/storage-events) Handlers for object events. - [Storage feature page](https://cubibase.com/features/storage) The product-level story. --- # Functions overview Source: https://cubibase.com/docs/functions Also available: [Markdown version](https://cubibase.com/docs/functions.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) TypeScript and JavaScript functions that run in an isolated managed runtime — never inside the CubiBase engine. Four trigger types, one execution pipeline, one set of quotas and logs. ## What CubiBase Functions are A CubiBase Function is your code, deployed as an immutable version to a managed Node.js 22 runtime (AWS Lambda in production; an isolated child process in local development). The engine manages deployments, triggers, secrets and metering, but never executes your code in its own process. > **Not SQL Functions**: PostgreSQL SQL/PLpgSQL functions run inside your project database and are managed under Database → SQL Functions. CubiBase Functions are separate: TypeScript/JavaScript in the managed runtime, managed under Functions. Database Event Triggers connect the two worlds — they invoke a CubiBase Function after a committed database change. | Trigger | When it runs | Delivery | | --- | --- | --- | | HTTP | A request hits https://{slug}.api.cubibase.com/functions/{name} | Synchronous request/response | | Database | After an INSERT, UPDATE or DELETE commits on a subscribed table | Async, at-least-once, retried | | Storage | After an object is created, updated or deleted in a subscribed bucket | Async, at-least-once, retried | | Scheduled | A cron expression fires (UTC or a configured timezone) | Async, at-least-once, retried | All four categories produce the same invocation envelope and pass through the same authorization, quota reservation, concurrency control, metering and logging. There is no per-trigger side channel that skips enforcement. ## The programming model Default-export an async handler `(request, ctx)`. Return a web `Response`, a `{ status, headers, body }` object, a plain object (serialized as JSON), a string, or nothing (204). **index.ts** ```text // index.ts — default-export an async (request, ctx) handler. export default async function handler(request: any, ctx: any) { const name = request.query.name ?? 'world'; console.log('Saying hello to', name); return new Response(JSON.stringify({ message: `Hello, ${name}!`, invocationId: ctx.invocationId, }), { status: 200, headers: { 'content-type': 'application/json' } }); } ``` | On `request` | Meaning | | --- | --- | | `method`, `url`, `headers`, `query` | The HTTP request as received by the gateway | | `body` | A Buffer with the EXACT raw request bytes (HTTP triggers) — safe for signature verification | | `json()` / `text()` | Parse helpers over the raw body | | `event` | The structured payload for database, storage and scheduled triggers | | `trigger` | `http`, `database`, `storage`, `schedule` or `test` | | `auth` | The verified caller context (kind and user id, when authenticated) | | `invocationId`, `correlationId` | Identifiers that appear in Executions & Logs | | On `ctx` | Meaning | | --- | --- | | `ctx.db.from(table)` | Scoped select / insert / update / delete with equality filters, through the project’s own roles and policies. JWT-authenticated HTTP calls run under the caller’s row-level security; trusted database, storage and scheduled invocations run with the project’s developer-level access | | `ctx.db.query(sql, params)` | Read-only parameterized SQL through the project’s SQL role | | `ctx.storage.from(bucket)` | upload, download, getMetadata, remove, list — through the same Storage quotas and events | | `ctx.env` | Your environment variables and secrets for this deployment (frozen snapshot) | | `ctx.log`, `console.*` | Captured into the bounded, redacted execution log | | `ctx.waitUntil(promise)` | Background work with at most 5 extra seconds after the response | > **note**: The runtime holds no AWS credentials, no database passwords and no other project’s data. The only platform credential is a token scoped to this single invocation, valid for minutes. Database and storage access goes through scoped CubiBase service APIs. ## Deployments and versions - Editing source in the Console changes the working copy only. Deploy builds and publishes an immutable version. - Bundling uses esbuild to transform your code — build scripts are never executed and no per-deploy npm install runs. - Imports are limited to Node built-ins and a pinned dependency allowlist (currently the official Stripe SDK). Other imports fail the build with a clear error. - Artifacts are stored in a private S3 bucket; the database keeps only references and checksums. - A successful deploy atomically switches the active pointer. A failed deploy never interrupts the version that is serving. - Activate any earlier ready version to roll back. ## In the Console Open a project and choose Functions. My Functions lists every function with its triggers, deployment state and error rate. The editor has tabs for Source, Triggers, Security & Config, Secrets & Env, Deployments, Test and Logs. Executions & Logs shows every invocation across all trigger types; Usage & Quotas shows consumption against your plan. - [HTTP functions](https://cubibase.com/docs/functions/http) Endpoints, auth modes and calling conventions. - [Database events](https://cubibase.com/docs/functions/database-events) After-commit triggers with an outbox. - [Storage events](https://cubibase.com/docs/functions/storage-events) React to object lifecycle changes. - [Scheduled functions](https://cubibase.com/docs/functions/schedules) Cron without a scheduler of your own. ## Additional resources - [Functions feature page](https://cubibase.com/features/functions) The product-level story. - [Templates](https://cubibase.com/docs/functions/templates) Eight working starting points. - [Quotas and metering](https://cubibase.com/docs/functions/quotas) What is counted and what happens at a limit. --- # HTTP functions Source: https://cubibase.com/docs/functions/http Also available: [Markdown version](https://cubibase.com/docs/functions/http.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every deployed function with an HTTP trigger is an HTTPS endpoint at https://{slug}.api.cubibase.com/functions/{name}. The gateway enforces authentication, signatures and limits before your code runs. ## The endpoint GET, POST, PUT, PATCH, DELETE and OPTIONS are supported. Headers, query parameters, extra path segments and the raw body reach your handler unchanged. The response your handler returns is the response the caller receives (bounded by the platform response-size limit). **Call a public function** ```http curl "https://example-project.api.cubibase.com/functions/hello-world?name=Ada" # {"message":"Hello, Ada!","invocationId":"…"} ``` > **note**: The raw body is preserved byte-for-byte. Never re-serialize a parsed body before verifying a webhook signature — verify against request.body. ## Authentication modes Authentication is a gateway setting, independent of your code and of payload signatures. JWT is the default when you create a function. | Mode | Caller must present | Use for | | --- | --- | --- | | `jwt` (default) | Authorization: Bearer from CubiBase Auth | Calls from your signed-in users | | `public` | Nothing | Webhooks and open endpoints — pair with signature verification | | `api_key` | A project secret API key (cb_sec_…) in the apikey header or as Bearer | Server-to-server calls from trusted code | | `internal` | Not externally reachable at all | Functions invoked only by other CubiBase machinery | **JWT mode · call as a signed-in user** ```http curl -X POST "https://example-project.api.cubibase.com/functions/openai-proxy" \ -H "Authorization: Bearer " \ -H "content-type: application/json" \ -d '{"prompt": "Summarize row-level security in one sentence."}' ``` **API key mode · call from your server** ```http curl -X POST "https://example-project.api.cubibase.com/functions/send-email" \ -H "apikey: cb_sec_YOUR_SECRET_KEY" \ -H "content-type: application/json" \ -d '{"to": "ada@example.com", "subject": "Welcome", "text": "Glad you are here."}' ``` > **Secret keys stay server-side**: API-key mode requires the secret key (cb_sec_…), not the publishable key. Never ship a secret key in a browser or mobile bundle. An internal-mode function answers 404 on the public host. ## Gateway responses | Status | When | | --- | --- | | `401` | Missing/invalid JWT, missing/invalid secret key, or a failed signature check | | `404` | Unknown project host, unknown function, no enabled HTTP trigger, or internal-only function | | `409` | The function is disabled, or has no active deployment yet | | `413` | The request body exceeds the platform request-size limit | | `402` | The monthly invocation or compute allowance is exhausted | | `429` | The per-project HTTP rate limit or concurrent-execution limit is reached — retry shortly | | `500` | The function threw or exceeded its configured timeout (status recorded as timeout) — details are in Executions & Logs, not in the caller response | | `502` | The function returned an oversized response | Internal errors never leak infrastructure details to the caller. The invocation id in the error body matches the execution record in the Console. ## Additional resources - [Signed payloads](https://cubibase.com/docs/functions/signatures) HMAC verification and third-party webhooks. - [Templates](https://cubibase.com/docs/functions/templates) Stripe and GitHub webhook starting points. --- # Signed payloads and webhooks Source: https://cubibase.com/docs/functions/signatures Also available: [Markdown version](https://cubibase.com/docs/functions/signatures.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Payload signature verification is independent of caller authentication. Use built-in CubiBase HMAC-SHA256 for your own senders, or verify a provider’s scheme (Stripe, GitHub) inside your function against the exact raw body. ## Three signature settings | Setting | Verified by | Use for | | --- | --- | --- | | `none` | Nobody — authentication mode still applies | JWT/API-key protected endpoints | | `hmac` | The gateway, before your code runs | Your own servers and services sending webhooks | | `custom` | Your function code, using request.body and request.headers | Stripe, GitHub and other providers with their own schemes | > **important**: A JWT or API key proves who called — not that the payload is intact. For public webhook endpoints, always require a signature: built-in HMAC for your senders, provider-specific verification for third parties. ## Built-in HMAC-SHA256 When HMAC mode is enabled, the gateway rejects any request without a valid signature. The signed input is `timestamp + "." + nonce + "." + rawBody`, HMAC-SHA256 with the function’s signing secret, hex-encoded. | Header | Value | | --- | --- | | `x-cubibase-timestamp` | Unix seconds; must be within the tolerance window (default 300 s) | | `x-cubibase-nonce` | 16–128 chars of [A-Za-z0-9._-], single use per function | | `x-cubibase-signature` | hex(HMAC_SHA256(secret, `${timestamp}.${nonce}.${rawBody}`)) | **Sign a delivery from your server** ```ts import { createHmac, randomBytes } from 'node:crypto'; const body = JSON.stringify({ order: 4711, total: 4200 }); const timestamp = String(Math.floor(Date.now() / 1000)); const nonce = randomBytes(16).toString('hex'); // 16–128 chars, single use const signature = createHmac('sha256', process.env.CUBIBASE_SIGNING_SECRET) .update(`${timestamp}.${nonce}.`) .update(body) // EXACT raw bytes you send — never re-serialize .digest('hex'); await fetch('https://example-project.api.cubibase.com/functions/orders-hook', { method: 'POST', headers: { 'content-type': 'application/json', 'x-cubibase-timestamp': timestamp, 'x-cubibase-nonce': nonce, 'x-cubibase-signature': signature, }, body, }); ``` - Comparison is constant-time; the timestamp must be fresh; each nonce can be used once — replays are rejected with 401 signature_replayed. - The signing secret is shown once when you enable HMAC or rotate it, and stored encrypted. It is never returned by read APIs and never logged. - Rotation keeps the previous secret valid, so senders can roll over without dropped deliveries. ## Stripe, GitHub and other providers Third parties cannot satisfy a CubiBase-specific format, and the platform does not force one on them. Set authentication to public and signature mode to custom, then verify the provider’s own header inside your handler using request.body (the exact raw bytes) and request.headers. - Stripe: verify Stripe-Signature (t=timestamp, v1=HMAC) with your whsec_… signing secret, stored as STRIPE_WEBHOOK_SECRET. The Stripe Webhook template does this with the official SDK and handles event idempotency. - GitHub: verify X-Hub-Signature-256 (sha256=HMAC of the raw body) with the secret you configured on the hook. The GitHub Webhook template is ready to edit. - Reject invalid signatures with a 4xx before any side effects. Return a fast 2xx only after the work (or its durable record) succeeded. ## Additional resources - [Templates](https://cubibase.com/docs/functions/templates) The Stripe and GitHub handlers, ready to deploy. - [Secrets](https://cubibase.com/docs/functions/secrets) Where signing secrets live. --- # Database event functions Source: https://cubibase.com/docs/functions/database-events Also available: [Markdown version](https://cubibase.com/docs/functions/database-events.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Run a CubiBase Function after an INSERT, UPDATE or DELETE commits on a table you choose. Events are captured atomically with your data change and delivered asynchronously — a function failure can never roll back your transaction. ## Configure a trigger In the function editor open Triggers → Add trigger → Database events. Pick the table (public schema in the current release) and the operations; optionally include the previous record for UPDATE/DELETE. The platform installs a generated PostgreSQL trigger that writes to a transactional outbox (`functions.events_outbox`) in your project database — you never write trigger SQL yourself. **Trigger configuration** ```json { "kind": "database", "config": { "schema": "public", "table": "orders", "events": ["INSERT", "UPDATE", "DELETE"], "includeOldRecord": true } } ``` - One function can subscribe to several tables; one table can feed several functions. - Schema and table identifiers are validated; the generated trigger SQL is injection-safe. - Removing the subscription drops the installed PostgreSQL trigger. - Events are captured only for committed transactions — a rolled-back write produces no event. ## The event payload **request.event · database.insert** ```text // request.event on a database trigger (schemaVersion 1) { "schemaVersion": 1, "eventId": "8c1f…", "type": "database.insert", "projectId": "4c8d…", "schema": "public", "table": "orders", "operation": "INSERT", "newRecord": { "id": "…", "total": 4200, "user_id": "…" }, "oldRecord": null, "actorUserId": "user_ada", "timestamp": "2026-11-20T10:05:00.000Z", "correlationId": "…" } ``` `oldRecord` is null unless you enabled “include previous record”. `actorUserId` carries the end-user id when the write came through the Data API with a user JWT. ## Delivery semantics - At-least-once: a delivery can repeat after a retry. Deduplicate on eventId — the template shows the pattern. - Retries use exponential backoff; exhausted deliveries land in a queryable dead-letter state (Executions & Logs → Delivery queue). - Function writes go through the same scoped database access as any invocation; recursion depth is capped. - Outbox rows are cleaned up on a retention schedule; inactive projects are not polled without bound. **Idempotent change handler** ```ts export default async function handler(request: any, ctx: any) { const event = request.event; // At-least-once delivery: skip work you already did for this eventId. const seen = await ctx.db.from('processed_events').select({ event_id: event.eventId }); if (seen.rows?.length > 0) return { duplicate: true }; const record = event.operation === 'DELETE' ? event.oldRecord : event.newRecord; await ctx.db.from('audit_log').insert([{ table_name: event.table, operation: event.operation, event_id: event.eventId, record_id: String(record?.id ?? ''), occurred_at: event.timestamp, }]); await ctx.db.from('processed_events').insert([{ event_id: event.eventId }]); return { ok: true }; } ``` > **note**: This is not a synchronous constraint mechanism. If a rule must block the write itself, use a PostgreSQL constraint or a native database trigger (Database → Database Triggers). CubiBase Functions react after commit. ## Additional resources - [Native database triggers](https://cubibase.com/docs/database/triggers) Synchronous SQL triggers, a different tool. - [Templates](https://cubibase.com/docs/functions/templates) Database Change Handler and Send Email. --- # Storage event functions Source: https://cubibase.com/docs/functions/storage-events Also available: [Markdown version](https://cubibase.com/docs/functions/storage-events.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Run a CubiBase Function when an object is created, updated or deleted in a bucket you choose. Events come from the existing Storage event stream — only successfully completed operations emit them. ## Configure a trigger In the function editor open Triggers → Add trigger → Storage events. Pick the bucket, the lifecycle events, and optionally an object-key prefix filter. **Trigger configuration** ```json { "kind": "storage", "config": { "bucket": "images", "events": ["storage.object.created"], "prefix": "uploads/" } } ``` | Event | Fires when | | --- | --- | | `storage.object.created` | An upload was verified and finalized | | `storage.object.updated` | An existing path was replaced (explicit overwrite) | | `storage.object.deleted` | An object was deleted | - A failed, abandoned or expired upload never emits an event. - The payload carries bucket, object id, path, size, MIME type, actor and timestamp — never file contents. - Read and write files through ctx.storage; every function write counts toward the same storage and bandwidth quotas and emits its own events. ## Process an upload **Derivative writer** ```ts export default async function handler(request: any, ctx: any) { const event = request.event; // storage.object.created, schemaVersion 1 console.log('New object:', event.path, event.sizeBytes, 'bytes'); const source = await ctx.storage.from(event.bucketName).download(event.path); // ...transform source.body (a Buffer) here... // Write derivatives to a DIFFERENT prefix so this function does not // re-trigger itself. Function writes count toward the same quotas. await ctx.storage.from(event.bucketName).upload( event.path.replace(/^uploads\//, 'processed/'), source.body, { mimeType: source.mimeType, overwrite: true }, ); return { processed: event.path }; } ``` > **Avoid trigger loops**: A function that writes into the same bucket and prefix it watches would re-trigger itself. Keep input and output prefixes separate (uploads/ → processed/). As a backstop, the platform tracks invocation depth and drops chains beyond the configured cap — but filtering is the correct fix. ## Delivery semantics The same durable queue as database events: at-least-once delivery, dedupe on eventId, exponential-backoff retries, dead-letter state after exhaustion. The event contract is shared with the Storage events documentation. ## Additional resources - [Storage event contract](https://cubibase.com/docs/storage/events) The schemaVersion 1 payload in full. - [Templates](https://cubibase.com/docs/functions/templates) Image Processing starts from this pattern. --- # Scheduled functions Source: https://cubibase.com/docs/functions/schedules Also available: [Markdown version](https://cubibase.com/docs/functions/schedules.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Run a function on a cron schedule without operating a scheduler. Each schedule trigger owns exactly one cron entry; runs pass through the same quotas, logging and retries as every other trigger. ## Configure a schedule In the function editor open Triggers → Add trigger → Scheduled. Provide a standard 5-field cron expression and a timezone (UTC by default, any IANA name accepted). **Trigger configuration · 03:00 UTC daily** ```json { "kind": "schedule", "config": { "cron": "0 3 * * *", "timezone": "UTC" } } ``` - The trigger row shows the last run (with its outcome) and the next scheduled run. - Editing a schedule replaces it in place — deployments never create duplicate active schedules. - Disabling the trigger stops future runs immediately; deleting it removes the schedule. - The number of enabled schedules per project is plan-limited. ## The tick payload and missed runs The handler receives `request.event` of type `schedule.tick` with the cron expression, the scheduled time and the timezone. If the platform was down at the scheduled moment, missed runs collapse into a single catch-up run rather than a burst. **Nightly cleanup** ```ts export default async function handler(request: any, ctx: any) { // request.event.type is 'schedule.tick'; the cron cursor already advanced. // Equality filters only in ctx.db — for time ranges, find ids with // read-only SQL, then delete by primary key. const stale = await ctx.db.query( "SELECT id FROM public.sessions WHERE expires_at < now() - interval '30 days' LIMIT 500", ); let deleted = 0; for (const row of stale.rows ?? []) { await ctx.db.from('sessions').delete({ id: row.id }); deleted += 1; } console.log('Cleanup deleted', deleted, 'rows'); return { deleted }; } ``` > **note**: Scheduled invocations are metered exactly like HTTP calls. An exhausted monthly allowance rejects the run (it is retried, then dead-lettered) — a scheduler cannot bypass your quota. ## Additional resources - [Templates](https://cubibase.com/docs/functions/templates) Scheduled Cleanup is a working nightly job. - [Quotas](https://cubibase.com/docs/functions/quotas) Schedule counts and metering. --- # Environment variables and secrets Source: https://cubibase.com/docs/functions/secrets Also available: [Markdown version](https://cubibase.com/docs/functions/secrets.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Per-function configuration in two classes: plain environment variables for non-sensitive values, and encrypted secrets for credentials. Both reach your code as ctx.env at invocation time. ## Variables vs secrets | | Environment variables | Secrets | | --- | --- | --- | | Visible in the Console | Yes, to project members | Names and timestamps only — never values | | Storage | Function metadata | Encrypted at rest in the platform secrets store | | Use for | Model names, sender addresses, feature flags | API keys, webhook signing secrets, tokens | | In code | ctx.env.NAME | ctx.env.NAME (identical) | - Names use uppercase letters, digits and underscores; a name cannot be both a variable and a secret. - Platform-reserved prefixes (CUBIBASE_, AWS_) are rejected for your own values. - Saving a secret again under the same name rotates it. Deleting one destroys the encrypted value. - Values are snapshotted into each deployment. After changing configuration, redeploy so the active version picks it up — the Console tells you when this is needed. ## What never happens - Secret values are never returned by read APIs, never included in deployment logs, and never sent to the browser after the initial save. - Execution logs are redacted: authorization headers, bearer tokens, API keys and common credential patterns are masked before storage. - One function cannot read another function’s secrets, and no function can read another project’s anything. - The HMAC signing secret is separate from your named secrets, shown once at creation/rotation, with the previous secret kept valid during rollover. > **warning**: Do not paste credentials into source code. Source is readable by every project member and is stored as the editable working copy. Use the Secrets tab. ## Additional resources - [Signed payloads](https://cubibase.com/docs/functions/signatures) Managing the HMAC signing secret. - [Templates](https://cubibase.com/docs/functions/templates) Each template lists its required secrets. --- # Function templates Source: https://cubibase.com/docs/functions/templates Also available: [Markdown version](https://cubibase.com/docs/functions/templates.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Eight versioned starting points with working code, preselected triggers and security defaults, and step-by-step setup instructions. Everything they generate is editable. ## The catalog | Template | Trigger | What it does | Required secrets | | --- | --- | --- | --- | | Hello World | HTTP | JSON greeting; the smallest possible function | — | | Stripe Webhook | HTTP (public, custom signature) | Verifies Stripe-Signature on the raw body; idempotent payment/subscription handling | STRIPE_WEBHOOK_SECRET (STRIPE_SECRET_KEY optional) | | GitHub Webhook | HTTP (public, custom signature) | Verifies X-Hub-Signature-256 for push and issue events | GITHUB_WEBHOOK_SECRET | | Send Email | HTTP (API key) or Database | Transactional email through the Resend API | RESEND_API_KEY + EMAIL_FROM variable | | OpenAI Proxy | HTTP (JWT) | Server-side OpenAI calls so your key never ships to browsers | OPENAI_API_KEY | | Image Processing | Storage | Processes new uploads, writes derivatives to a separate prefix | — | | Database Change Handler | Database | Audit logging for INSERT/UPDATE/DELETE, deduped on eventId | — | | Scheduled Cleanup | Scheduled | Nightly removal of expired rows; edit to your schema | — | In the Console, Functions → Templates shows the catalog with code previews. “Use template” preselects the trigger type, authentication mode, signature mode, timeout and memory, and walks you through the required secrets and external configuration. ## Stripe Webhook, end to end 1. **Create from the template** — The function is created with public authentication and custom signature mode — Stripe cannot send a CubiBase JWT, and no CubiBase HMAC is forced on it. 2. **Create the dedupe table** — CREATE TABLE stripe_events (id text PRIMARY KEY, type text, processed_at timestamptz); — the handler records every processed event id. 3. **Deploy and copy the URL** — The function URL is https://{slug}.api.cubibase.com/functions/{name}. Deploy first; the endpoint is live only after a successful deployment. 4. **Configure Stripe** — Stripe Dashboard → Developers → Webhooks → Add endpoint. Paste the URL; subscribe to payment_intent.succeeded and customer.subscription.deleted (or your events). 5. **Store the signing secret** — Copy the endpoint’s signing secret (whsec_…) into the STRIPE_WEBHOOK_SECRET secret and redeploy. Optionally set STRIPE_SECRET_KEY to use the official SDK verification path. 6. **Verify with a test event** — Send a test event from the Dashboard and check Executions & Logs. The integration is connected only when a signed test delivery succeeds — the Console never claims otherwise. > **note**: The handler verifies the signature against the exact raw bytes, rejects invalid signatures with 400, skips already-processed event ids, and returns a fast 200 so Stripe does not retry unnecessarily. ## Additional resources - [HTTP functions](https://cubibase.com/docs/functions/http) Auth modes for webhook endpoints. - [Secrets](https://cubibase.com/docs/functions/secrets) Storing provider credentials safely. --- # Executions and logs Source: https://cubibase.com/docs/functions/logs Also available: [Markdown version](https://cubibase.com/docs/functions/logs.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every invocation — HTTP, database, storage, scheduled and test — produces one execution record with timing, outcome and captured console output. Logs are bounded, redacted and isolated per project. ## What is recorded | Field | Meaning | | --- | --- | | Invocation id / correlation id | Trace one run end to end; async events also carry their eventId | | Trigger and deployment version | Which trigger fired and which immutable version ran | | Status | success, error, timeout, rejected (quota), or running | | Duration and billed duration | Wall time and the metered time (100 ms floor, rounded up to 100 ms, capped at the timeout) | | Memory | Configured MB and peak RSS when available | | HTTP status | For HTTP and test invocations | | Error category and message | Redacted; infrastructure details never reach callers | - console.log/info/warn/error are captured per execution: at most 200 lines, 4 KB per line, 64 KB total — the record flags truncation. - Credentials are redacted before storage: authorization headers, bearer tokens, cb_sec_/cb_pub_ keys, JWTs, sk_live/sk_test and whsec_ patterns. - Retention is plan-based (3 days Free, 14 Pro, 30 Business); older records are purged automatically. ## Finding a run Functions → Executions & Logs lists executions with filters for function, trigger and status, plus pagination. Open a row for the full record and its log output. The Delivery queue view shows pending, retried and dead-lettered async events. Each function’s Logs tab shows the same data scoped to that function. There is no live streaming — refresh to see new runs. ## Additional resources - [Quotas and metering](https://cubibase.com/docs/functions/quotas) How durations become GB-seconds. --- # Function quotas and metering Source: https://cubibase.com/docs/functions/quotas Also available: [Markdown version](https://cubibase.com/docs/functions/quotas.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Functions use the same subscription and plan catalog as the rest of CubiBase. Limits are enforced by the engine on every trigger type — never only in the Console. ## What is limited | Dimension | Scope | At the limit | | --- | --- | --- | | Functions per project | Project | Creating another function is refused (402) | | Invocations | Organization (shared), per billing cycle | Invocations rejected (402); async events retry, then dead-letter | | Compute (GB-seconds) | Organization (shared), per billing cycle | Same as invocations | | Memory per function | Plan ceiling | Configuration above the ceiling is refused | | Concurrent executions | Project | HTTP callers get 429; async events wait and retry | | Deployment artifact size | Per deployment | The build fails; the active version keeps serving | | Enabled schedules | Project | Creating another schedule is refused | | Execution log retention | Plan | Older records are purged | Monthly allowances are organization-level, shared across all projects, and follow the existing billing cycle: the Stripe period for paid plans, the calendar month (UTC) for Free — the same convention as storage bandwidth. Buying additional projects does not increase them. Counters are reserved atomically, so concurrent invocations cannot race past a limit. ## What is counted - Every executed invocation counts — success, failure and timeout alike. Requests rejected by the gateway (auth, signature, quota, concurrency) never reach the runtime and are not billed as invocations. - Compute is GB-seconds: configured memory (GB) × billed duration. Billed duration is the handler time rounded up to 100 ms increments, floored at 100 ms and capped at the configured timeout. - All four trigger types and Console test invocations meter identically. **Allowance exhausted** ```text HTTP/1.1 402 Payment Required { "error": { "code": "FUNCTIONS_QUOTA_EXCEEDED", "message": "Monthly invocation allowance exhausted…", "details": { "quota": "functions_invocations_monthly", "limit": 100000, "used": 100000 } } } ``` ## Current plan values > **Shared organization quotas**: Function invocations and compute are shared across all projects in your organization; buying additional projects does not increase them. Function count, concurrency and schedules are per project. The values below come from the published pricing catalog; the Console’s Usage page always shows the live values for your plan. | | Free | Pro | Business | | --- | --- | --- | --- | | Functions per project | 5 | 25 | 100 | | Invocations per month (shared) | 500,000 | 2,000,000 | 6,000,000 | | Compute per month (shared) | 10,000 GB-s | 50,000 GB-s | 300,000 GB-s | | Execution timeout | 5 sec | 30 sec | 60 sec | | Max memory per function | 128 MB | 256 MB | 512 MB | | Concurrent executions per project | 5 | 20 | 50 | | Enabled schedules per project | 2 | 10 | 50 | | Execution log retention | 3 days | 14 days | 30 days | By default there are no automatic overage charges: a quota is a hard stop, not a bill. On Pro and Business you can opt in to additional usage (Console → Billing → Additional Usage): excess invocations and compute then bill at the published rates under a monthly spending limit you set — it is never enabled for you. Upgrading raises the limits immediately; the next cycle resets monthly counters. See the pricing page for the full plan comparison and rates, and the Console at Functions → Usage & Quotas for your live usage, warnings and exceeded state. Example host: example-project.api.cubibase.com. ## Additional resources - [Pricing](https://cubibase.com/pricing) Plans and the full comparison table. - [Platform quotas](https://cubibase.com/docs/platform/quotas) How quotas work across CubiBase. --- # API routes Source: https://cubibase.com/docs/reference/routes Also available: [Markdown version](https://cubibase.com/docs/reference/routes.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every public route on the project host, plus the control paths the Console uses. Your application calls the project host — not the control API. ## Data API Base: `https://{slug}.api.cubibase.com`. Every route needs the `apikey` header and an end-user bearer token. **Data API · /rest/v1** | Method | Path | Purpose | | --- | --- | --- | | `GET` | `/rest/v1/{table}` | List rows with filters, select, order, limit, offset | | `GET` | `/rest/v1/{table}/{id}` | Read one row by primary key | | `POST` | `/rest/v1/{table}` | Insert one row · 201 | | `PATCH` | `/rest/v1/{table}/{id}` | Update one row | | `DELETE` | `/rest/v1/{table}/{id}` | Delete one row | | `POST` | `/rest/v1/rpc/{function}` | Call a function granted to the api role · named JSON arguments | ## Auth API Same host, under `/auth/v1`, with the same `apikey` header. Signup, sign-in, refresh, logout, and the Google flow do not need a bearer token; the user and factor routes do. A bearer token on authorize or the id_token grant links the Google identity to that user. **Auth API · /auth/v1** | Method | Path | Purpose | | --- | --- | --- | | `POST` | `/auth/v1/signup` | Create a user · 201 | | `POST` | `/auth/v1/signup/anonymous` | Create an anonymous session · 201 | | `POST` | `/auth/v1/token?grant_type=password` | Sign in (or an MFA challenge) | | `POST` | `/auth/v1/token?grant_type=refresh_token` | Refresh the session | | `POST` | `/auth/v1/token?grant_type=mfa` | Complete an MFA challenge | | `POST` | `/auth/v1/token?grant_type=id_token` | Verify a Google ID token | | `GET` | `/auth/v1/authorize?provider=google` | Start the Google redirect flow | | `GET` | `/auth/v1/callback` | Google redirects back here · 302 to your app | | `POST` | `/auth/v1/logout` | Revoke the session · 204 | | `GET` | `/auth/v1/user` | Read the signed-in user | | `PATCH` | `/auth/v1/user` | Update the user; convert anonymous users | | `POST` | `/auth/v1/factors` | Enroll a TOTP factor · 201 | | `POST` | `/auth/v1/factors/verify` | Confirm the first TOTP code | | `DELETE` | `/auth/v1/factors/{factorId}` | Remove a factor · 204 | ## Storage API Same host, under `/storage/v1`, with the same `apikey` header. Writes and private reads need a bearer token (end-user JWT or secret API key); public-bucket reads need only the key. Every download is metered against the account’s monthly bandwidth. **Storage API · /storage/v1** | Method | Path | Purpose | | --- | --- | --- | | `POST` | `/storage/v1/buckets` | Create a bucket · 201 | | `GET` | `/storage/v1/buckets` | List buckets | | `GET` | `/storage/v1/buckets/{bucket}` | Bucket configuration | | `PATCH` | `/storage/v1/buckets/{bucket}` | Update visibility, size cap, MIME allowlist | | `DELETE` | `/storage/v1/buckets/{bucket}` | Delete the bucket and its objects | | `POST` | `/storage/v1/objects/upload` | Start an upload · reserves quota, returns the S3 policy · 201 | | `POST` | `/storage/v1/uploads/{id}/complete` | Verify and finalize the uploaded object | | `GET` | `/storage/v1/uploads/{id}` | Upload session status | | `GET` | `/storage/v1/objects` | List objects · bucket, prefix, delimiter, search, limit, offset | | `GET` | `/storage/v1/objects/{id}` | Object metadata | | `GET` | `/storage/v1/objects/{id}/content` | Download · metered, Range supported | | `HEAD` | `/storage/v1/objects/{id}/content` | Download headers without bytes | | `POST` | `/storage/v1/objects/{id}/sign` | Short-lived signed download link | | `GET` | `/storage/v1/public/{bucket}/{path}` | Anonymous public-bucket read · metered | | `DELETE` | `/storage/v1/objects/{id}` | Delete an object | | `GET` | `/storage/v1/usage` | Project storage and bandwidth consumption | ## Functions API Same host, under `/functions/{name}`. Authentication depends on the function’s configured mode: JWT bearer token (default), secret API key, public, or internal-only (404 externally). Payload signature headers are independent — see the Signed payloads docs page. **Functions API · /functions** | Method | Path | Purpose | | --- | --- | --- | | `ALL` | `/functions/{name}` | Invoke a deployed HTTP function · GET, POST, PUT, PATCH, DELETE, OPTIONS | | `ALL` | `/functions/{name}/{path...}` | Extra path segments reach the handler unchanged | ## Control API paths (Console) These are the paths the Console uses for accounts, projects, schema, rows, SQL, keys, the auth user directory, the Database menu managers (policies, SQL functions, triggers, indexes, types, views), storage, and CubiBase Functions management. They are listed for completeness; this guide does not publish a separate public base URL for them, and your application should not call them. **Control API paths** | Method | Path | | --- | --- | | `POST` | `/v1/auth/register` | | `POST` | `/v1/auth/verify-email` | | `POST` | `/v1/auth/login` | | `POST` | `/v1/projects` | | `GET` | `/v1/projects/:id/provisioning` | | `POST` | `/v1/projects/:id/tables` | | `POST` | `/v1/projects/:id/tables/:table/exposure` | | `GET` | `/v1/projects/:id/tables/:table/rows` | | `POST` | `/v1/projects/:id/sql` | | `POST` | `/v1/projects/:id/api-keys` | | `PATCH` | `/v1/projects/:id/auth` | | `GET` | `/v1/projects/:id/auth/settings` | | `PATCH` | `/v1/projects/:id/auth/settings` | | `GET` | `/v1/projects/:id/auth/users` | | `GET` | `/v1/projects/:id/auth/sessions` | | `DELETE` | `/v1/projects/:id/auth/sessions/:sessionId` | | `GET` | `/v1/projects/:id/lifecycle` | | `POST` | `/v1/projects/:id/resume` | | `GET` | `/v1/projects/:id/backup/download` | | `GET` | `/v1/projects/:id/policies` | | `POST` | `/v1/projects/:id/policies` | | `POST` | `/v1/projects/:id/tables/:table/rls` | | `POST` | `/v1/projects/:id/tables/:table/policies/:policy` | | `DELETE` | `/v1/projects/:id/tables/:table/policies/:policy` | | `GET` | `/v1/projects/:id/sql-functions` | | `POST` | `/v1/projects/:id/sql-functions` | | `POST` | `/v1/projects/:id/sql-functions/:name/api-access` | | `DELETE` | `/v1/projects/:id/sql-functions/:name` | | `GET` | `/v1/projects/:id/db-triggers` | | `POST` | `/v1/projects/:id/db-triggers` | | `POST` | `/v1/projects/:id/tables/:table/triggers/:trigger/enabled` | | `DELETE` | `/v1/projects/:id/tables/:table/triggers/:trigger` | | `GET` | `/v1/projects/:id/indexes` | | `POST` | `/v1/projects/:id/indexes` | | `DELETE` | `/v1/projects/:id/indexes/:name` | | `GET` | `/v1/projects/:id/types` | | `POST` | `/v1/projects/:id/types/enum` | | `POST` | `/v1/projects/:id/types/composite` | | `POST` | `/v1/projects/:id/types/:name/labels` | | `POST` | `/v1/projects/:id/types/:name/labels/rename` | | `DELETE` | `/v1/projects/:id/types/:name` | | `GET` | `/v1/projects/:id/views` | | `POST` | `/v1/projects/:id/views` | | `POST` | `/v1/projects/:id/views/:name/api-access` | | `POST` | `/v1/projects/:id/views/:name/refresh` | | `DELETE` | `/v1/projects/:id/views/:name` | | `GET` | `/v1/storage/usage` | | `GET` | `/v1/projects/:id/storage/usage` | | `GET` | `/v1/projects/:id/storage/buckets` | | `POST` | `/v1/projects/:id/storage/buckets` | | `PATCH` | `/v1/projects/:id/storage/buckets/:bucket` | | `DELETE` | `/v1/projects/:id/storage/buckets/:bucket` | | `GET` | `/v1/projects/:id/storage/objects` | | `POST` | `/v1/projects/:id/storage/uploads` | | `POST` | `/v1/projects/:id/storage/uploads/:uploadId/complete` | | `GET` | `/v1/projects/:id/storage/objects/:objectId/content` | | `POST` | `/v1/projects/:id/storage/objects/:objectId/sign` | | `DELETE` | `/v1/projects/:id/storage/objects/:objectId` | | `GET` | `/v1/function-templates` | | `GET` | `/v1/projects/:id/functions` | | `POST` | `/v1/projects/:id/functions` | | `GET` | `/v1/projects/:id/functions/:name` | | `PATCH` | `/v1/projects/:id/functions/:name` | | `DELETE` | `/v1/projects/:id/functions/:name` | | `POST` | `/v1/projects/:id/functions/:name/deployments` | | `GET` | `/v1/projects/:id/functions/:name/deployments` | | `POST` | `/v1/projects/:id/functions/:name/deployments/:deploymentId/activate` | | `POST` | `/v1/projects/:id/functions/:name/secrets` | | `DELETE` | `/v1/projects/:id/functions/:name/secrets/:secretName` | | `POST` | `/v1/projects/:id/functions/:name/signature/rotate` | | `POST` | `/v1/projects/:id/functions/:name/triggers` | | `PATCH` | `/v1/projects/:id/functions/:name/triggers/:triggerId` | | `DELETE` | `/v1/projects/:id/functions/:name/triggers/:triggerId` | | `POST` | `/v1/projects/:id/functions/:name/test` | | `GET` | `/v1/projects/:id/functions/executions` | | `GET` | `/v1/projects/:id/functions/executions/:executionId` | | `GET` | `/v1/projects/:id/functions/queue` | | `GET` | `/v1/projects/:id/functions/usage` | > **note**: The server resolves the project from the Host header and never trusts X-Forwarded-Host. Additional control routes exist for login refresh, password reset, and row updates; they will be documented with the full reference. ## Additional resources - [Data API overview](https://cubibase.com/docs/data-api) Headers, envelopes, and examples. - [Authentication overview](https://cubibase.com/docs/auth) What each auth route returns. - [Error codes](https://cubibase.com/docs/reference/errors) What these routes return when something fails. --- # Error codes Source: https://cubibase.com/docs/reference/errors Also available: [Markdown version](https://cubibase.com/docs/reference/errors.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) Every error is a JSON object with a stable code, a message, and a requestId. Match on the code, not the message text. ## The error shape **Error response** ```json { "error": { "code": "missing_end_user_token", "message": "An end-user bearer token is required", "requestId": "req_example" } } ``` Some errors add a `details` field (for example, which quota was exceeded). The `requestId` appears in the project’s request logs, so you can trace a failure from the Console. ## Authentication and sessions | Status | Code | Cause and fix | | --- | --- | --- | | `401` | `missing_api_key` | Send the publishable key in the `apikey` header | | `401` | `invalid_api_key` | The key is not active for this project; check or rotate it | | `401` | `missing_end_user_token` | Send the user’s JWT as `Authorization: Bearer …` | | `401` | `invalid_token` | Expired or unverifiable JWT; refresh the session | | `401` | `session_revoked` | The session was revoked; sign in again | | `401` | `mfa_required` | The project requires an MFA-verified session | | `401` | `invalid_credentials` | Wrong email or password | | `401` | `invalid_refresh_token` | Expired, revoked, or reused refresh token; sign in again | | `401` | `invalid_challenge` | MFA challenge expired or already used | | `401` | `invalid_mfa_code` | Wrong TOTP code | | `401` | `invalid_id_token` | Google ID token failed verification or nonce check | | `403` | `user_banned` | The user is banned in the Console | | `403` | `signup_disabled` | Signup is switched off for the project | | `403` | `password_signin_disabled` | Password sign-in is switched off | | `403` | `anonymous_disabled` | Enable Allow anonymous sign-ins in Providers | | `403` | `provider_disabled` | Enable Google sign-in in Providers | | `403` | `mfa_disabled` | Enable MFA before enrolling factors | | `403` | `mfa_enrollment_required` | Required MFA: the user must enroll a factor first | | `400` | `weak_password` | Meet the minimum length; do not reuse the email | | `400` | `conversion_requires_credentials` | Anonymous conversion needs email and password together | | `400` | `unsupported_grant` | grant_type must be password, refresh_token, mfa, or id_token | | `400` | `unsupported_provider` | Only the google provider is supported | | `400` | `invalid_redirect` | redirect_to is not a valid http(s) URL | | `400` | `redirect_not_allowed` | Add the URL to the App redirect allowlist | | `400` | `invalid_state` | OAuth state missing, expired, or already used | | `400` | `email_required` | The Google account did not provide an email | | `409` | `user_exists` | A user with that email already exists | | `409` | `identity_exists` | The Google account is linked to another user | | `409` | `email_mismatch` | The Google email differs from the signed-in user’s | | `429` | `rate_limited` | Too many attempts; back off and retry later | ## Data API | Status | Code | Cause and fix | | --- | --- | --- | | `400` | `invalid_filter` | Filters must be `column=op.value` with a supported operator | | `400` | `invalid_column` | Unknown column, or a bad `select` list | | `400` | `invalid_order` | order must be `column.asc` or `column.desc` (max 3) | | `400` | `invalid_body` | Body must be a non-empty JSON object (max 64 fields); on RPC, named arguments that fit the parameters | | `400` | `validation_error` | limit/offset out of range, or a bad row id | | `400` | `not_null_violation` | A required column was omitted | | `400` | `check_violation` | A value failed a check constraint | | `400` | `invalid_input` | A value does not fit the column type | | `400` | `numeric_overflow` | A number is out of range for the column | | `403` | `forbidden` | The row policy rejected the read or write, or the api role lacks a table grant inside an RPC function | | `404` | `not_found` | Unknown or unexposed table, a missing/hidden row, or an RPC function without a matching grant and arguments | | `405` | `method_not_allowed` | Expose that operation on the table | | `408` | `statement_timeout` | The query timed out; simplify it | | `409` | `conflict` | Unique constraint violated | | `409` | `foreign_key_violation` | The referenced row does not exist | | `300` | `ambiguous_function` | Several RPC overloads match the arguments; details lists the signatures | | `413` | `result_too_large` | An RPC set-returning function produced more than 10000 rows | ## Database objects (Console) The Database menu managers — policies, functions, triggers, indexes, types, views — return these codes when a definition is rejected. Everything they manage lives in the public schema. | Status | Code | Cause and fix | | --- | --- | --- | | `400` | `validation_error` | A name, expression, or option failed validation; the details list the field | | `400` | `invalid_definition` | PostgreSQL rejected the definition (e.g. a bad function body) | | `400` | `invalid_column` | An expression or index references a column the table does not have | | `400` | `invalid_sql` | The statement could not be executed as written | | `400` | `undefined_function` | A trigger or expression references a function that does not exist | | `400` | `not_supported` | The requested operation is not supported for that object | | `403` | `extension_function` | The function belongs to an extension; it cannot be edited or dropped. Disable the extension instead | | `404` | `not_found` | The object does not exist in the public schema | | `409` | `already_exists` | An object with that name already exists | | `409` | `object_in_use` | Other objects depend on it; drop the dependents first | ## Storage The /storage/v1 endpoints return these codes. Quota errors include the limit and current consumption in details; private objects never leak their existence to unauthorized callers. | Status | Code | Cause and fix | | --- | --- | --- | | `402` | `STORAGE_PROJECT_QUOTA_EXCEEDED` | Project storage full; delete objects or upgrade | | `402` | `STORAGE_ACCOUNT_QUOTA_EXCEEDED` | Account-wide storage full; delete objects or upgrade | | `402` | `STORAGE_BANDWIDTH_QUOTA_EXCEEDED` | Monthly download budget exhausted; resets next billing cycle | | `413` | `STORAGE_FILE_TOO_LARGE` | File exceeds the plan or bucket maximum | | `403` | `STORAGE_BUCKET_ACCESS_DENIED` | The caller cannot access this bucket | | `410` | `STORAGE_UPLOAD_EXPIRED` | Upload session expired; start a new upload | | `404` | `STORAGE_OBJECT_NOT_FOUND` | Missing object, or private and not visible to you | | `409` | `storage_object_exists` | Path already taken; pass overwrite: true to replace | | `415` | `storage_mime_not_allowed` | MIME type not in the bucket allowlist | ## Functions The /functions/{name} gateway returns these codes before or around execution. Quota and concurrency refusals never reach the runtime and are not metered as invocations. Execution failures (a thrown error or a timeout) return 500 with the invocation id; the details live in Executions & Logs, never in the caller response. | Status | Code | Cause and fix | | --- | --- | --- | | `401` | `invalid_signature` | HMAC signature missing or wrong; sign the exact raw bytes you send | | `401` | `signature_timestamp_expired` | Timestamp outside the tolerance window; use the current unix time | | `401` | `signature_replayed` | The nonce was already used; generate a fresh nonce per delivery | | `402` | `FUNCTIONS_QUOTA_EXCEEDED` | Monthly invocations or GB-seconds exhausted; upgrade or wait for the cycle reset | | `404` | `function_not_found` | Unknown function, no enabled HTTP trigger, or an internal-only function | | `409` | `function_disabled` | The function is disabled; enable it in the Console | | `409` | `function_not_deployed` | No active deployment yet; deploy the function first | | `409` | `signature_not_configured` | HMAC mode is on but no signing secret exists; rotate the signature secret | | `413` | `request_too_large` | Body exceeds the platform function request limit | | `429` | `FUNCTIONS_CONCURRENCY_LIMIT` | All concurrent execution slots are busy; retry shortly | | `429` | `rate_limited` | Per-project HTTP rate limit reached; back off and retry | | `502` | `response_too_large` | The handler returned an oversized response; return less data | | `503` | `functions_disabled` | Functions is switched off on this engine deployment | Management APIs (Console) additionally return `validation_error` for bad names, cron expressions or configurations, `name_conflict` when a secret and a variable share a name, `already_exists` for duplicate triggers, and `deployment_not_ready` when activating a version that is not ready. ## Project and platform | Status | Code | Cause and fix | | --- | --- | --- | | `402` | `quota_exceeded` | A shared quota (MAU, API requests, bandwidth, function invocations or compute) or a database-size limit was reached; `details` carries the resource, scope, usage, limit and reset date. Upgrade, reduce usage, or (paid plans) enable additional usage in Console → Billing → Additional Usage | | `402` | `spending_limit_reached` | The organization enabled additional usage and its estimated metered spending reached the monthly spending limit; `details` carries the limit and current spend. Included quotas are unaffected. Raise the limit, reduce usage, or wait for the billing-period reset | | `403` | `project_suspended` | Account over quota past the grace period; upgrade or reduce | | `403` | `project_paused` | Free project idle 14 days; resume from the Console | | `404` | `project_not_found` | Unknown slug, or the project is not active yet | | `409` | `project_not_ready` | Provisioning has not finished | | `400` | `invalid_sql` | The SQL editor accepts one read-only statement | | `403` | `read_only` | The statement cannot modify data | | `500` | `internal_error` | Unexpected failure; retry, and contact support with the requestId | ## Additional resources - [API routes](https://cubibase.com/docs/reference/routes) Where each error can come from. - [Quotas and suspension](https://cubibase.com/docs/platform/quotas) The 402 and 403 project states in detail. - [Pause, archive, restore](https://cubibase.com/docs/platform/lifecycle) What project_paused means and how to clear it. --- # Using CubiBase with AI agents Source: https://cubibase.com/docs/agents Also available: [Markdown version](https://cubibase.com/docs/agents.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt) CubiBase is built to be operated by AI agents end to end: discover the API, authenticate with a personal access token, and act through an MCP server, a CLI, or plain HTTPS. ## The agent surfaces | Surface | Where | What it is for | | --- | --- | --- | | MCP server | `npx -y @cubibasehq/mcp` | Tools for chat and IDE agents (Claude, Cursor, Codex): projects, full schema, rows, SQL, storage uploads, function deployments, logs, Data API, docs search | | CLI | `npx -y @cubibasehq/cli` | Shell agents and scripts; JSON output on stdout, structured errors on stderr. Same console parity as the MCP tools | | TypeScript client | `npm install @cubibasehq/client` | Typed ControlClient and DataClient for code agents | | Control API OpenAPI | `https://api.cubibase.com/v1/openapi.json` | OpenAPI 3.1 with operationIds and typed errors for the whole Control API | | Data API OpenAPI | `https://{slug}.api.cubibase.com/rest/v1/openapi.json` | Per-project spec generated from the live schema: exposed tables, columns, filters, RPC functions | | Skill file | `https://cubibase.com/SKILL.md` | A loadable skill (agentskills.io format) that teaches an agent the whole CubiBase workflow. Canonical repo: github.com/cubibase/skills; also inside the @cubibasehq/mcp and @cubibasehq/cli packages | Source for all three packages: github.com/cubibase/cubibase-agent (MIT). ## Authentication an agent can finish 1. **Create a personal access token** — Console → Account → Access tokens. Scope read for inspection, write for building, admin for destructive operations. Optionally restrict the token to one project. 2. **Give the token to the agent** — Set CUBIBASE_TOKEN in the agent environment (MCP env block or shell). The token is a cb_pat_… string, shown once. 3. **Optional: add a service key for data access** — For Data API tools, create a secret key (cb_sec_…) in the project’s API keys and set CUBIBASE_SERVICE_KEY. It acts as the service actor; row-level security still applies. > **important**: A service key is not a superuser. It runs with cubibase.role = 'service' and sees only rows that a service policy grants. Grant access explicitly, for example a SELECT policy using cubibase.current_role() = 'service'. ## MCP setup Add the server to any MCP client (Claude Desktop, Cursor, Codex, and others): **mcp.json** ```json { "mcpServers": { "cubibase": { "command": "npx", "args": ["-y", "@cubibasehq/mcp"], "env": { "CUBIBASE_TOKEN": "cb_pat_…", "CUBIBASE_SERVICE_KEY": "cb_sec_… (optional)" } } } } ``` 76 tools in seven groups. Projects: list, get, create, update, delete. Database: tables, columns, exposure, policies, PostgreSQL triggers, indexes, enum/composite types, views, rows (list/insert/update/delete), read-only SQL, SQL functions. Storage: bucket CRUD, object listing, cubibase_upload_file (end-to-end upload from text or base64), presigned upload URLs for large files, signed download links. Functions: create from source or template, deploy, activate deployments, secrets, http/database/storage/schedule triggers, test invocation, execution logs. Data API: cubibase_data_list, cubibase_data_rpc, cubibase_data_openapi. Observability: API keys, request logs, audit logs, usage, and cubibase_additional_usage (read-only V4.5 overage settings, per-resource excess and estimated costs, invoice preview — enabling overages stays a Console-only owner action). Docs: cubibase_search_docs searches the bundled documentation offline and returns excerpts with URLs. | Environment variable | Effect | | --- | --- | | `CUBIBASE_READ_ONLY=1` | Hides every mutating tool from the tool list. Pair with a read-scope token for safe exploration agents | | `CUBIBASE_FEATURES=database,storage` | Only register the listed tool groups: projects, database, storage, functions, data, observability, docs | **Read-only inspection server** ```json { "mcpServers": { "cubibase": { "command": "npx", "args": ["-y", "@cubibasehq/mcp"], "env": { "CUBIBASE_TOKEN": "cb_pat_…", "CUBIBASE_READ_ONLY": "1" } } } } ``` ## CLI setup **Shell** ```bash export CUBIBASE_TOKEN=cb_pat_… npx -y @cubibasehq/cli projects list npx -y @cubibasehq/cli tables list npx -y @cubibasehq/cli rows list notes --filter status=eq.active --limit 10 npx -y @cubibasehq/cli sql 'select count(*) from notes' npx -y @cubibasehq/cli storage upload --bucket avatars --path u1.png --file ./u1.png npx -y @cubibasehq/cli functions create --name hello --file ./hello.ts npx -y @cubibasehq/cli functions deploy hello ``` Command groups: projects, tables, rows, sql, rpc, exposure, policies, triggers, indexes, types, views, storage, functions, keys, logs, usage, tokens. Every command prints JSON. Errors print {"error":{code,message,status,retryAfterSeconds}} to stderr and exit 1. ## Errors and retries - Every error carries a stable machine code (e.g. invalid_token, insufficient_scope, quota_exceeded) and a requestId for support. - 429 responses include a Retry-After header (seconds). Wait, then retry — do not hammer. - 401 means re-authenticate or check the token scope; 403 means the action is not allowed for this actor; 402 means a plan quota was reached. - The full error catalogue is on the error codes reference page. ## Machine-readable discovery files - llms.txt — product summary and page index: https://cubibase.com/llms.txt - llms-full.txt — the entire site content in one file: https://cubibase.com/llms-full.txt - Markdown mirrors — every page is also served as {path}.md, e.g. https://cubibase.com/docs/quickstart.md - Pricing as text: https://cubibase.com/pricing.md - AI catalog: https://cubibase.com/.well-known/ai-catalog.json - Skill file: https://cubibase.com/SKILL.md ## Additional resources - [Personal access tokens](https://cubibase.com/docs/platform/access-tokens) Scopes, restrictions, rate limits, revocation. - [API routes](https://cubibase.com/docs/reference/routes) Every Control and Data API route. - [Error codes](https://cubibase.com/docs/reference/errors) The stable codes an agent can branch on.