> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vertracloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# List Tables and Columns

> Lists the tables and views of a schema, and the columns and indexes of one table.

<Note>
  Every `/data` endpoint needs the **Intermediary** plan or higher, on the **database owner's**
  account — not the caller's. Below that the answer is `PLAN_RESTRICTED_FEATURE` (403).
  It is also **dashboard-session only**: an API key gets `API_KEY_SCOPE_DENIED` (403) here, regardless of
  its scopes.
</Note>

PostgreSQL and MySQL only.

<ParamField path="id" type="string" required>The ID of the database.</ParamField>

<ParamField query="schema" type="string" required>
  Schema to list. Must be one of the names returned by `/data/schemas` — anything else answers `OBJECT_NOT_FOUND`.
</ParamField>

<ParamField query="workspace" type="string">Workspace the database belongs to.</ParamField>

### Response

<ResponseField name="response" type="object[]">
  <Expandable title="Toggle object">
    <ResponseField name="schema" type="string">Schema the table belongs to.</ResponseField>
    <ResponseField name="name" type="string">Table name.</ResponseField>
    <ResponseField name="kind" type="string">`table` or `view`.</ResponseField>
    <ResponseField name="rows_estimate" type="number">Planner estimate. Counting for real would mean a full scan of the customer's table.</ResponseField>
    <ResponseField name="size_bytes" type="number">Data plus indexes.</ResponseField>
    <ResponseField name="columns_count" type="number">Number of columns.</ResponseField>
    <ResponseField name="indexes_count" type="number">Number of indexes.</ResponseField>
  </Expandable>
</ResponseField>

***

## Columns and indexes

<ParamField header="GET" type="string">
  `/v1/databases/{id}/data/tables/{table}/columns?schema=`
</ParamField>

Returns `{ columns, indexes }`. Each column carries `name`, `data_type`, `nullable`, `default_value`,
`is_primary_key`, `is_unique`, `is_foreign_key` and, for a foreign key, `references`
(`{ schema, table, column }`). Each index carries `name`, `columns`, `unique`, `primary` and `size_bytes`.

<ResponseExample>
  ```json 200 theme={null}
  {
    "response": {
      "columns": [
        { "name": "id", "data_type": "integer", "nullable": false, "default_value": null, "is_primary_key": true, "is_unique": false, "is_foreign_key": false }
      ],
      "indexes": [
        { "name": "users_pkey", "columns": ["id"], "unique": true, "primary": true, "size_bytes": 16384 }
      ]
    }
  }
  ```
</ResponseExample>
