# Connect Coze

Call AskTable to query data in Coze Agents or workflows.

使用指南 · 模块: integrations · 应用开发者 · 部署形态：资料未说明 · 已确认产品版本：资料未说明 · 来源：现有文档

Coze is ByteDance's Agent building platform. Add AskTable's official plugin so your Coze bot can query data sources already connected to AskTable using natural language. The plugin calls AskTable's REST API, so credentials and data scope remain managed on the AskTable side.

## Before you begin

- An AskTable project with connected data sources; note the data source ID (such as `ds_xxxxxxxx`). If you have none, [Connect data sources](https://docs.asktable.com/en/data/connect) first.
- An `asker` project API-Key: left main navigation → “Settings” → “API-Key” → “Create API-KEY”; choose `asker`. Its full value looks like `ASKER_xxxxxxxx` and is shown only once, on creation.
- A Coze account.
- Use the plugin with minimum permissions: do not use an `admin` Key.

## Steps

**Identify the official plugin**

Search **AskTable** in the Coze plugin store and select [Query Excel or databases with a sentence](https://www.coze.cn/store/plugin/7407079384349343784). It queries data sources already connected to AskTable, including Excel and databases.

**Add the plugin to an Agent**

Open Coze, create an Agent, and fill in its basic information. Find “Plugins” on the Agent editor page, click “+,” search AskTable, and add “Query Excel or databases with a sentence.”

**Create two variables**

Create two variables in the Agent's “Variables”:

| Variable name | Value                                                |
| ------------- | ---------------------------------------------------- |
| `at_auth`     | `Bearer YOUR_API_KEY`; note the space after `Bearer` |
| `at_ds_id`    | Your data source ID, such as `ds_xxxxxxxx`           |

**Bind plugin parameters to variables**

In the plugin parameter configuration:

- Bind `Authorization` to `at_auth`.
- `datasource_ids` is an array. Add an array item and bind its value to `at_ds_id`. To query multiple data sources at once, add multiple array items, each containing a data source ID.

**Debug using preview**

Ask a data question using preview and confirm that it returns results. The plugin does not pass a role, so its data scope covers the full contents of these data sources. Select only the minimum sources needed.

**Use the same configuration in workflows or chatflows**

Add an AskTable plugin node in a workflow or chatflow and use the same variable bindings: keep `Authorization` in `Bearer YOUR_API_KEY` format, and bind the array items of `datasource_ids` to `at_ds_id`.

## Key constraints

| Item                               | Value or default                                          | Where to change it                                         |
| ---------------------------------- | --------------------------------------------------------- | ---------------------------------------------------------- |
| API-Key type                       | `asker` (minimum permissions)                             | Coze `at_auth` variable; created in “Settings” → “API-Key” |
| `at_auth` format                   | `Bearer`, one space, then the Key                         | Coze “Variables”                                           |
| `at_ds_id` format                  | Data source ID, such as `ds_xxxxxxxx`                     | Coze “Variables”                                           |
| `datasource_ids`                   | Array; supports multiple data sources                     | Coze plugin parameter configuration                        |
| Role-based data scope restrictions | No role is passed; scope covers all selected data sources | Control by selecting data sources                          |
| Data source ID location            | Copy from “Data sources”                                  | Left main navigation → “More” → “Data sources”             |
| Project API-Key count              | Up to 10 per project                                      | “Settings” → “API-Key”                                     |

## Troubleshooting

| Symptom                                             | Identifying condition                                                     | Resolution                                                                                                    |
| --------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| Plugin call fails authentication                    | `at_auth` lacks the `Bearer ` prefix, or the Key was deleted              | Use `Bearer YOUR_API_KEY`; recreate in “Settings” → “API-Key” if needed                                       |
| Plugin reports data source not found                | `at_ds_id` is not a data source ID, or belongs to another project         | Copy the correct ID from “Data sources”                                                                       |
| Plugin returns empty results                        | No matching data exists, or the question lacks enough filters             | Confirm the same question returns results in web “Conversations,” then adjust the Coze wording                |
| Preview is rejected                                 | An `admin` Key is used, or the Key belongs to another project             | Use an `asker` Key from the target project                                                                    |
| Workflow node reports a parameter error             | `datasource_ids` is not an array, or its items are not bound to variables | Configure `datasource_ids` as an array and bind each item to `at_ds_id`                                       |
| Answer does not change after changing a data source | `at_ds_id` changed but plugin parameters still point to the old variable  | Confirm the item is bound to `at_ds_id` and that you changed the variable value rather than a plugin constant |

## Next steps

- Restrict data scope by role by passing `role_id` yourself: [OpenAPI](https://docs.asktable.com/en/integrations/openapi)
- Let AI clients call more AskTable capabilities directly: [MCP](https://docs.asktable.com/en/integrations/mcp)
- Connect data sources first: [Connect data sources](https://docs.asktable.com/en/data/connect)
