# Add a knowledge source

```http
POST https://trydimmi.com/api/v1/knowledge/sources
```

## Authorization

Send an API token as `Authorization: Bearer <token>`.
The token needs: `settings:write`.

## Body

- `exclude` (string[] | null): Patterns of documents to leave out, up to 50.
- `help_center_id` (string): Help center (hc_...) an import or a help_center target writes to. Find it with GET /help-centers.
- `include` (string[] | null): Patterns of documents to read, up to 50; empty reads everything.
- `mode` (string): sync keeps reading it for the agents; import turns it once into help center articles. Read on create only. One of: `sync`, `import`, ``.
- `name` (string): A name for the team, up to 80 characters.
- `schedule` (string): manual, hourly, daily or weekly, as the type allows. One of: `manual`, `hourly`, `daily`, `weekly`, ``.
- `settings` (object): The object the type's settings schema describes, secrets included.
- `sync_now` (boolean): true starts a sync as soon as it is saved.
- `targets` (string[] | null): What it feeds: agent, operator and help_center. Defaults to agent and operator for sync, help_center for import.
- `type` (string): Source type, from GET /knowledge/source-types. Read on create only.

## Response 201 (Created)

- `data` (object, required)
  - `counts` (object, required): How many of the source's documents are in each status, keyed by status, such as {"active": 120, "excluded": 4}.
  - `created_at` (string, required): When it was created, as an RFC 3339 time, such as 2026-01-31T09:00:00Z.
  - `document_count` (integer, required): How many documents the source holds.
  - `exclude` (string[] | null, required): Path patterns of documents to leave out; empty when none.
  - `help_center_id` (string | null, required): Id of the help center the source's documents go to, starting with hc_. Set when the mode is import or help_center is a target; null otherwise.
  - `id` (string, required): The id of this record. Send it wherever an endpoint asks for this record; never use its name or title in its place.
  - `include` (string[] | null, required): Path patterns of documents to keep; empty keeps everything.
  - `last_error` (string | null, required): What went wrong in the last sync, in words. Null when there is no error.
  - `last_error_code` (string | null, required): Short code of the last sync's error. Null when there is no error.
  - `last_run` (object, required)
    - `created_at` (string, required): When it was created, as an RFC 3339 time, such as 2026-01-31T09:00:00Z.
    - `error` (string | null, required): Why the run failed, in words. Null when it did not.
    - `error_code` (string | null, required): Short code of the run's error. Null when it did not fail.
    - `finished_at` (string | null, required): When the run ended. Null while it is queued or running.
    - `full_run` (boolean, required): True when the run reads the whole source and removes documents it no longer finds; false for a partial run.
    - `id` (string, required): The id of this record. Send it wherever an endpoint asks for this record; never use its name or title in its place.
    - `object` (string, required): The kind of record this is, the same for every record of its kind, such as article.
    - `source_id` (string, required): Id of the knowledge source the run belongs to, starting with ks_.
    - `started_at` (string | null, required): When the run began. Null while it is still queued.
    - `stats` (any, required): The run's counters as an object of numbers, such as created, updated, unchanged and removed documents.
    - `status` (string, required): Where the run stands: queued, running, succeeded, partial, failed or canceled.
    - `trigger` (string, required): What started the run: create, manual, schedule, webhook, retry or document.
  - `last_success_at` (string | null, required): When a sync last succeeded. Null when none has yet.
  - `last_synced_at` (string | null, required): When the source was last synced, whether or not it succeeded. Null when it never was.
  - `mode` (string, required): How the source is used: sync keeps a read-only copy refreshed on a schedule; import copies it once into editable help center articles.
  - `name` (string, required): The name the team gave this source.
  - `next_sync_at` (string | null, required): When the next scheduled sync is due. Null when none is planned, as with a manual schedule.
  - `object` (string, required): The kind of record this is, the same for every record of its kind, such as article.
  - `schedule` (string, required): How often the source is synced: manual, hourly, daily or weekly.
  - `secrets_set` (string[] | null, required): Names of the secret settings that have a value saved; the values themselves are never shown. Empty when none.
  - `settings` (any, required): The source's own settings without its secrets, an object shaped by the settings schema of its type, such as a website's start address.
  - `status` (string, required): Where the source stands: idle, queued, syncing, error (see last_error) or paused.
  - `targets` (string[] | null, required): Who reads the source's documents: any of agent (the AI agent), operator and help_center.
  - `type` (string, required): What kind of source it is, such as website, notion, github, markdown_upload, zendesk_help_center or intercom_help_center.
  - `updated_at` (string, required): When it last changed, as an RFC 3339 time, such as 2026-01-31T09:00:00Z.

## Response default (Error)

- `code` (string, required): Stable code for programs to tell errors apart, such as validation_failed or internal_error.
- `errors` (object): Each rejected field mapped to its messages. Only present when the input was invalid.
- `message` (string, required): What went wrong, in words safe to show a person.

## Example request

```bash
curl --request POST \
  --url 'https://trydimmi.com/api/v1/knowledge/sources' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "exclude": [
    "<string>"
  ],
  "help_center_id": "<string>",
  "include": [
    "<string>"
  ],
  "mode": "sync",
  "name": "<string>",
  "schedule": "manual",
  "settings": {
    "<key>": null
  },
  "sync_now": true,
  "targets": [
    "<string>"
  ],
  "type": "<string>"
}'
```

## Example response

```json
{
  "data": {
    "counts": {
      "<key>": 123
    },
    "created_at": "2026-11-01T09:30:00Z",
    "document_count": 123,
    "exclude": [
      "<string>"
    ],
    "help_center_id": "<string>",
    "id": "<string>",
    "include": [
      "<string>"
    ],
    "last_error": "<string>",
    "last_error_code": "<string>",
    "last_run": {
      "created_at": "2026-11-01T09:30:00Z",
      "error": "<string>",
      "error_code": "<string>",
      "finished_at": "2026-11-01T09:30:00Z",
      "full_run": true,
      "id": "<string>",
      "object": "<string>",
      "source_id": "<string>",
      "started_at": "2026-11-01T09:30:00Z",
      "stats": null,
      "status": "<string>",
      "trigger": "<string>"
    },
    "last_success_at": "2026-11-01T09:30:00Z",
    "last_synced_at": "2026-11-01T09:30:00Z",
    "mode": "<string>",
    "name": "<string>",
    "next_sync_at": "2026-11-01T09:30:00Z",
    "object": "<string>",
    "schedule": "<string>",
    "secrets_set": [
      "<string>"
    ],
    "settings": null,
    "status": "<string>",
    "targets": [
      "<string>"
    ],
    "type": "<string>",
    "updated_at": "2026-11-01T09:30:00Z"
  }
}
```

---

Index of all dimmi docs: https://trydimmi.com/llms.txt (full text: https://trydimmi.com/llms-full.txt)
