> This page is for version 2025-09-18 (default).
> For other versions, use one of these documentation indexes:
> - 2025-09-18 (default): https://apidocs.polytomic.com/2025-09-18/llms.txt
> - 2024-02-08: https://apidocs.polytomic.com/2024-02-08/llms.txt
> - 2023-04-25: https://apidocs.polytomic.com/2023-04-25/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.polytomic.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.polytomic.com/_mcp/server.

Harbors are governed data environments for AI agents. Each Harbor stores the
data you sync into it, is isolated from every other Harbor, and has its own MCP
server and access control list. Agents query and act on Harbor data without
credentials for the source systems or access to anything outside the Harbor.

With Connect, provision one Harbor per customer and connect the AI agent in your
product to it.

## Set it up

1. **Authenticate the customer's systems** with [hosted](/guides/connect/hosted)
   or [embedded](/guides/connect/embedded) authentication, in the customer's
   organization.
2. **Create a Harbor** in that organization with
   [`POST /api/harbors`](/api-reference/harbors/create). Set
   `backing_mode: "managed"` to have Polytomic provide the data store. The
   response includes the Harbor's API key, shown only once, along with its
   `backing_connection_id` and `mcp_server_url`.
3. **Sync data in.** [Create a bulk sync](/api-reference/bulk-sync/create) from
   each customer connection to the Harbor's backing connection. Filter at the
   source so the Harbor only holds what your agent needs. See
   [Polytomic Harbor](/guides/configuring-your-connections/connections/polytomic_harbor)
   for destination settings.
4. **Add context.** Create a
   [context document](/api-reference/harbors/create-context) describing the
   tables, definitions and caveats. Agents load it automatically when they
   connect.
5. **Connect your agent** to the Harbor's MCP server, or query with the Harbor's
   API key using
   [`POST /api/harbors/{harbor_id}/query`](/api-reference/harbors/run-query).

```bash
curl -X POST https://app.polytomic.com/api/harbors/$HARBOR_ID/query \
  -H "Authorization: Bearer $HARBOR_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Polytomic-Activity-Request-ID: $(uuidgen)" \
  -d '{"query": "SELECT name, amount FROM opportunities LIMIT 10"}'
```

Queries run asynchronously. Poll the returned query ID with
[`GET /api/queries/{id}`](/api-reference/query-runner/get-query) for results.

## More capabilities

* **Write back.** Let agents look up and update records in source systems,
  scoped to the operations and fields an administrator enables. Requires Harbor
  Actions on your account.
* **Saved queries.** Publish named, parameterized queries for agents to run.
* **Access control.** [Invite users](/api-reference/harbors/invite-user) who can
  use the Harbor from their own AI tools, without access to the rest of
  Polytomic.
* **Your own data.** Sync your data into a customer's Harbor, or sync Harbor
  data into your systems.
* **Freshness.** Check when each dataset was last refreshed.
* **Customer-managed storage.** Set `backing_mode: "customer_managed"` to use an
  existing connection as the data store.

See the [Harbors API reference](/api-reference/harbors/list) for every endpoint,
and [polytomic.com/harbor](https://www.polytomic.com/harbor) for use cases.