Skip to content
v2.7

Databases

Legacy databases API (collections and documents). In a new project, use TablesDB.

Legacy databases API (collections and documents). In a new project, use TablesDB.

Class Databases: 72 methods (15 in @owbase/web, 72 in @owbase/node). The examples use the object form of the parameters; replace the values between < and > with your own.

List databases

GET /databases · method page

SDK: @owbase/node only

Get a list of all databases from the current Owbase project. You can use the search parameter to filter your results.

Parameter Type Required Description
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name
search string no Search term to filter your list results. Max length: 256 chars.
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Access: API key with the databases.read scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.list({
queries: [], // optional
search: '<SEARCH>', // optional
total: false, // optional
});

Create database

POST /databases · method page

SDK: @owbase/node only

Create a new Database.

Parameter Type Required Description
databaseId string yes Unique Id. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can’t start with a special char. Max length is 36 chars.
name string yes Database name. Max length: 128 chars.
enabled boolean no Is the database enabled? When set to ‘disabled’, users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
description string no Optional description for the database.

Access: API key with the databases.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.create({
databaseId: '<DATABASE_ID>',
name: '<NAME>',
enabled: false, // optional
description: '<DESCRIPTION>', // optional
});

List transactions

GET /databases/transactions · method page

SDK: @owbase/web and @owbase/node

List transactions across all databases.

Parameter Type Required Description
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries.
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Access: API key with the documents.read scope (also accepts rows.read) or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.listTransactions({
queries: [], // optional
total: false, // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.listTransactions({
queries: [], // optional
total: false, // optional
});

Create transaction

POST /databases/transactions · method page

SDK: @owbase/web and @owbase/node

Create a new transaction.

Parameter Type Required Description
ttl number no Seconds before the transaction expires.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.createTransaction({
ttl: 60, // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createTransaction({
ttl: 60, // optional
});

Get transaction

GET /databases/transactions/{transactionId} · method page

SDK: @owbase/web and @owbase/node

Get a transaction by its unique ID.

Parameter Type Required Description
transactionId string yes Transaction ID.

Access: API key with the documents.read scope (also accepts rows.read) or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.getTransaction({
transactionId: '<TRANSACTION_ID>',
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.getTransaction({
transactionId: '<TRANSACTION_ID>',
});

Update transaction

PATCH /databases/transactions/{transactionId} · method page

SDK: @owbase/web and @owbase/node

Update a transaction, to either commit or roll back its operations.

Parameter Type Required Description
transactionId string yes Transaction ID.
commit boolean no Commit transaction?
rollback boolean no Rollback transaction?

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.updateTransaction({
transactionId: '<TRANSACTION_ID>',
commit: false, // optional
rollback: false, // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateTransaction({
transactionId: '<TRANSACTION_ID>',
commit: false, // optional
rollback: false, // optional
});

Delete transaction

DELETE /databases/transactions/{transactionId} · method page

SDK: @owbase/web and @owbase/node

Delete a transaction by its unique ID.

Parameter Type Required Description
transactionId string yes Transaction ID.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.deleteTransaction({
transactionId: '<TRANSACTION_ID>',
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.deleteTransaction({
transactionId: '<TRANSACTION_ID>',
});

Create operations

POST /databases/transactions/{transactionId}/operations · method page

SDK: @owbase/web and @owbase/node

Create multiple operations in a single transaction.

Parameter Type Required Description
transactionId string yes Transaction ID.
operations object[] no Array of staged operations.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.createOperations({
transactionId: '<TRANSACTION_ID>',
operations: [
{
action: 'create',
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
name: "Walter O'Brien",
},
},
], // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createOperations({
transactionId: '<TRANSACTION_ID>',
operations: [
{
action: 'create',
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
name: "Walter O'Brien",
},
},
], // optional
});

Get database

GET /databases/{databaseId} · method page

SDK: @owbase/node only

Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.

Parameter Type Required Description
databaseId string yes Database ID.

Access: API key with the databases.read scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.get({
databaseId: '<DATABASE_ID>',
});

Update database

PUT /databases/{databaseId} · method page

SDK: @owbase/node only

Update a database by its unique ID.

Parameter Type Required Description
databaseId string yes Database ID.
name string no Database name. Max length: 128 chars.
enabled boolean no Is database enabled? When set to ‘disabled’, users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
description string no Optional description for the database.

Access: API key with the databases.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.update({
databaseId: '<DATABASE_ID>',
name: '<NAME>', // optional
enabled: false, // optional
description: '<DESCRIPTION>', // optional
});

Delete database

DELETE /databases/{databaseId} · method page

SDK: @owbase/node only

Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.

Parameter Type Required Description
databaseId string yes Database ID.

Access: API key with the databases.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.delete({
databaseId: '<DATABASE_ID>',
});

List collections

GET /databases/{databaseId}/collections · method page

SDK: @owbase/node only

Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.

Parameter Type Required Description
databaseId string yes Database ID.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity
search string no Search term to filter your list results. Max length: 256 chars.
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Access: API key with the collections.read scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.listCollections({
databaseId: '<DATABASE_ID>',
queries: [], // optional
search: '<SEARCH>', // optional
total: false, // optional
});

Create collections

POST /databases/{databaseId}/collections · method page

SDK: @owbase/node only

Create a new Collection. Before using this route, you should create a new database resource using either a server integration API or directly from your database console.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Unique Id. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can’t start with a special char. Max length is 36 chars.
name string yes Collection name. Max length: 128 chars.
permissions string[] no An array of permissions strings. By default, no user is granted with any permissions. Learn more about permissions.
documentSecurity boolean no Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. Learn more about permissions.
enabled boolean no Is collection enabled? When set to ‘disabled’, users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
attributes object[] no Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
indexes object[] no Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial, trigram), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).
description string no Optional description for the collection.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases, Permission, Role } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createCollection({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
name: '<NAME>',
permissions: [Permission.read(Role.any())], // optional
documentSecurity: false, // optional
enabled: false, // optional
attributes: [], // optional
indexes: [], // optional
description: '<DESCRIPTION>', // optional
});

Get collection

GET /databases/{databaseId}/collections/{collectionId} · method page

SDK: @owbase/node only

Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.

Access: API key with the collections.read scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.getCollection({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
});

Update collection

PUT /databases/{databaseId}/collections/{collectionId} · method page

SDK: @owbase/node only

Update a collection by its unique ID.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
name string no Collection name. Max length: 128 chars.
permissions string[] no An array of permission strings. By default, the current permissions are inherited. Learn more about permissions.
documentSecurity boolean no Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. Learn more about permissions.
enabled boolean no Is collection enabled? When set to ‘disabled’, users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
purge boolean no When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire.
description string no Optional description for the collection.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases, Permission, Role } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateCollection({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
name: '<NAME>', // optional
permissions: [Permission.read(Role.any())], // optional
documentSecurity: false, // optional
enabled: false, // optional
purge: false, // optional
description: '<DESCRIPTION>', // optional
});

Delete collection

DELETE /databases/{databaseId}/collections/{collectionId} · method page

SDK: @owbase/node only

Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.deleteCollection({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
});

List attributes

GET /databases/{databaseId}/collections/{collectionId}/attributes · method page

SDK: @owbase/node only

List attributes in the collection.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Access: API key with the collections.read scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.listAttributes({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
total: false, // optional
});

Create bigint attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/bigint · method page

SDK: @owbase/node only

Create a bigint attribute. Optionally, minimum and maximum values can be provided.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
min number no Minimum value
max number no Maximum value
xdefault number no Default value. Cannot be set when attribute is required.
array boolean no Is attribute an array?
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createBigIntAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
min: 0, // optional
max: 1000000, // optional
xdefault: 0, // optional
array: false, // optional
description: '<DESCRIPTION>', // optional
});

Update bigint attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key} · method page

SDK: @owbase/node only

Update a bigint attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault number no Default value. Cannot be set when attribute is required.
min number no Minimum value
max number no Maximum value
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateBigIntAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 0,
min: 0, // optional
max: 1000000, // optional
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create boolean attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/boolean · method page

SDK: @owbase/node only

Create a boolean attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault boolean no Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean no Is attribute an array?
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createBooleanAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: false, // optional
array: false, // optional
description: '<DESCRIPTION>', // optional
});

Update boolean attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key} · method page

SDK: @owbase/node only

Update a boolean attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault boolean no Default value for attribute when not provided. Cannot be set when attribute is required.
newKey string no New attribute key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateBooleanAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: false,
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create datetime attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/datetime · method page

SDK: @owbase/node only

Create a date time attribute according to the ISO 8601 standard.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.
array boolean no Is attribute an array?
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createDatetimeAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: '2020-10-15T06:38:00.000+00:00', // optional
array: false, // optional
description: '<DESCRIPTION>', // optional
});

Update datetime attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key} · method page

SDK: @owbase/node only

Update a date time attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
newKey string no New attribute key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateDatetimeAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: '2020-10-15T06:38:00.000+00:00',
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create email attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/email · method page

SDK: @owbase/node only

Create an email attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean no Is attribute an array?
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createEmailAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: '[email protected]', // optional
array: false, // optional
description: '<DESCRIPTION>', // optional
});

Update email attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/email/{key} · method page

SDK: @owbase/node only

Update an email attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateEmailAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: '[email protected]',
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create enum attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/enum · method page

SDK: @owbase/node only

Create an enum attribute. The elements param acts as a white-list of accepted values for this attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
elements string[] yes Array of enum values.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean no Is attribute an array?
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createEnumAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
elements: ['active', 'inactive'],
required: false,
xdefault: 'active', // optional
array: false, // optional
description: '<DESCRIPTION>', // optional
});

Update enum attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/enum/{key} · method page

SDK: @owbase/node only

Update an enum attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
elements string[] yes Updated list of enum values.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateEnumAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
elements: ['active', 'inactive'],
required: false,
xdefault: 'active',
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create float attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/float · method page

SDK: @owbase/node only

Create a float attribute. Optionally, minimum and maximum values can be provided.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
min number no Minimum value.
max number no Maximum value.
xdefault number no Default value. Cannot be set when required.
array boolean no Is attribute an array?
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createFloatAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
min: 0, // optional
max: 100, // optional
xdefault: 10.5, // optional
array: false, // optional
description: '<DESCRIPTION>', // optional
});

Update float attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/float/{key} · method page

SDK: @owbase/node only

Update a float attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault number no Default value. Cannot be set when required.
min number no Minimum value.
max number no Maximum value.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateFloatAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 10.5,
min: 0, // optional
max: 100, // optional
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create integer attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/integer · method page

SDK: @owbase/node only

Create an integer attribute. Optionally, minimum and maximum values can be provided.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
min number no Minimum value
max number no Maximum value
xdefault number no Default value. Cannot be set when attribute is required.
array boolean no Is attribute an array?
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createIntegerAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
min: 0, // optional
max: 100, // optional
xdefault: 10, // optional
array: false, // optional
description: '<DESCRIPTION>', // optional
});

Update integer attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/integer/{key} · method page

SDK: @owbase/node only

Update an integer attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault number no Default value. Cannot be set when attribute is required.
min number no Minimum value
max number no Maximum value
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateIntegerAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 10,
min: 0, // optional
max: 100, // optional
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create IP address attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/ip · method page

SDK: @owbase/node only

Create IP address attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value. Cannot be set when attribute is required.
array boolean no Is attribute an array?
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createIpAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: '192.0.2.0', // optional
array: false, // optional
description: '<DESCRIPTION>', // optional
});

Update IP address attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/ip/{key} · method page

SDK: @owbase/node only

Update an ip attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value. Cannot be set when attribute is required.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateIpAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: '192.0.2.0',
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create line attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/line · method page

SDK: @owbase/node only

Create a geometric line attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault number[][] no Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createLineAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: [
[1, 2],
[3, 4],
[5, 6],
], // optional
description: '<DESCRIPTION>', // optional
});

Update line attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/line/{key} · method page

SDK: @owbase/node only

Update a line attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault number[][] no Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.
newKey string no New attribute key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateLineAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: [
[1, 2],
[3, 4],
[5, 6],
], // optional
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create longtext attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/longtext · method page

SDK: @owbase/node only

Create a longtext attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean no Is attribute an array?
encrypt boolean no Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createLongtextAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'Hello World', // optional
array: false, // optional
encrypt: false, // optional
description: '<DESCRIPTION>', // optional
});

Update longtext attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key} · method page

SDK: @owbase/node only

Update a longtext attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateLongtextAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'Hello World',
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create mediumtext attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/mediumtext · method page

SDK: @owbase/node only

Create a mediumtext attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean no Is attribute an array?
encrypt boolean no Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createMediumtextAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'Hello World', // optional
array: false, // optional
encrypt: false, // optional
description: '<DESCRIPTION>', // optional
});

Update mediumtext attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key} · method page

SDK: @owbase/node only

Update a mediumtext attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateMediumtextAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'Hello World',
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create point attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/point · method page

SDK: @owbase/node only

Create a geometric point attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault number[] no Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createPointAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: [1, 2], // optional
description: '<DESCRIPTION>', // optional
});

Update point attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/point/{key} · method page

SDK: @owbase/node only

Update a point attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault number[] no Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.
newKey string no New attribute key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updatePointAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: [1, 2], // optional
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create polygon attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/polygon · method page

SDK: @owbase/node only

Create a geometric polygon attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault number[][][] no Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createPolygonAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: [
[
[1, 2],
[3, 4],
[5, 6],
[1, 2],
],
], // optional
description: '<DESCRIPTION>', // optional
});

Update polygon attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key} · method page

SDK: @owbase/node only

Update a polygon attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault number[][][] no Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.
newKey string no New attribute key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updatePolygonAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: [
[
[1, 2],
[3, 4],
[5, 6],
[1, 2],
],
], // optional
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create relationship attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/relationship · method page

SDK: @owbase/node only

Create relationship attribute. Learn more about relationship attributes.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
relatedCollectionId string yes Related Collection ID.
type RelationshipType yes Relationship type. Possible values are: oneToOne, oneToMany, manyToOne, manyToMany. Values: oneToOne, manyToOne, manyToMany, oneToMany.
twoWay boolean no Is Two Way?
key string no Attribute Key.
twoWayKey string no Two Way Attribute Key.
onDelete RelationMutate no Delete constraint. Possible values are: cascade, restrict, setNull. Values: cascade, restrict, setNull.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases, RelationshipType, RelationMutate } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createRelationshipAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
relatedCollectionId: '<RELATED_COLLECTION_ID>',
type: RelationshipType.OneToOne,
twoWay: false, // optional
key: '<KEY>', // optional
twoWayKey: '<TWO_WAY_KEY>', // optional
onDelete: RelationMutate.Cascade, // optional
description: '<DESCRIPTION>', // optional
});

Update relationship attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key} · method page

SDK: @owbase/node only

Update relationship attribute. Learn more about relationship attributes.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
onDelete RelationMutate no Delete constraint. Possible values are: cascade, restrict, setNull. Values: cascade, restrict, setNull.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases, RelationMutate } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateRelationshipAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
onDelete: RelationMutate.Cascade, // optional
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create string attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/string · method page

SDK: @owbase/node only

Create a string attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new table using the Database service server integration.
key string yes Attribute Key.
size number yes Attribute size for text attributes, in number of characters.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean no Is attribute an array?
encrypt boolean no Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createStringAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
size: 1,
required: false,
xdefault: 'Hello World', // optional
array: false, // optional
encrypt: false, // optional
description: '<DESCRIPTION>', // optional
});

Update string attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/string/{key} · method page

SDK: @owbase/node only

Update a string attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new table using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
size number no Maximum size of the string attribute.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateStringAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'Hello World',
size: 1, // optional
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create text attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/text · method page

SDK: @owbase/node only

Create a text attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean no Is attribute an array?
encrypt boolean no Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createTextAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'Hello World', // optional
array: false, // optional
encrypt: false, // optional
description: '<DESCRIPTION>', // optional
});

Update text attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/text/{key} · method page

SDK: @owbase/node only

Update a text attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateTextAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'Hello World',
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create URL attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/url · method page

SDK: @owbase/node only

Create a URL attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean no Is attribute an array?
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createUrlAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'https://example.com', // optional
array: false, // optional
description: '<DESCRIPTION>', // optional
});

Update URL attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/url/{key} · method page

SDK: @owbase/node only

Update an url attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateUrlAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'https://example.com',
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Create varchar attribute

POST /databases/{databaseId}/collections/{collectionId}/attributes/varchar · method page

SDK: @owbase/node only

Create a varchar attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
size number yes Attribute size for varchar attributes, in number of characters. Maximum size is 16381.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean no Is attribute an array?
encrypt boolean no Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createVarcharAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
size: 1,
required: false,
xdefault: 'Hello World', // optional
array: false, // optional
encrypt: false, // optional
description: '<DESCRIPTION>', // optional
});

Update varchar attribute

PATCH /databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key} · method page

SDK: @owbase/node only

Update a varchar attribute. Changing the default value will not update already existing documents.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Attribute Key.
required boolean yes Is attribute required?
xdefault string no Default value for attribute when not provided. Cannot be set when attribute is required.
size number no Maximum size of the varchar attribute.
newKey string no New Attribute Key.
description string no Optional description for the attribute.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateVarcharAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
required: false,
xdefault: 'Hello World',
size: 1, // optional
newKey: '<NEW_KEY>', // optional
description: '<DESCRIPTION>', // optional
});

Get attribute

GET /databases/{databaseId}/collections/{collectionId}/attributes/{key} · method page

SDK: @owbase/node only

Get attribute by ID.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.

Access: API key with the collections.read scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.getAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
});

Delete attribute

DELETE /databases/{databaseId}/collections/{collectionId}/attributes/{key} · method page

SDK: @owbase/node only

Deletes an attribute.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
key string yes Attribute Key.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.deleteAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
});

List documents

GET /databases/{databaseId}/collections/{collectionId}/documents · method page

SDK: @owbase/web and @owbase/node

Get a list of all the user’s documents in a given collection. You can use the query params to filter your results.

Documents returned by aggregate, groupBy or distinct queries hold only the attributes they select, group or aggregate, typed as a document types them, with a joined attribute named by its join alias (alias.attribute). The response omits their $id, $sequence, $createdAt, $updatedAt, $permissions, $databaseId and $collectionId unless they select or group it, and those of a right or full join document that no document of this collection matched. SDK document models fill omitted system attributes with empty values.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.
transactionId string no Transaction ID to read uncommitted changes within the transaction.
total boolean no When set to false, the total count returned will be 0 and will not be calculated.
ttl number no TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Lists with join queries are not cached. Must be between 0 and 86400 (24 hours).

Access: API key with the documents.read scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.listDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
total: false, // optional
ttl: 0, // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
const databases = new Databases(client);
const result = await databases.listDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
total: false, // optional
ttl: 0, // optional
});

Create document

POST /databases/{databaseId}/collections/{collectionId}/documents · method page

SDK: @owbase/web and @owbase/node

Create a new Document. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration. Make sure to define attributes before creating documents.
documentId string yes Document ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can’t start with a special char. Max length is 36 chars.
data object yes Document data as JSON object.
permissions string[] no An array of permissions strings. By default, only the current user is granted all permissions. Learn more about permissions.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases, Permission, Role } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.createDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
username: 'walter.obrien',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
},
permissions: [Permission.read(Role.any())], // optional
transactionId: '<TRANSACTION_ID>', // optional
});
console.log(result);
@owbase/node
import { Client, Databases, Permission, Role } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
const databases = new Databases(client);
const result = await databases.createDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
username: 'walter.obrien',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
},
permissions: [Permission.read(Role.any())], // optional
transactionId: '<TRANSACTION_ID>', // optional
});

Create documents

POST /databases/{databaseId}/collections/{collectionId}/documents · method page

SDK: @owbase/node only

Create new Documents. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration. Make sure to define attributes before creating documents.
documents object[] yes Array of documents data as JSON objects.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [
{
$id: 'example1',
username: 'walter.obrien',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
},
],
transactionId: '<TRANSACTION_ID>', // optional
});

Upsert documents

PUT /databases/{databaseId}/collections/{collectionId}/documents · method page

SDK: @owbase/node only

Create or update Documents. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
documents object[] yes Array of document data as JSON objects. May contain partial documents.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.upsertDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [
{
$id: 'example1',
username: 'walter.obrien',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
},
],
transactionId: '<TRANSACTION_ID>', // optional
});

Update documents

PATCH /databases/{databaseId}/collections/{collectionId}/documents · method page

SDK: @owbase/node only

Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
data object no Document data as JSON object. Include only attribute and value pairs to be updated.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.updateDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
data: {
username: 'walter.obrien',
fullName: "Walter O'Brien",
age: 33,
isAdmin: false,
}, // optional
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
});

Delete documents

DELETE /databases/{databaseId}/collections/{collectionId}/documents · method page

SDK: @owbase/node only

Bulk delete documents using queries, if no queries are passed then all documents are deleted.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.deleteDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [
'{"method":"equal", "attribute":"$id", "values":["<DOCUMENT_ID>"]}',
], // optional
transactionId: '<TRANSACTION_ID>', // optional
});

Create query

POST /databases/{databaseId}/collections/{collectionId}/documents/query · method page

SDK: @owbase/web and @owbase/node

Get a list of all the user’s documents in a given collection using a POST request. This behaves identically to the list documents endpoint but accepts the queries in the request body, allowing much larger queries arrays than can fit in a URL query string.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.
transactionId string no Transaction ID to read uncommitted changes within the transaction.
total boolean no When set to false, the total count returned will be 0 and will not be calculated.
ttl number no TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Lists with join queries are not cached. Must be between 0 and 86400 (24 hours).

Access: API key with the documents.read scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.createQuery({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
total: false, // optional
ttl: 0, // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
const databases = new Databases(client);
const result = await databases.createQuery({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
total: false, // optional
ttl: 0, // optional
});

Get document

GET /databases/{databaseId}/collections/{collectionId}/documents/{documentId} · method page

SDK: @owbase/web and @owbase/node

Get a document by its unique ID. This endpoint response returns a JSON object with the document data.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
documentId string yes Document ID.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.
transactionId string no Transaction ID to read uncommitted changes within the transaction.

Access: API key with the documents.read scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.getDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
const databases = new Databases(client);
const result = await databases.getDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
});

Upsert a document

PUT /databases/{databaseId}/collections/{collectionId}/documents/{documentId} · method page

SDK: @owbase/web and @owbase/node

Create or update a Document. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
documentId string yes Document ID.
data object no Document data as JSON object. Include all required attributes of the document to be created or updated.
permissions string[] no An array of permissions strings. By default, the current permissions are inherited. Learn more about permissions.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases, Permission, Role } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.upsertDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
username: 'walter.obrien',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
}, // optional
permissions: [Permission.read(Role.any())], // optional
transactionId: '<TRANSACTION_ID>', // optional
});
console.log(result);
@owbase/node
import { Client, Databases, Permission, Role } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
const databases = new Databases(client);
const result = await databases.upsertDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
username: 'walter.obrien',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
}, // optional
permissions: [Permission.read(Role.any())], // optional
transactionId: '<TRANSACTION_ID>', // optional
});

Update document

PATCH /databases/{databaseId}/collections/{collectionId}/documents/{documentId} · method page

SDK: @owbase/web and @owbase/node

Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
documentId string yes Document ID.
data object no Document data as JSON object. Include only attribute and value pairs to be updated.
permissions string[] no An array of permissions strings. By default, the current permissions are inherited. Learn more about permissions.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases, Permission, Role } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.updateDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
username: 'walter.obrien',
fullName: "Walter O'Brien",
age: 33,
isAdmin: false,
}, // optional
permissions: [Permission.read(Role.any())], // optional
transactionId: '<TRANSACTION_ID>', // optional
});
console.log(result);
@owbase/node
import { Client, Databases, Permission, Role } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
const databases = new Databases(client);
const result = await databases.updateDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
username: 'walter.obrien',
fullName: "Walter O'Brien",
age: 33,
isAdmin: false,
}, // optional
permissions: [Permission.read(Role.any())], // optional
transactionId: '<TRANSACTION_ID>', // optional
});

Delete document

DELETE /databases/{databaseId}/collections/{collectionId}/documents/{documentId} · method page

SDK: @owbase/web and @owbase/node

Delete a document by its unique ID.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
documentId string yes Document ID.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.deleteDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
transactionId: '<TRANSACTION_ID>', // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
const databases = new Databases(client);
const result = await databases.deleteDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
transactionId: '<TRANSACTION_ID>', // optional
});

Decrement document attribute

PATCH /databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement · method page

SDK: @owbase/web and @owbase/node

Decrement a specific attribute of a document by a given value.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
documentId string yes Document ID.
attribute string yes Attribute key.
value number no Value to increment the attribute by. The value must be a number.
min number no Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.decrementDocumentAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
attribute: '<ATTRIBUTE>',
value: 1, // optional
min: 0, // optional
transactionId: '<TRANSACTION_ID>', // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
const databases = new Databases(client);
const result = await databases.decrementDocumentAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
attribute: '<ATTRIBUTE>',
value: 1, // optional
min: 0, // optional
transactionId: '<TRANSACTION_ID>', // optional
});

Increment document attribute

PATCH /databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment · method page

SDK: @owbase/web and @owbase/node

Increment a specific attribute of a document by a given value.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID.
documentId string yes Document ID.
attribute string yes Attribute key.
value number no Value to increment the attribute by. The value must be a number.
max number no Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
transactionId string no Transaction ID for staging the operation.

Access: API key with the documents.write scope or user session, or even no session (the resource’s permissions apply).

@owbase/web
import { Client, Databases } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.incrementDocumentAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
attribute: '<ATTRIBUTE>',
value: 1, // optional
max: 100, // optional
transactionId: '<TRANSACTION_ID>', // optional
});
console.log(result);
@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with
const databases = new Databases(client);
const result = await databases.incrementDocumentAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
attribute: '<ATTRIBUTE>',
value: 1, // optional
max: 100, // optional
transactionId: '<TRANSACTION_ID>', // optional
});

List indexes

GET /databases/{databaseId}/collections/{collectionId}/indexes · method page

SDK: @owbase/node only

List indexes in the collection.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Access: API key with the collections.read scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.listIndexes({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
total: false, // optional
});

Create index

POST /databases/{databaseId}/collections/{collectionId}/indexes · method page

SDK: @owbase/node only

Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be key, fulltext, unique, spatial, and trigram. trigram is only available on PostgreSQL and lets contains, startsWith, and endsWith queries on string attributes use an index.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Index Key.
type DatabasesIndexType yes Index type. Values: key, fulltext, unique, spatial, trigram.
attributes string[] yes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
orders OrderBy[] no Array of index orders. Maximum of 100 orders are allowed. Values: asc, desc.
lengths number[] no Length of index. Maximum of 100
description string no Optional description for the index.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases, DatabasesIndexType, OrderBy } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.createIndex({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
type: DatabasesIndexType.Key,
attributes: ['username'],
orders: [OrderBy.Asc], // optional
lengths: [], // optional
description: '<DESCRIPTION>', // optional
});

Get index

GET /databases/{databaseId}/collections/{collectionId}/indexes/{key} · method page

SDK: @owbase/node only

Get an index by its unique ID.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Index Key.

Access: API key with the collections.read scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.getIndex({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
});

Delete index

DELETE /databases/{databaseId}/collections/{collectionId}/indexes/{key} · method page

SDK: @owbase/node only

Delete an index.

Parameter Type Required Description
databaseId string yes Database ID.
collectionId string yes Collection ID. You can create a new collection using the Database service server integration.
key string yes Index Key.

Access: API key with the collections.write scope.

@owbase/node
import { Client, Databases } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const databases = new Databases(client);
const result = await databases.deleteIndex({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
});

The descriptions on this page come from the server API specification (BSD-3-Clause license), and the examples come from the SDK generator (MIT license). The full notices are in the NOTICE file of the @owbase/web and @owbase/node packages.

Was this page helpful?