# Sync connectors

URL: https://docs.hanzo.ai/docs/openapi/knowledge/post-knowledge-connectors-by-provider-sync

> Pulls the provider's documents for the caller's org and files them as knowledge sources, which the store's own hook then indexes — so a synced document is retrievable exactly like a hand-written page.

`POST /v1/knowledge/connectors/{provider}/sync`

> [Knowledge →](https://docs.hanzo.ai/docs/openapi/knowledge) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                                |
| ------------- | -------------------------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/knowledge/connectors/{provider}/sync` |
| **Method**    | `POST`                                                         |
| **Operation** | `post_knowledge_connectors_by_provider_sync`                   |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`                         |

Pulls the provider's documents for the caller's org and files
them as knowledge sources, which the store's own hook then indexes — so a
synced document is retrievable exactly like a hand-written page. The org is the
validated tenant and the credential is read from KMS, so an org can only ever
sync its own connection. A provider failure is reported honestly (502) and
recorded on the connector rather than silently swallowed.

## Request

1 field.

| Field      | In   | Type   | Required | Description                                                           |
| ---------- | ---- | ------ | -------- | --------------------------------------------------------------------- |
| `provider` | path | string | yes      | Provider is the connector to act on: github, slack, google or notion. |

## Response

| Status    | Body                | Meaning |
| --------- | ------------------- | ------- |
| `200`     | knowledge.kbSyncOut | ok      |
| `default` | problem-details     | refused |

`200` body — 2 fields.

| Field      | In   | Type            | Always | Description                                                         |
| ---------- | ---- | --------------- | ------ | ------------------------------------------------------------------- |
| `ingested` | body | integer (int64) | —      | Ingested is how many documents landed in the org's knowledge store. |
| `provider` | body | string          | —      | Provider is the connector that was pulled.                          |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo knowledge connectors sync <provider>
```

**SDK**

**.ts**

```ts
import { Configuration, KnowledgeApi } from 'hanzoai';

const api = new KnowledgeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postKnowledgeConnectorsByProviderSync({ provider: 'provider' });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import KnowledgeApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = KnowledgeApi(client).post_knowledge_connectors_by_provider_sync(provider='provider')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.KnowledgeAPI.PostKnowledgeConnectorsByProviderSync(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, knowledge_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = knowledge_api::post_knowledge_connectors_by_provider_sync(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.KnowledgeApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new KnowledgeApi(client).postKnowledgeConnectorsByProviderSync();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/knowledge/connectors/<provider>/sync \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

MCP reaches **knowledge** through the `knowledge` tool, which names its 9 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_knowledge_connectors"
         }
       }
     }'
```

---

[Knowledge API](https://docs.hanzo.ai/docs/openapi/knowledge) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
