# AutessaDB - Relational API

Source: https://docs.autessa.com/docs/api/autessadb

> Complete API reference for AutessaDB including CRUD operations, semantic search, batch operations, and join queries.

# AutessaDB - Relational API

AutessaDB is a complete database solution with built-in semantic search capabilities. Perform CRUD operations, complex queries, batch updates, join tables, and leverage powerful vector search across your data.
> All AutessaDB API requests require the `resourceId` query parameter set to your table's ID (e.g. `V1StGXR8Z5`) and an `Authorization` header with your API key. Your API key must have the appropriate permissions (READ, WRITE, DELETE) for the requested operation.

---

## Base URL

```
https://api.autessa.com/clients/autessadb
```

---

## Authentication

Pass your API key in the `Authorization` header (no "Bearer" prefix):

```
Authorization: your_api_key_here
```

```bash title="cURL"
curl https://api.autessa.com/clients/autessadb/get-data?resourceId=V1StGXR8Z5 \
  -H "Authorization: your_api_key" \
  -H "Content-Type: application/json"
```

---

## Permissions

Each API key can have different permissions for each table:

- `READ` — Required for: get-data, query, join-query, aggregate, get-single-row, search
- `WRITE` — Required for: insert, update, batch-update, bulk-insert, bulk-update-by-ids, generate-upload-link, index-record
- `DELETE` — Required for: delete-row, batch-delete, bulk-delete-by-ids

`/create-knowledge-base` creates a new table, so no table-level permission applies — the API key authenticates at the company level instead.

Configure permissions for your API key in the [Autessa Builder](https://builder.autessa.com/keys). A key never reaches more than its owner can: if the owner can't read a table, neither can the key, whatever its permissions say. See [API Keys](/docs/guide/api-management/api-keys.md).

---

## Row and column security

Table permissions decide whether a caller can use a table at all. **AutessaDB roles** decide which *rows* the caller sees and which *columns* are visible, masked, or hidden. Every request, whether from a person, a tool, an agent, a script, an app, or an API key, is evaluated against the roles of whoever it acts as.

### Who a role can apply to

A role is assigned to one or more of:

| `principalType` | Applies to |
|---|---|
| `USER` | One person (`userId`) |
| `TEAM` | Everyone on a team (`teamId`) |
| `COMPANY_ROLE` | Everyone holding a company role such as Manager (`roleId`) |
| `COMPANY` | Everyone at the company |
| `CUSTOM_APP` | Visitors of a public or sign-in app (`customAppId`). Apps in the default hosting mode act as the person using them, so app roles don't apply there. |
| `API_KEY` | An API key that uses its own role (`apiKeyId`). You can assign this only to keys you own, or administer and can fully reach. |

Someone covered by several roles sees the union of what those roles allow. You can create or change a role only if you are an Admin of every table it touches.

### Row rules and placeholders

A role's row rule is a filter, in the same shape as [WHERE conditions](#where-conditions), that decides which rows its members see. Use placeholders to make one rule work for everyone:

| Placeholder | Resolves to |
|---|---|
| `$CURRENT_USER_ID` | The person's user ID |
| `$CURRENT_USER_EMAIL` | The person's verified account email |
| `$CURRENT_USER_TEAMS` | The teams the person is on. Use with `IN` or `NOT_IN`. |
| `$CURRENT_USER_ROLES` | The names of the person's company roles. Use with `IN` or `NOT_IN`. |
| `$CURRENT_CUSTOMAPP_USER_ID` | A Custom Auth app visitor's account ID |
| `$CURRENT_CUSTOMAPP_ACCESS_LINK_ID` | A personal access link visitor's ID |
| `$CURRENT_CUSTOMAPP_USER.<column>` | A column of the signed-in app visitor's own row in the app's users table, for example `$CURRENT_CUSTOMAPP_USER.region` |

A placeholder the caller can't fill (for example `$CURRENT_USER_ID` for a public app visitor) matches no rows.

### Edit checks

Every role also says which rows its members may change:

| `writeCheck` | Updates are allowed on |
|---|---|
| `NONE` | Any row the member can see |
| `SAME_AS_READ` | Rows that still match the row rule after the change, so nobody can move a row out of what they're allowed to see. Default for roles created in the builder. |
| `CUSTOM` | Rows that match `writePredicate`, a second filter in the same shape as the row rule |

Inserts always have to fall inside what the caller can see: adding a row that the caller's own row rules would hide is refused, and nothing is saved.

### Columns you can't see

- A column that is **hidden** from the caller doesn't appear in the table's schema or in results.
- Filtering, sorting, grouping, aggregating, joining, or searching on a column that is hidden from the caller, or that the caller's role shows only as a mask, is refused with "You don't have access to column *name*." Row rules a table admin wrote can still use such columns.
- A reference to a row in another table that the caller can't see is treated as if that row doesn't exist.

### Errors

| Refusal | What to do |
|---|---|
| You don't have access to column *name*. | Remove that column from `where`, sort, aggregate, join, or search, or ask a table admin for a role that shows it. |
| A row you add, or change under an edit check, would fall outside the rows you can see. The error names the table. | Change the values so the row stays inside your access, or ask a table admin. |

---

## Knowledge Bases

## Create Knowledge Base **POST** `/create-knowledge-base`

Creates a knowledge base table pre-configured for semantic search and inserts one row per file. The new table has three columns: `full_path` (SHORT_TEXT), `file_name` (SHORT_TEXT, computed automatically from `full_path`), and `file` (FILE, vectorized for semantic search).

**Permission Required:** None at the table level — the endpoint creates a new table, so the API key authenticates at the company level.

### Query Parameters

- `resourceId` (string, required) — ID of an AutessaDB table the API key has access to. Required by the gateway even though a new table is created.

### Request Body

- `tableName` (string, required) — Name for the new knowledge base table.
- `files` — " required> Files to insert into the knowledge base, at least one. Each file has `fullPath` (string, the file's full path including folders) and `s3Uri` (string, the key returned for the uploaded file; the older `s3://` form is still accepted). Files are copied into the knowledge base's permanent storage.
  

  ### Response

  
  - `tableId` (string) — ID of the newly created knowledge base table.
  - `tableName` (string) — Name of the created table.
  - `filesInserted` (integer) — Number of files successfully inserted as rows.
  - `errors` — "> Array of error messages if any occurred.
  
  
  
  

**cURL:**

```bash
  curl --request POST \
    --url 'https://api.autessa.com/clients/autessadb/create-knowledge-base?resourceId=V1StGXR8Z5' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: your_api_key' \
    --data '{
      "tableName": "Product Docs",
      "files": [
        {
          "fullPath": "docs/getting-started.pdf",
          "s3Uri": "temp/knowledge_base/1024/3f9c2a7e"
        },
        {
          "fullPath": "docs/api-reference.pdf",
          "s3Uri": "temp/knowledge_base/1024/8b1d4c5f"
        }
      ]
    }'
```

**JavaScript:**

```javascript
const response = await fetch(
'https://api.autessa.com/clients/autessadb/create-knowledge-base?resourceId=V1StGXR8Z5',
{
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'your_api_key'
  },
  body: JSON.stringify({
    tableName: 'Product Docs',
    files: [
      {
        fullPath: 'docs/getting-started.pdf',
        s3Uri: 'temp/knowledge_base/1024/3f9c2a7e'
      }
    ]
  })
}
);

const data = await response.json();
console.log('Knowledge base table:', data.tableId);
```

**Python:**

```python
import requests

response = requests.post(
    'https://api.autessa.com/clients/autessadb/create-knowledge-base?resourceId=V1StGXR8Z5',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'your_api_key'
    },
    json={
        'tableName': 'Product Docs',
        'files': [
            {
                'fullPath': 'docs/getting-started.pdf',
                's3Uri': 'temp/knowledge_base/1024/3f9c2a7e'
            }
        ]
    }
)

data = response.json()
print('Knowledge base table:', data['tableId'])
```

```json title="JSON"
{
  "tableId": "kzT9pLm3Qw",
  "tableName": "Product Docs",
  "filesInserted": 2,
  "errors": []
}
```
  

---

## Data Manipulation

## Insert Row **POST** `/insert`

Inserts a new row into a table.

**Permission Required:** WRITE

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table (same as resourceId).
- `values` (object, required) — Column values to insert. Keys are column names, values are AutessaDbColumnValue objects.

### Response

- `insertedId` (integer) — The ID of the newly inserted row.
- `newRow` (object) — The complete inserted row data with all column values.
- `computationStatus` (string) — `"COMPUTING"` if computed fields are being calculated in the background.
- `errors` — "> Array of error messages if any occurred.
  
  
  
  

**cURL:**

```bash
  curl --request POST \
    --url 'https://api.autessa.com/clients/autessadb/insert?resourceId=V1StGXR8Z5' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: your_api_key' \
    --data '{
      "tableId": "V1StGXR8Z5",
      "values": {
        "name": {
          "columnType": "SHORT_TEXT",
          "textValue": "John Doe"
        },
        "age": {
          "columnType": "INTEGER",
          "integerValue": 30
        },
        "email": {
          "columnType": "SHORT_TEXT",
          "textValue": "john@example.com"
        }
      }
    }'
```

**JavaScript:**

```javascript
const response = await fetch(
'https://api.autessa.com/clients/autessadb/insert?resourceId=V1StGXR8Z5',
{
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'your_api_key'
  },
  body: JSON.stringify({
    tableId: 'V1StGXR8Z5',
    values: {
      name: {
        columnType: 'SHORT_TEXT',
        textValue: 'John Doe'
      },
      age: {
        columnType: 'INTEGER',
        integerValue: 30
      }
    }
  })
}
);

const data = await response.json();
console.log('Inserted ID:', data.insertedId);
```

```json title="JSON"
{
  "insertedId": 12345,
  "newRow": {
    "name": {
      "columnType": "SHORT_TEXT",
      "textValue": "John Doe"
    },
    "age": {
      "columnType": "INTEGER",
      "integerValue": 30
    },
    "email": {
      "columnType": "SHORT_TEXT",
      "textValue": "john@example.com"
    }
  },
  "errors": []
}
```
  

---

## Update Row **POST** `/update`

Updates an existing row in a table. Only the specified columns will be updated.

**Permission Required:** WRITE

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `rowId` (integer, required) — The ID of the row to update.
- `values` (object, required) — Column values to update. Only specified columns will be modified.

### Response

- `updatedId` (integer) — The ID of the updated row.
- `oldRow` (object) — Row data before the update.
- `newRow` (object) — Row data after the update.
- `computationStatus` (string) — `"COMPUTING"` if computed fields are being calculated.
- `errors` — "> Array of error messages if any occurred.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/update?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "rowId": 12345,
    "values": {
      "age": {
        "columnType": "INTEGER",
        "integerValue": 31
      }
    }
  }'
```

```json title="JSON"
{
  "updatedId": 12345,
  "oldRow": {
    "name": {
      "columnType": "SHORT_TEXT",
      "textValue": "John Doe"
    },
    "age": {
      "columnType": "INTEGER",
      "integerValue": 30
    }
  },
  "newRow": {
    "name": {
      "columnType": "SHORT_TEXT",
      "textValue": "John Doe"
    },
    "age": {
      "columnType": "INTEGER",
      "integerValue": 31
    }
  },
  "errors": []
}
```
  

---

## Batch Update Rows **POST** `/batch-update`

Updates multiple rows that match the specified WHERE conditions. All matching rows will be updated with the same values.

**Permission Required:** WRITE

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `values` (object, required) — Column values to update for all matching rows.
- `whereGroups` — " required> Array of WHERE condition groups to identify rows to update.
  - `groupsLogicalOperator` (string) — How to combine WHERE groups: `"AND"` or `"OR"`. Defaults to `"OR"`.
  

  ### Response

  
  - `updatedCount` (integer) — Number of rows that were updated.
  - `results` — "> Detailed results for each updated row (rowId, oldRow, newRow).
    - `computationStatus` (string) — `"COMPUTING"` if computed fields are being calculated.
    - `errors` — "> Array of error messages if any occurred.
    
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/batch-update?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "values": {
      "status": {
        "columnType": "SINGLE_SELECT",
        "textValue": "active"
      }
    },
    "whereGroups": [
      {
        "logicalOperator": "AND",
        "conditions": [
          {
            "columnName": "age",
            "operator": "GREATER_THAN",
            "value": 25
          }
        ]
      }
    ]
  }'
```

```json title="JSON"
{
  "updatedCount": 5,
  "results": [
    {
      "rowId": 12345,
      "oldRow": {...},
      "newRow": {...}
    },
    {
      "rowId": 12346,
      "oldRow": {...},
      "newRow": {...}
    }
  ],
  "errors": []
}
```
  

---

## Delete Row **POST** `/delete-row`

Deletes a single row from a table.

**Permission Required:** DELETE

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `rowId` (integer, required) — The ID of the row to delete.

### Response

- `deletedId` (integer) — The ID of the deleted row.
- `oldRow` (object) — The deleted row data.
- `errors` — "> Array of error messages if any occurred.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/delete-row?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "rowId": 12345
  }'
```

```json title="JSON"
{
  "deletedId": 12345,
  "oldRow": {
    "name": {
      "columnType": "SHORT_TEXT",
      "textValue": "John Doe"
    },
    "age": {
      "columnType": "INTEGER",
      "integerValue": 30
    }
  },
  "errors": []
}
```
  

---

## Batch Delete Rows **POST** `/batch-delete`

Deletes multiple rows that match the specified WHERE conditions.

**Permission Required:** DELETE

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `whereGroups` — " required> Array of WHERE condition groups to identify rows to delete.
  - `groupsLogicalOperator` (string) — How to combine WHERE groups: `"AND"` or `"OR"`. Defaults to `"OR"`.
  

  ### Response

  
  - `deletedCount` (integer) — Number of rows that were deleted.
  - `results` — "> Detailed results for each deleted row (rowId, oldRow).
    - `errors` — "> Array of error messages if any occurred.
    
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/batch-delete?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "whereGroups": [
      {
        "logicalOperator": "AND",
        "conditions": [
          {
            "columnName": "status",
            "operator": "EQUALS",
            "value": "inactive"
          },
          {
            "columnName": "lastLogin",
            "operator": "IS_NULL"
          }
        ]
      }
    ]
  }'
```

```json title="JSON"
{
  "deletedCount": 3,
  "results": [
    {
      "rowId": 12345,
      "oldRow": {...}
    },
    {
      "rowId": 12347,
      "oldRow": {...}
    },
    {
      "rowId": 12350,
      "oldRow": {...}
    }
  ],
  "errors": []
}
```
  

---

## Bulk Operations

The bulk endpoints write many rows in a single call — insert, update-by-id, and delete-by-id. Each returns a per-row result list so you can correlate individual outcomes, and each accepts mode fields that control failure handling and side effects.

> Bulk writes **suppress table triggers by default** — a deliberate divergence from single-row writes, whose triggers always fire. Bulk loads are typically ingestion where firing per-row triggers thousands of times is rarely intended. Set `triggerMode` to `"PER_ROW"` or `"BATCH_CONTEXT"` to opt in.

**Common mode fields** (all optional):

- `atomicity` (string) — `"ALL_OR_NOTHING"` (default) writes the whole call as one transaction — if any row fails a structural check, nothing is written. `"BEST_EFFORT_PER_CHUNK"` writes in chunks; a failing chunk is reported per-row and skipped while earlier chunks stay committed.
- `triggerMode` (string) — `"SUPPRESS"` (default), `"PER_ROW"`, or `"BATCH_CONTEXT"`. See the note above.
- `indexingMode` (string) — `"IMMEDIATE"` (default), `"DEFERRED"`, or `"SKIP"` — when semantic-search indexing of the written rows happens. (Insert and update only.)
- `computeMode` (string) — `"IMMEDIATE"` (default), `"DEFERRED"`, or `"SKIP"` — when computed fields are calculated. (Insert and update only.)

> The number of rows per bulk call is capped (a generous first-party limit). Requests above the cap are rejected; split very large loads across multiple calls. Read and aggregate endpoints are additionally rate-limited per company (see [Rate Limits](#rate-limits)).

## Bulk Insert Rows **POST** `/bulk-insert`

Inserts many rows into a table in a single call.

**Permission Required:** WRITE

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `rows` — " required> List of rows to insert. Each entry is a column-name → column-value map, the same shape as a single insert's `values`.
- `atomicity` (string) — See common mode fields above.
- `indexingMode` (string) — See common mode fields above.
- `computeMode` (string) — See common mode fields above.
- `triggerMode` (string) — See common mode fields above.

### Response

- `insertedCount` (integer) — Number of rows actually written.
- `results` — "> One entry per input row: `{ inputIndex, insertedId, newRow, errors }`. `inputIndex` is the row's position in the request so you can correlate; on failure `errors` is populated and `insertedId` is null.
- `computationStatus` (string) — `"COMPUTING"` if computed fields are being calculated in the background.
- `errors` — "> Top-level errors when the whole call was rejected (e.g. an `ALL_OR_NOTHING` validation failure).

```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/bulk-insert?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "rows": [
      { "name": { "columnType": "SHORT_TEXT", "textValue": "Ada" } },
      { "name": { "columnType": "SHORT_TEXT", "textValue": "Grace" } }
    ],
    "atomicity": "ALL_OR_NOTHING"
  }'
```

```json title="JSON"
{
  "insertedCount": 2,
  "results": [
    { "inputIndex": 0, "insertedId": 12345, "newRow": {...}, "errors": [] },
    { "inputIndex": 1, "insertedId": 12346, "newRow": {...}, "errors": [] }
  ],
  "computationStatus": null,
  "errors": []
}
```

---

## Bulk Update Rows By IDs **POST** `/bulk-update-by-ids`

Updates many rows by id in a single call. Each update is a partial patch — only the columns you supply change.

**Permission Required:** WRITE

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `updates` — " required> List of per-row updates. Each entry is `{ "id": <rowId>, "values": { ... } }`, where `values` is a partial column-name → column-value map.
- `atomicity` (string) — See common mode fields above.
- `indexingMode` (string) — See common mode fields above.
- `computeMode` (string) — See common mode fields above.
- `triggerMode` (string) — See common mode fields above.

### Response

- `updatedCount` (integer) — Number of rows actually written.
- `results` — "> One entry per input row: `{ inputIndex, updatedId, oldRow, newRow, errors }`. An id that is not found or outside your access is reported per-row in `errors`.
- `computationStatus` (string) — `"COMPUTING"` if computed fields are being recalculated in the background.
- `errors` — "> Top-level errors when the whole call was rejected.

```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/bulk-update-by-ids?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "updates": [
      { "id": 12345, "values": { "status": { "columnType": "SINGLE_SELECT", "textValue": "done" } } },
      { "id": 12346, "values": { "status": { "columnType": "SINGLE_SELECT", "textValue": "open" } } }
    ]
  }'
```

```json title="JSON"
{
  "updatedCount": 2,
  "results": [
    { "inputIndex": 0, "updatedId": 12345, "oldRow": {...}, "newRow": {...}, "errors": [] },
    { "inputIndex": 1, "updatedId": 12346, "oldRow": {...}, "newRow": {...}, "errors": [] }
  ],
  "errors": []
}
```

---

## Bulk Delete Rows By IDs **POST** `/bulk-delete-by-ids`

Deletes many rows by id in a single call. Only `atomicity` and `triggerMode` apply (there is nothing to index or compute on a delete).

**Permission Required:** DELETE

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `ids` — " required> List of row ids to delete.
- `atomicity` (string) — See common mode fields above.
- `triggerMode` (string) — See common mode fields above.

### Response

- `deletedCount` (integer) — Number of rows actually removed.
- `results` — "> One entry per input id: `{ inputIndex, deletedId, errors }`. An id that is not found or outside your access is reported per-row in `errors`.
- `errors` — "> Top-level errors when the whole call was rejected.

```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/bulk-delete-by-ids?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "ids": [12345, 12346, 12347]
  }'
```

```json title="JSON"
{
  "deletedCount": 3,
  "results": [
    { "inputIndex": 0, "deletedId": 12345, "errors": [] },
    { "inputIndex": 1, "deletedId": 12346, "errors": [] },
    { "inputIndex": 2, "deletedId": 12347, "errors": [] }
  ],
  "errors": []
}
```

---

## Data Retrieval

## Get Table Data **POST** `/get-data`

Retrieves paginated data from a table.

**Permission Required:** READ

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `orderBy` — "> Sort terms in priority order. Each is `{ "columnName": "...", "direction": "ASC" | "DESC" }` (direction defaults to `DESC`). Defaults to newest-updated first when omitted.
- `page` (integer) — Page number (1-based). Defaults to 1. Ignored when `cursor` is set.
- `pageSize` (integer) — Number of records per page. Defaults to 50. Maximum 100.
- `cursor` (string) — Opaque cursor from a prior response's `nextCursor`, for efficient seek pagination through large tables. When set, `page` is ignored and the same `orderBy` must be reused. A cursor is bound to the sort that produced it.
- `includeTotal` (boolean) — Whether to compute `totalRows`/`totalPages`. Offset requests default to `true`; cursor requests default to `false` (set `true` to force the count).

### Response

- `schema` (AutessaDbSchema) — The table schema definition.
- `rows` — "> Array of table rows with column data and metadata.
  - `currentPage` (integer) — Current page number.
  - `pageSize` (integer) — Number of rows per page.
  - `totalRows` (integer) — Total number of rows matching the request. `null` on a cursor request unless `includeTotal` was set.
  - `totalPages` (integer) — Total number of pages. `null` on a cursor request unless `includeTotal` was set.
  - `nextCursor` (string) — Cursor to fetch the next page; `null` when there are no more rows.
  - `hasMore` (boolean) — Whether another page exists beyond this one.
  - `errors` — "> Array of error messages if any occurred.
    
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/get-data?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "page": 1,
    "pageSize": 50
  }'
```

```json title="JSON"
{
  "schema": {
    "tableName": "users",
    "columnDefinitions": [
      {
        "columnName": "name",
        "columnType": "SHORT_TEXT",
        "required": true
      },
      {
        "columnName": "age",
        "columnType": "INTEGER",
        "required": false
      }
    ],
    "dbType": "DEFAULT"
  },
  "rows": [
    {
      "id": 12345,
      "columnData": {
        "name": {
          "columnType": "SHORT_TEXT",
          "textValue": "John Doe"
        },
        "age": {
          "columnType": "INTEGER",
          "integerValue": 30
        }
      },
      "createdAt": "2025-01-29T10:00:00",
      "updatedAt": "2025-01-29T15:30:00"
    }
  ],
  "currentPage": 1,
  "pageSize": 50,
  "totalRows": 150,
  "totalPages": 3,
  "errors": []
}
```
  

---

## Query Table Data **POST** `/query`

Queries table data with WHERE conditions and pagination.

**Permission Required:** READ

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `whereGroups` — " required> Array of WHERE condition groups for filtering.
  - `groupsLogicalOperator` (string) — How to combine WHERE groups: `"AND"` or `"OR"`. Defaults to `"OR"`.
  - `orderBy` — "> Sort terms in priority order. Each is `{ "columnName": "...", "direction": "ASC" | "DESC" }` (direction defaults to `DESC`).
  - `page` (integer) — Page number (1-based). Defaults to 1. Ignored when `cursor` is set.
  - `pageSize` (integer) — Records per page. Defaults to 50. Maximum 100.
  - `cursor` (string) — Opaque cursor from a prior response's `nextCursor` for seek pagination. When set, `page` is ignored and the same `orderBy` must be reused.
  - `includeTotal` (boolean) — Whether to compute `totalRows`/`totalPages`. Offset requests default to `true`; cursor requests default to `false`.
  

  ### Response

  Same structure as Get Table Data, but filtered by WHERE conditions — including `nextCursor` / `hasMore` for cursor pagination and nullable `totalRows` / `totalPages` on cursor requests.
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/query?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "whereGroups": [
      {
        "logicalOperator": "AND",
        "conditions": [
          {
            "columnName": "age",
            "operator": "GREATER_THAN_OR_EQUAL",
            "value": 18
          },
          {
            "columnName": "status",
            "operator": "EQUALS",
            "value": "active"
          }
        ]
      }
    ],
    "page": 1,
    "pageSize": 50
  }'
```

```json title="JSON"
{
  "schema": {...},
  "rows": [
    {
      "id": 12345,
      "columnData": {...},
      "createdAt": "2025-01-29T10:00:00",
      "updatedAt": "2025-01-29T15:30:00"
    }
  ],
  "currentPage": 1,
  "pageSize": 50,
  "totalRows": 25,
  "totalPages": 1,
  "errors": []
}
```
  

---

## Join Query **POST** `/join-query`

Performs JOIN operations across multiple tables with optional WHERE conditions.

**Permission Required:** READ (on all tables in the join)

### Query Parameters

- `resourceId` (string, required) — The ID of the main/left table.

### Request Body

- `tableId` (string, required) — The ID of the main/left table.
- `joins` — " required> Array of tables to join with and their join conditions.
  - `whereGroups` — "> Optional WHERE conditions applied after the join.
    - `groupsLogicalOperator` (string) — How to combine WHERE groups: `"AND"` or `"OR"`. Defaults to `"OR"`.
    - `orderBy` — "> Sort terms (main-table columns) in priority order. Each is `{ "columnName": "...", "direction": "ASC" | "DESC" }`.
    - `page` (integer) — Page number. Defaults to 1. Ignored when `cursor` is set.
    - `pageSize` (integer) — Records per page. Defaults to 50. Maximum 100.
    - `cursor` (string) — Opaque cursor from a prior response's `nextCursor` for seek pagination. When set, `page` is ignored and the same `orderBy` must be reused.
    - `includeTotal` (boolean) — Whether to compute `totalRows`/`totalPages`. Offset requests default to `true`; cursor requests default to `false`.
    

    ### Response

    Includes `nextCursor` / `hasMore` for cursor pagination; `totalRows` / `totalPages` are `null` on a cursor request unless `includeTotal` was set.

    
    - `mainSchema` (AutessaDbSchema) — Schema of the main/source table.
    - `joinedSchemas` (object) — Map of joined table ID to schema. Keys are the joined tables' raw numeric IDs.
    - `rows` — "> Joined rows with columns prefixed by table name. Each row includes `sourceTableId` (string), `sourceRowId` (integer), `columnData`, `createdAt`, and `updatedAt`.
      - `currentPage` (integer) — Current page number.
      - `pageSize` (integer) — Number of rows per page.
      - `totalRows` (integer) — Total number of joined rows.
      - `totalPages` (integer) — Total number of pages.
      - `errors` — "> Array of error messages if any occurred.
    
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/join-query?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "joins": [
      {
        "rightTableId": "3oPtLQmZ7v",
        "joinType": "INNER",
        "leftColumnName": "user_id",
        "rightColumnName": "id"
      }
    ],
    "whereGroups": [
      {
        "logicalOperator": "AND",
        "conditions": [
          {
            "columnName": "status",
            "operator": "EQUALS",
            "value": "active"
          }
        ]
      }
    ]
  }'
```

```json title="JSON"
{
  "mainSchema": {...},
  "joinedSchemas": {
    "790": {...}
  },
  "rows": [
    {
      "sourceTableId": "V1StGXR8Z5",
      "sourceRowId": 12345,
      "columnData": {
        "orders.order_id": {...},
        "orders.user_id": {...},
        "users.id": {...},
        "users.name": {...}
      },
      "createdAt": "2025-01-29T10:00:00",
      "updatedAt": "2025-01-29T15:30:00"
    }
  ],
  "currentPage": 1,
  "totalRows": 42,
  "totalPages": 1,
  "errors": []
}
```
  

---

## Aggregate **POST** `/aggregate`

Runs a grouped aggregation over a table: filter, group by up to a few columns, compute aggregates, optionally filter groups and sort, and return a capped set of groups.

**Permission Required:** READ

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `whereGroups` — "> Optional pre-aggregation filter (same shape as `query`).
- `groupsLogicalOperator` (string) — How to combine WHERE groups: `"AND"` or `"OR"`. Defaults to `"OR"`.
- `groupBy` — "> Columns to group by (a small maximum applies). Omit to aggregate the whole filtered set into a single group.
- `aggregates` — " required> The aggregates to compute. Each is `{ "function": "COUNT" | "SUM" | "AVG" | "MIN" | "MAX", "column": "...", "alias": "..." }`. `column` may be omitted for `COUNT` (counts rows). `alias` is required, must be unique, and is how the value is returned and referenced by `having` / `orderBy`.
- `having` — "> Post-aggregation filters on computed aggregates, referenced by `alias`. Each is `{ "alias": "...", "operator": "=" | "!=" | ">" | "<" | ">=" | "<=", "value": <number> }`. Multiple conditions are ANDed.
- `orderBy` — "> Sort by a `groupBy` column or an aggregate alias.
- `limit` (integer) — Maximum number of groups to return (clamped to the configured maximum).

### Response

- `groups` — "> One entry per group: `{ "key": { <groupByColumn>: <value> }, "values": { <alias>: <number> } }`. `key` is empty when there is no `groupBy`.
- `errors` — "> Array of error messages if any occurred.

> Columns hidden from your access are treated as not existing, and columns you may only see in masked form cannot be grouped or aggregated (the request is rejected). Aggregation is additionally rate-limited per company (see [Rate Limits](#rate-limits)).

```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/aggregate?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "groupBy": ["status"],
    "aggregates": [
      { "function": "COUNT", "alias": "count" },
      { "function": "AVG", "column": "age", "alias": "avg_age" }
    ],
    "orderBy": [{ "columnName": "count", "direction": "DESC" }]
  }'
```

```json title="JSON"
{
  "groups": [
    { "key": { "status": "active" }, "values": { "count": 120, "avg_age": 34.2 } },
    { "key": { "status": "inactive" }, "values": { "count": 30, "avg_age": 41.7 } }
  ],
  "errors": []
}
```

---

## Get Single Row **POST** `/get-single-row`

Retrieves a single row by ID with pre-signed URLs for FILE/IMAGE columns.

**Permission Required:** READ

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `rowId` (integer, required) — The ID of the row to retrieve.

### Response

- `schema` (AutessaDbSchema) — The table schema.
- `row` (TableRowDto) — Single row with presigned URLs for FILE/IMAGE columns (10-minute expiry).
- `errors` — "> Array of error messages if any occurred.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/get-single-row?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "rowId": 12345
  }'
```

```json title="JSON"
{
  "schema": {...},
  "row": {
    "id": 12345,
    "columnData": {
      "name": {
        "columnType": "SHORT_TEXT",
        "textValue": "John Doe"
      },
      "avatar": {
        "columnType": "IMAGE",
        "filePath": "autessadb/custom/cP2mK7dX4v/contacts/avatar/file/9a1e.jpg",
        "presignedUrl": "https://s3.amazonaws.com/..."
      }
    },
    "createdAt": "2025-01-29T10:00:00",
    "updatedAt": "2025-01-29T15:30:00"
  },
  "errors": []
}
```
  

---

## Semantic Search

## Search Table **POST** `/search`

Performs semantic vector search on a table column using embeddings. Searches use different strategies based on column type (SHORT_TEXT vs LONG_TEXT).

**Permission Required:** READ

**Note:** Columns must be indexed before they can be searched. Use `/index-record` to index rows.

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `query` (string, required) — The search query text.
- `columnName` (string, required) — The column name to search within.
- `limit` (integer) — Maximum number of results. Default: 10. Maximum: 100.
- `scoreThreshold` (number) — Minimum similarity score (0.0 to 1.0). Default: 0.0.
- `page` (integer) — Page number (1-based). Default: 1.
- `includeDetails` (boolean) — Whether to include detailed match information. Default: false.

### Response

- `schema` (AutessaDbSchema) — The table schema.
- `results` — "> Search results ordered by relevance (highest score first).
  - `totalResults` (integer) — Total number of results found (before pagination).
  - `currentPage` (integer) — Current page number.
  - `totalPages` (integer) — Total number of pages.
  - `metadata` (SearchMetadata) — Search metadata including query, column, strategy, execution time.
  - `errors` — "> Array of error messages if any occurred.
  
  
  
  

**cURL:**

```bash
  curl --request POST \
    --url 'https://api.autessa.com/clients/autessadb/search?resourceId=V1StGXR8Z5' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: your_api_key' \
    --data '{
      "tableId": "V1StGXR8Z5",
      "query": "machine learning engineer",
      "columnName": "job_description",
      "limit": 10,
      "scoreThreshold": 0.7
    }'
```

**JavaScript:**

```javascript
const response = await fetch(
'https://api.autessa.com/clients/autessadb/search?resourceId=V1StGXR8Z5',
{
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'your_api_key'
  },
  body: JSON.stringify({
    tableId: 'V1StGXR8Z5',
    query: 'machine learning engineer',
    columnName: 'job_description',
    limit: 10,
    scoreThreshold: 0.7
  })
}
);

const data = await response.json();
data.results.forEach(result => {
console.log(`Score: ${result.score}, ID: ${result.recordId}`);
});
```

```json title="JSON"
{
  "schema": {...},
  "results": [
    {
      "recordId": 12345,
      "score": 0.92,
      "rank": 1,
      "contentHash": "hash_abc",
      "rowData": {
        "job_title": {
          "columnType": "SHORT_TEXT",
          "textValue": "Senior ML Engineer"
        },
        "job_description": {
          "columnType": "LONG_TEXT",
          "textValue": "We are looking for..."
        }
      },
      "createdAt": "2025-01-29T10:00:00",
      "updatedAt": "2025-01-29T15:30:00",
      "details": {
        "embedType": "FULL",
        "allMatches": [
          {
            "embedType": "FULL",
            "score": 0.92
          }
        ]
      }
    }
  ],
  "totalResults": 25,
  "currentPage": 1,
  "totalPages": 3,
  "metadata": {
    "query": "machine learning engineer",
    "columnName": "job_description",
    "columnType": "LONG_TEXT",
    "searchStrategy": "HYBRID",
    "targetEmbeddingTypes": ["FULL", "CHUNK"],
    "executionTimeMs": 45
  },
  "errors": []
}
```
  

---

## File Upload

## Generate Upload Link **POST** `/generate-upload-link`

Generates a pre-signed S3 upload URL for file/image/video columns. Upload your file to the returned URL, then pass the returned `s3Uri` key as the column's `filePath` in insert/update operations (the older `s3://` form is still accepted).

**Permission Required:** WRITE

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `fileType` (string, required) — File extension. Supported: `DOCX`, `DOC`, `PDF`, `PPTX`, `XLSX`, `XLS`, `TXT`, `JSON`, `YAML`, `YML`, `XML`, `HTML`, `HTM`, `CSV`, `EML`, `MD`, `MARKDOWN`, `PNG`, `JPG`, `JPEG`, `GIF`, `WEBP`, `AVIF`, `BMP`, `ICO`, `TIFF`, `TIF`, `HEIC`, `HEIF`, `MP4`, `AVI`, `MOV`, `WMV`, `FLV`, `MKV`, `WEBM`, `MPEG`, `MPG`, `MP3`, `M4A`, `WAV`
- `columnName` (string, required) — The column name where the file will be stored.

### Response

- `uploadUrl` (string) — Pre-signed URL for uploading the file via PUT request.
- `s3Uri` (string) — Key of the uploaded file. Pass it as the column's `filePath` in insert/update requests.
- `expiresInSeconds` (integer) — Time in seconds until the upload URL expires.

```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/generate-upload-link?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "fileType": "PDF",
    "columnName": "resume"
  }'
```

```json title="JSON"
{
  "uploadUrl": "https://s3.amazonaws.com/autessa-files/...",
  "s3Uri": "autessadb/custom/cP2mK7dX4v/candidates/resume/3f9c2a7e.pdf",
  "expiresInSeconds": 3600,
  "errors": []
}
```

**1. Get Upload Link:**

```bash
# Already done above
```

**2. Upload File to S3:**

```bash
curl --request PUT \
  --url 'https://s3.amazonaws.com/autessa-files/...' \
  --header 'Content-Type: application/pdf' \
  --data-binary '@resume.pdf'
```

**3. Use the key in Insert:**

```bash
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/insert?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
"tableId": "V1StGXR8Z5",
"values": {
  "resume": {
    "columnType": "FILE",
    "filePath": "autessadb/custom/cP2mK7dX4v/candidates/resume/3f9c2a7e.pdf"
  }
}
  }'
```

---

## Indexing

## Index Record **POST** `/index-record`

Indexes a row for semantic search. Creates vector embeddings for SHORT_TEXT and LONG_TEXT columns. Required before searching.

**Permission Required:** WRITE

**Note:** Indexing happens automatically on insert/update for most columns, but you can manually trigger it with this endpoint.

### Query Parameters

- `resourceId` (string, required) — The ID of the table.

### Request Body

- `tableId` (string, required) — The ID of the table.
- `rowId` (integer, required) — The ID of the row to index.

### Response

- `recordId` (integer) — The ID of the indexed record.
- `columnsIndexed` (integer) — Number of columns that were indexed.
- `vectorsCreated` (integer) — Total number of vectors created.
- `indexingDurationMs` (integer) — Time taken for indexing in milliseconds.
- `indexedColumns` — "> Names of columns that were indexed.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/autessadb/index-record?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "tableId": "V1StGXR8Z5",
    "rowId": 12345
  }'
```

```json title="JSON"
{
  "recordId": 12345,
  "columnsIndexed": 3,
  "vectorsCreated": 15,
  "indexingDurationMs": 234,
  "indexedColumns": [
    "job_title",
    "job_description",
    "requirements"
  ],
  "errors": []
}
```
  

---

## Rate Limits

Read and aggregation endpoints (`get-data`, `query`, `join-query`, `aggregate`) are rate-limited per company on a rolling per-minute and per-day basis. The ceiling is generous for normal first-party use; if you exceed it the request is rejected and you should retry after a short back-off. Write endpoints are governed by the per-call bulk row cap rather than a request-rate limit.

---

## Column Types

AutessaDB supports various column types with different features:

- `SHORT_TEXT` — Short text (max 32,000 chars). **Vectorization enabled** for semantic search.
- `LONG_TEXT` — Long text (max 128,000 chars). **Vectorization enabled** for semantic search.
- `FILE` — File attachment. Use `/generate-upload-link` to upload.
- `IMAGE` — Image file (PNG, JPG, JPEG, GIF, WEBP, AVIF, BMP, ICO, TIFF, TIF, HEIC, HEIF). Every format except TIFF/TIF and HEIC/HEIF renders natively in an `<img>` tag, so you can point one at the cell's `presignedUrl` directly; for TIFF and HEIC offer a download instead, since most browsers will not paint them. Animated GIF and WEBP are stored and served intact and animate in the browser, but agent/LLM extraction reads the first frame only. SVG is not an IMAGE type — it is an executable document, so it belongs in a FILE column. Use `/generate-upload-link` to upload.
- `VIDEO` — Video file (MP4, AVI, MOV, etc.). Use `/generate-upload-link` to upload.
- `INTEGER` — Integer number.
- `FLOAT` — Floating point number.
- `BOOLEAN` — True/False value.
- `SINGLE_SELECT` — Single selection from predefined options.
- `MULTI_SELECT` — Multiple selections from predefined options.
- `DATETIME` — Legacy, read-only date/time type. Existing `DATETIME` columns (and the built-in `created_at`/`updated_at`) still read back their value, but new columns cannot be created with it — store timestamps as `SHORT_TEXT` holding UTC ISO-8601 strings (e.g. `2026-07-15T14:30:00Z`) instead.

---

## Append-Only Tables

A table can be configured as **append-only** (immutable / audit-grade): rows may be inserted and read, but never updated or deleted. When a table is append-only, every write beyond insert is rejected for all callers — `update`, `batch-update`, `bulk-update-by-ids`, `delete-row`, `batch-delete`, and `bulk-delete-by-ids` all return an error. This makes append-only tables well suited to audit trails and event logs where records must be tamper-evident.

The `schema` returned on every read call carries an `appendOnly` boolean so your app can tell whether a table is immutable before offering edit or delete actions. Append-only is a one-way setting — once on, it cannot be turned off — and is configured when the table is created (via the [poweruser Tables API](/docs/api/poweruser/autessadb-tables.md) or the builder), not through this row-level API.

---

## Indexed Columns

Columns can carry an **equality index** for faster filtering in `query` / `join-query` / `aggregate`. `INTEGER`, `FLOAT`, `BOOLEAN`, `SINGLE_SELECT`, and foreign-key columns are always indexed. `SHORT_TEXT` columns can opt in — once a `SHORT_TEXT` column is indexed, its values are length-capped to 2000 characters. `LONG_TEXT`, `MULTI_SELECT`, and media columns cannot be indexed.

Each column definition in a returned `schema` carries an `indexed` boolean. Indexes are configured at table creation or via a schema update (see the [poweruser Tables API](/docs/api/poweruser/autessadb-tables.md)); on a large table a newly requested index builds in the background and becomes usable once its build finishes.

### Column Value Format

Each column value is an object with the column type and appropriate value field:

**SHORT_TEXT / LONG_TEXT:**

```json
{
  "columnType": "SHORT_TEXT",
  "textValue": "Hello world"
}
```

**INTEGER:**

```json
{
  "columnType": "INTEGER",
  "integerValue": 42
}
```

**FLOAT:**

```json
{
  "columnType": "FLOAT",
  "floatValue": 3.14159
}
```

**BOOLEAN:**

```json
{
  "columnType": "BOOLEAN",
  "booleanValue": true
}
```

**SINGLE_SELECT:**

```json
{
  "columnType": "SINGLE_SELECT",
  "textValue": "option1"
}
```

**MULTI_SELECT:**

```json
{
  "columnType": "MULTI_SELECT",
  "multiSelectValue": ["option1", "option2", "option3"]
}
```

**DATETIME:**

```json
{
  "columnType": "DATETIME",
  "textValue": "2025-01-29T15:30:00"
}
```

**FILE / IMAGE / VIDEO:**

```json
{
  "columnType": "IMAGE",
  "filePath": "autessadb/custom/cP2mK7dX4v/contacts/avatar/file/9a1e.jpg"
}
```

---

## WHERE Conditions

### WhereGroupDto

- `logicalOperator` (string, required) — How to combine conditions within this group: `"AND"` or `"OR"`
- `conditions` — " required> List of conditions in this group

### WhereConditionDto

- `columnName` (string, required) — Column to filter on
- `operator` (string, required) — Comparison operator (see below)
- `value` (any) — Value to compare against (not needed for IS_NULL/IS_NOT_NULL)

### Supported Operators

- `EQUALS` — Exact match (=)
- `NOT_EQUALS` — Not equal (!=)
- `GREATER_THAN` — Greater than (>)
- `LESS_THAN` — Less than (<)
- `GREATER_THAN_OR_EQUAL` — Greater than or equal (>=)
- `LESS_THAN_OR_EQUAL` — Less than or equal (<=)
- `IN` — Value in list (value must be an array)
- `NOT_IN` — Value not in list (value must be an array)
- `IS_NULL` — Value is null (no value needed)
- `IS_NOT_NULL` — Value is not null (no value needed)
- `CONTAINS` — String contains substring
- `STARTS_WITH` — String starts with
- `ENDS_WITH` — String ends with

These 13 operators are the complete set — the query builder rejects anything
else. The same operators (and per-column-type support rules) are documented in
the [Poweruser AutessaDB reference](/docs/api/poweruser/autessadb-query.md).

### WHERE Examples

**Simple Condition:**

```json
{
  "whereGroups": [
    {
      "logicalOperator": "AND",
      "conditions": [
        {
          "columnName": "age",
          "operator": "GREATER_THAN",
          "value": 18
        }
      ]
    }
  ]
}
```

**Multiple Conditions (AND):**

```json
{
  "whereGroups": [
    {
      "logicalOperator": "AND",
      "conditions": [
        {
          "columnName": "age",
          "operator": "GREATER_THAN_OR_EQUAL",
          "value": 18
        },
        {
          "columnName": "status",
          "operator": "EQUALS",
          "value": "active"
        }
      ]
    }
  ]
}
```

**Multiple Groups (OR):**

```json
{
  "whereGroups": [
    {
      "logicalOperator": "AND",
      "conditions": [
        {
          "columnName": "role",
          "operator": "EQUALS",
          "value": "admin"
        }
      ]
    },
    {
      "logicalOperator": "AND",
      "conditions": [
        {
          "columnName": "role",
          "operator": "EQUALS",
          "value": "moderator"
        }
      ]
    }
  ],
  "groupsLogicalOperator": "OR"
}
```

**IS_NULL Check:**

```json
{
  "whereGroups": [
    {
      "logicalOperator": "AND",
      "conditions": [
        {
          "columnName": "deletedAt",
          "operator": "IS_NULL"
        }
      ]
    }
  ]
}
```

**String Operations:**

```json
{
  "whereGroups": [
    {
      "logicalOperator": "AND",
      "conditions": [
        {
          "columnName": "email",
          "operator": "ENDS_WITH",
          "value": "@example.com"
        },
        {
          "columnName": "name",
          "operator": "CONTAINS",
          "value": "John"
        }
      ]
    }
  ]
}
```

**IN Operator:**

```json
{
  "whereGroups": [
    {
      "logicalOperator": "AND",
      "conditions": [
        {
          "columnName": "status",
          "operator": "IN",
          "value": ["active", "pending", "verified"]
        }
      ]
    }
  ]
}
```

---

## JOIN Operations

### JoinConditionDto

- `rightTableId` (string, required) — The table to join with
- `joinType` (string) — Type of join: `"INNER"`, `"LEFT"`, `"RIGHT"`. Defaults to `"INNER"`.
- `leftColumnName` (string, required) — Column from the main/left table
- `rightColumnName` (string, required) — Column from the right table to join on

### JOIN Examples

**Simple INNER JOIN:**

```json
{
  "tableId": "V1StGXR8Z5",
  "joins": [
    {
      "rightTableId": "3oPtLQmZ7v",
      "joinType": "INNER",
      "leftColumnName": "user_id",
      "rightColumnName": "id"
    }
  ]
}
```

**Multiple JOINs:**

```json
{
  "tableId": "V1StGXR8Z5",
  "joins": [
    {
      "rightTableId": "3oPtLQmZ7v",
      "joinType": "INNER",
      "leftColumnName": "user_id",
      "rightColumnName": "id"
    },
    {
      "rightTableId": "9uYwXn4RtK",
      "joinType": "LEFT",
      "leftColumnName": "product_id",
      "rightColumnName": "id"
    }
  ]
}
```

**JOIN with WHERE:**

```json
{
  "tableId": "V1StGXR8Z5",
  "joins": [
    {
      "rightTableId": "3oPtLQmZ7v",
      "joinType": "INNER",
      "leftColumnName": "user_id",
      "rightColumnName": "id"
    }
  ],
  "whereGroups": [
    {
      "logicalOperator": "AND",
      "conditions": [
        {
          "columnName": "status",
          "operator": "EQUALS",
          "value": "completed"
        }
      ]
    }
  ]
}
```

---

## Complete Examples

### Create and Search Records

```javascript title="JavaScript"
// 1. Insert a record
const insertResp = await fetch(
  'https://api.autessa.com/clients/autessadb/insert?resourceId=V1StGXR8Z5',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'your_api_key'
    },
    body: JSON.stringify({
      tableId: 'V1StGXR8Z5',
      values: {
        job_title: {
          columnType: 'SHORT_TEXT',
          textValue: 'Senior Machine Learning Engineer'
        },
        job_description: {
          columnType: 'LONG_TEXT',
          textValue: 'We are seeking an experienced ML engineer to join our team...'
        },
        salary: {
          columnType: 'INTEGER',
          integerValue: 150000
        }
      }
    })
  }
);

const { insertedId } = await insertResp.json();

// 2. Index the record for search
await fetch(
  'https://api.autessa.com/clients/autessadb/index-record?resourceId=V1StGXR8Z5',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'your_api_key'
    },
    body: JSON.stringify({
      tableId: 'V1StGXR8Z5',
      rowId: insertedId
    })
  }
);

// 3. Search for similar jobs
const searchResp = await fetch(
  'https://api.autessa.com/clients/autessadb/search?resourceId=V1StGXR8Z5',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'your_api_key'
    },
    body: JSON.stringify({
      tableId: 'V1StGXR8Z5',
      query: 'machine learning position',
      columnName: 'job_description',
      limit: 10,
      scoreThreshold: 0.7
    })
  }
);

const searchData = await searchResp.json();
console.log('Found', searchData.totalResults, 'matching jobs');
searchData.results.forEach(result => {
  console.log(`${result.rowData.job_title.textValue} - Score: ${result.score}`);
});
```

### Batch Operations

```python title="Python"
import requests

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'your_api_key'
}

# Batch update all inactive users
update_resp = requests.post(
    'https://api.autessa.com/clients/autessadb/batch-update?resourceId=V1StGXR8Z5',
    headers=headers,
    json={
        'tableId': 'V1StGXR8Z5',
        'values': {
            'status': {
                'columnType': 'SINGLE_SELECT',
                'textValue': 'archived'
            }
        },
        'whereGroups': [
            {
                'logicalOperator': 'AND',
                'conditions': [
                    {
                        'columnName': 'status',
                        'operator': 'EQUALS',
                        'value': 'inactive'
                    },
                    {
                        'columnName': 'lastLogin',
                        'operator': 'IS_NULL'
                    }
                ]
            }
        ]
    }
)

data = update_resp.json()
print(f"Updated {data['updatedCount']} users")
```

### File Upload Workflow

```javascript title="JavaScript"
// 1. Generate upload link
const linkResp = await fetch(
  'https://api.autessa.com/clients/autessadb/generate-upload-link?resourceId=V1StGXR8Z5',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'your_api_key'
    },
    body: JSON.stringify({
      tableId: 'V1StGXR8Z5',
      fileType: 'PDF',
      columnName: 'resume'
    })
  }
);

const { uploadUrl, s3Uri } = await linkResp.json();

// 2. Upload file to S3
const fileData = await fetch('resume.pdf').then(r => r.blob());
await fetch(uploadUrl, {
  method: 'PUT',
  headers: { 'Content-Type': 'application/pdf' },
  body: fileData
});

// 3. Create record with file reference
await fetch(
  'https://api.autessa.com/clients/autessadb/insert?resourceId=V1StGXR8Z5',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'your_api_key'
    },
    body: JSON.stringify({
      tableId: 'V1StGXR8Z5',
      values: {
        name: {
          columnType: 'SHORT_TEXT',
          textValue: 'John Doe'
        },
        resume: {
          columnType: 'FILE',
          filePath: s3Uri
        }
      }
    })
  }
);
```

---

## Best Practices

### Performance

- Use pagination for large datasets
- Set appropriate `scoreThreshold` for search to filter low-quality results
- Use batch operations for multiple updates/deletes
- Index records immediately after insert for search availability

### Security

- Configure minimal required permissions on API keys
- Use environment variables for sensitive data
- Rotate API keys regularly
- Never expose API keys in client-side code

### Data Integrity

- Always check the `errors` array in responses
- Validate data before insertion
- Use transactions for related operations
- Monitor `computationStatus` for async operations

### Search Optimization

- Index all searchable text columns
- Use appropriate column types (SHORT_TEXT vs LONG_TEXT)
- Set reasonable `limit` values
- Use `scoreThreshold` to filter irrelevant results
- Check `metadata.executionTimeMs` to monitor performance

---

## Related

- [API Overview](/docs/api.md)
- [Agent API](/docs/api/agents.md)
- [Manager API](/docs/api/managers.md)
- [Tool API](/docs/api/tools.md)
- [Authentication](/docs/guide/authentication.md)
- [API Keys](/docs/guide/api-management/api-keys.md)

