> For the complete documentation index, see [llms.txt](https://developer.celigo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.celigo.com/cli/commands/metadata.md).

# metadata

Connection metadata introspection — record types, sObjects, tables, and field/column definitions fetched live from the remote system through a configured Celigo connection.

**REST API**: no dedicated spec — metadata hits adaptor-specific paths under `/v1/netsuite/metadata/…`, `/v1/salesforce/metadata/…`, and the generic `PUT /v1/connections/{_id}/metadata` RDBMS bridge. See the specs index and `connection.yml` for the underlying connection shape.

```
celigo metadata <subcommand> <connectionId> [entityType] [flags]
```

Supports all [global flags](/cli/getting-started/global-flags.md). Auto-detects the adaptor from the connection's `type` — only `netsuite`, `salesforce`, and `rdbms` connections are supported.

***

## Subcommands

| Subcommand                           | Purpose                                                                                                                |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| `types <connectionId>`               | List entity types on a connection (NetSuite record types + saved searches, Salesforce sObject types, or RDBMS tables). |
| `fields <connectionId> <entityType>` | List fields/columns for a single entity (NetSuite record type, Salesforce sObject, or RDBMS table).                    |

***

## `celigo metadata types <connectionId>`

List the entity types available on a live connection. The CLI first `GET`s the connection, reads its `type`, and then dispatches to the correct adaptor endpoint.

**Signature**

```bash
celigo metadata types <connectionId> [--refresh]
```

**Arguments**

| Argument         | Type   | Required | Description                                                                                       |
| ---------------- | ------ | -------- | ------------------------------------------------------------------------------------------------- |
| `<connectionId>` | string | Yes      | Connection ID. Must resolve to a connection whose `type` is `netsuite`, `salesforce`, or `rdbms`. |

**Flags**

| Flag        | Type    | Default | Description                                                                                                                                                                                       |
| ----------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--refresh` | boolean | `false` | Bypass the server-side metadata cache and fetch fresh data from the remote system. Applied as `?refreshCache=true` for NetSuite/Salesforce and as `refreshCache: true` in the PUT body for RDBMS. |

**Example**

```bash
# NetSuite — record types + saved searches, merged into one list
celigo metadata types 5f83a9b2c7d3e8f1a2b3c4d5

# Salesforce — sObject types
celigo metadata types 5f83a9b2c7d3e8f1a2b3c4d5 --format json

# RDBMS — tables (force a fresh pull)
celigo metadata types 5f83a9b2c7d3e8f1a2b3c4d5 --refresh
```

**Corresponds to** (dispatched by connection `type`):

* NetSuite: `GET /v1/netsuite/metadata/suitescript/connections/{connectionId}/recordTypes` and `GET /v1/netsuite/metadata/suitescript/connections/{connectionId}/savedSearches`
* Salesforce: `GET /v1/salesforce/metadata/connections/{connectionId}/sObjectTypes`
* RDBMS: `PUT /v1/connections/{connectionId}/metadata` with body `{ "rdbms": { "type": "tables", "tables": "" }, "refreshCache": <bool> }`

***

## `celigo metadata fields <connectionId> <entityType>`

List fields (or columns) for a single entity. For Salesforce, the response includes related record types alongside the fields.

**Signature**

```bash
celigo metadata fields <connectionId> <entityType> [--refresh]
```

**Arguments**

| Argument         | Type   | Required | Description                                                                                                                                                                                                    |
| ---------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<connectionId>` | string | Yes      | Connection ID (`netsuite`, `salesforce`, or `rdbms`).                                                                                                                                                          |
| `<entityType>`   | string | Yes      | The entity to inspect. NetSuite: record-type id (e.g. `customer`, `salesorder`). Salesforce: sObject API name (e.g. `Account`, `Contact`). RDBMS: fully qualified table name (e.g. `analytics.public.orders`). |

**Flags**

| Flag        | Type    | Default | Description                                      |
| ----------- | ------- | ------- | ------------------------------------------------ |
| `--refresh` | boolean | `false` | Bypass the cache and fetch fresh field metadata. |

**Example**

```bash
# NetSuite record type
celigo metadata fields 5f83a9b2c7d3e8f1a2b3c4d5 customer

# Salesforce sObject
celigo metadata fields 5f83a9b2c7d3e8f1a2b3c4d5 Account --format json

# RDBMS (Snowflake) — must be fully qualified
celigo metadata fields 5f83a9b2c7d3e8f1a2b3c4d5 analytics.public.orders --refresh
```

**Corresponds to** (dispatched by connection `type`):

* NetSuite: `GET /v1/netsuite/metadata/suitescript/connections/{connectionId}/recordTypes/{entityType}`
* Salesforce: `GET /v1/salesforce/metadata/connections/{connectionId}/sObjectTypes/{entityType}`
* RDBMS: `PUT /v1/connections/{connectionId}/metadata` with body `{ "rdbms": { "type": "columns", "tables": "<entityType>" }, "refreshCache": <bool> }`

***

## Gotchas

* **Only three connection types are supported.** The CLI pre-flights with `GET /v1/connections/{id}` and rejects anything that isn't `netsuite`, `salesforce`, or `rdbms` with: `Connection <id> has type "<type>" — metadata is only supported for netsuite, salesforce, rdbms connections.`
* **`--refresh` invalidates the cached metadata.** Without it you get whatever the server cached on the last introspection. Pass it after a schema change in the remote system (new NetSuite custom field, new Salesforce custom object, new RDBMS column) to avoid stale pickers.
* **NetSuite `types` merges two endpoints.** Record types and saved searches come back as a single list with a synthesized `_metaType` column (`recordType` or `savedSearch`) so you can tell them apart.
* **Salesforce `fields` returns fields and record types together.** The response is an object with both — don't expect a flat array.
* **RDBMS goes through the generic connection metadata bridge.** NetSuite and Salesforce have dedicated `GET` endpoints; RDBMS is a `PUT /v1/connections/{id}/metadata` with a `rdbms.type` of `tables` or `columns`. The verb is `PUT` by design, not a typo.
* **RDBMS tables must be fully qualified.** For Snowflake/BigQuery/Postgres the entity name must be `database.schema.table` (or whatever the connection's default schema expects). If the call returns an empty column list, the CLI prints a yellow hint pointing at qualification and column-metadata permissions (e.g. BigQuery `bigquery.tables.get` on the dataset).
* **The connection must be reachable.** Metadata is fetched live — an offline or failing connection will return an error from the remote system, not an empty list. Run `celigo connections ping <id>` first when in doubt.

## Related

* [connections](/cli/commands/connections.md) — the `<connectionId>` argument; also where you configure the credentials the metadata calls ride on.
* [imports](/cli/commands/imports.md) — field pickers in import mappings consume the same metadata.
* [exports](/cli/commands/exports.md) — export field selection (NetSuite record-type fields, Salesforce sObject columns, RDBMS table columns) mirrors what `metadata fields` returns.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.celigo.com/cli/commands/metadata.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
