Skip to content

Connector sync API

The connector sync API pulls documents from an external content source — a SharePoint drive, a Confluence space or a Jira project — into one project's knowledge base. A source is registered once against a project and a connector, then kept current in two ways: an explicit "Sync now" request at any time, and an automatic scheduled re-sync on a per-source cadence (new sources default to every 24 hours; see Automatic re-sync below).

All endpoints require an authenticated admin session (aig_admin cookie). The base URL is https://ai-api-admin.myra.eu/admin/v1. Access is governed by the target project's per-project membership: owner, editor, viewer.


Overview

A sync source binds one project to one selection in an external system:

  • a SharePoint drive, reached through a Microsoft Graph-scoped OAuth connector (delegated, see the setup note below), or
  • a Confluence space, reached through the Atlassian MCP connector, or
  • a Jira project, reached through the same Atlassian MCP connector. Each issue becomes one markdown document (title, status, description and comments); the document is re-imported when the issue's updated timestamp changes, and issues deleted in Jira are tombstoned after the next completed crawl.

Running a source performs a pull crawl of that one selection into the target project's knowledge base — the same knowledge store used by uploaded files, so synced documents are read, cited, and retrieved exactly like any other project knowledge. The sync is incremental and replacing: a re-sync brings changed and new items up to date and tombstones items that have been removed at the source, so the project's copy tracks the source rather than accumulating stale documents.

Updating a document does not take it away while the update runs. When a document has changed at the source, the new version is prepared alongside the existing one and swapped in only once its content is stored. If the download or the storage step fails, the previous version stays exactly where it is and remains readable, citable and retrievable; the crawl reports the item as skipped and retries it on the next pass. A document you filed into a folder also keeps that folder when the source updates it.

Two limits are worth knowing. If the source replaces a document with a file type the extractor cannot read, there is nothing to index and the document is removed (counted as skipped, like any unsupported file). And if the swap is interrupted after the new version is stored, the document stays available but may briefly show a placeholder name beginning .aig-restage-; the next sync restores its proper name.

A synced password-protected PDF (encrypted with a user password) cannot be read: it is staged and then terminal-fails extraction, and its ingest trace records a password-protected reason (rather than a generic extraction failure) so the cause is diagnosable. An owner-password-only PDF (readable without a password) ingests normally.

A synced (or uploaded) PowerPoint presentation without any text — typically a deck whose slides are only pictures — also terminal-fails extraction; its ingest trace records a no readable text reason instead of a generic extractor exit, so it is clear the file is fine but holds nothing to index.

For a source that carries its own access permissions (SharePoint), those permissions are re-read for the updated document. If that lookup fails, the update still goes through, and the document's permissions are re-read on a later sync — the same fail-closed behaviour as any newly synced document: while the permissions are unknown, the document is not shown.

Tombstoning is fail-safe against transient errors. A document is tombstoned only when the crawl positively confirms it is gone at the source — never merely because a transient fault (a database blip, a per-item download error, or a malformed source response) prevented the crawl from confirming it this pass. If any such error occurs during a crawl, the end-of-crawl removal step is suppressed for that whole crawl (including across a paused/resumed crawl): every already-indexed document is kept, and removed items are reaped on the next fully clean crawl instead. The trade-off is deliberate — the gateway always errs toward keeping your documents. The count of items a crawl could not process is surfaced as items_skipped (the "could not be imported" notice), so a persistently failing item that keeps deferring removal is visible. (A benign skip — an unsupported file type the extractor can't read — is a positive outcome, not an error, and does not suppress removal.)

A crawl is resumable. It records a cursor and pauses cleanly, then continues from where it stopped on the next run, when either of two limits is hit:

  • Rate limit — the upstream returns 429; the gateway honours Retry-After and does not run the source again until that backoff has elapsed. The source status becomes paused_rate_limited.
  • Per-tenant ingest cap — at most 50 documents are ingested per tenant in one pass; when the cap is reached the crawl pauses with status paused_cap and is resumable on the next run. The cap counts only in-flight documents in live projects — documents left processing in a soft-deleted project do not consume it.

A paused crawl (either kind) is picked up again automatically on the next scheduled re-sync tick, or immediately by a manual "Sync now" — a large drive fills in over several passes rather than in one.

Source status

Status Meaning
idle Registered, not currently running; ready to sync.
running A crawl is in progress.
completed The last crawl finished with no items left to fetch.
error The last crawl failed; see last_error.
paused_cap Paused after reaching the per-tenant ingest cap (50); resumable.
paused_rate_limited Paused on an upstream 429; resumable on the next run once the Retry-After backoff has elapsed.

provider is one of sharepoint, confluence, jira, or url.

The url provider (a public website) has no credential holder — it takes no connector_id, and its source_ref is the page URL itself. The gateway fetches the page over its SSRF-guarded HTTP client, extracts the readable text, and indexes it into the project knowledge base exactly like an uploaded document; a re-sync re-fetches the same URL and re-indexes only if the page changed.


Access-control stance

Read this before syncing anything.

SharePoint per-item source permissions ARE mirrored. At sync time the gateway captures each SharePoint document's per-item ACL (Microsoft Graph /permissions) and, at retrieval, filters synced documents per requesting user by that source ACL, fail-closed. A document a user cannot open in SharePoint is not findable, readable, or citable to them here either — across every surface (chat retrieval / search_knowledge, the file browser, item preview, and download). A synced document whose source ACL could not be captured is hidden, never shown. A gateway admin does not bypass the source ACL.

  • Accepted principal shapes (SharePoint): a Graph grant to a user (matched by the requester's Entra object id — their SCIM externalId, or their OIDC subject when the tenant maps subject_claim=oid); a grant to a group (matched via the SCIM/IdP group mapping); an organization-wide / "Everyone" grant (any member of the same tenant); a "specific people" sharing link (expanded to the individual users). Anonymous-scope and organization links map to the same-tenant "everyone" grant. Rejected / dropped (fail-closed): unrecognised principal shapes and — for a user whose Entra object id is not known to the gateway (no SCIM externalId and not an oid-claim tenant) — a per-user grant by oid simply does not match (they under-serve, never over-serve).
  • Sign-ins without an Entra object id (Okta, SAML, other OIDC IdPs): a grant that names a person by e-mail matches the requester's IdP-verified sign-in e-mail (stored on their SSO link, only for the tenant's configured OIDC/SAML issuer, refreshed at every sign-in; if the IdP later sends an unverified (any email_verified other than absent or true) or disallowed address, the stored one is cleared). Outside Entra (generic OIDC, Okta, Keycloak) only the IdP's email claim may set or refresh that stored address: preferred_username and upn are never used for it, because on some IdPs (for example Keycloak with username editing enabled) a user can set their own username to a colleague's address and would otherwise inherit that colleague's SharePoint access. If the email claim is missing, no address is stored on first sign-in and the stored one is cleared on the next sign-in (the user can still sign in; they just get no e-mail-based document access). Entra sign-ins keep their current behaviour. For SAML the stored address is the assertion's email attribute; the NameID is used only when its format is emailAddress (a username-format NameID can be user-editable), and with no usable source nothing is stored and the stored address is cleared on the next sign-in. The email field on the gateway user record is never used because an admin can edit it. A SCIM-only or local-password user has no SSO link and therefore no e-mail match. The match assumes Graph mail/UPN is unique per person.
  • Group grants by membership snapshot: with the optional delegated scope GroupMember.Read.All, the daily crawl snapshots each referenced group's transitive member e-mails, so group grants also reach SSO-linked users without a group mapping. Existing connectors are not migrated: until re-consented, a refused (403) membership read leaves today's behaviour. A transient failure (throttling, 5xx, network) keeps the group's previous snapshot; a 403/404/410 removes it; a group with members but no resolvable e-mails is also treated as a failure (the previous snapshot is kept and a warning is logged). Snapshots are kept per sync source, so one source's cleanup never removes a group another source still references. Groups no longer referenced are removed only by the run that completes the crawl without permission-fetch failures; this also holds when the crawl spanned several paused or resumed runs, since each run stamps the groups it saw with the crawl's start time. A group whose membership read failed transiently is stamped the same way (its previous snapshot is kept), and a run with any permission-fetch failure stamps every remaining group, so a later run of the same crawl never prunes either; the next crawl (a newer start time) removes groups that are no longer referenced. Snapshots are as fresh as the last crawl (daily).
  • Freshness: SharePoint permissions are re-captured on every "Sync now", including for unchanged documents. A revoked user loses access on the next sync run that completes past that document.

Confluence and Jira default to the sync creator only, with an admin org-wide opt-in. (Jira follows exactly the same rules as Confluence below, except that it has no per-user grants: the per-user grant refresh is Confluence-only.)

Confluence: The Confluence connector does not read per-page restrictions, so by default a Confluence-synced document is visible only to the user who created the sync source — no other project member can read or cite it (fail-closed).

A tenant admin may instead publish a Confluence source org-wide (share_scope: "org", via the share endpoint below). When published, every page that source synced becomes readable and citable to everyone who can open the project — including pages that are restricted in Confluence. This is deliberate admin curation, not permission mirroring: the tenant admin takes responsibility for exposing those pages tenant-wide. It never crosses tenant boundaries (a source is only ever reachable within its own tenant's project). Reverting to creator restores the creator-only default instantly (no re-sync needed). A Confluence page is also visible to a user who holds a per-user grant for it (knowledge_user_grant), in addition to the creator default and the admin org-share above. Grants never cross tenants: a grant only counts when the source, the grant and the user all belong to the same tenant, and only for Confluence sources. Grants are populated per user by the per-user grant refresh below; until a refresh has run for a user, that user holds no grants and behaviour is unchanged. Grants reflect the last grant sync, not a live Confluence check: a revocation in Confluence takes effect on the next refresh or an explicit grant drop, not instantly. A grant's page id must be 1–255 characters from [A-Za-z0-9._:-] (Confluence page ids are numeric); a grant set with any malformed id — empty, too long, whitespace, accented or control characters, or not a list — is rejected as a whole and the user's previous grants are kept. Ids that differ only in letter case count as the same page.

Per-user grant refresh (Confluence)

For one (tenant, user, Confluence source) the gateway asks Confluence which pages of the source's space that user can see, using the user's own Atlassian connection (never the sync creator's), intersects the answer with the pages the source actually synced, and replaces the user's grants with the result. It is fail-closed: any outcome other than granted removes the user's grants for that source before returning, so a grant never outlives a failed re-check.

Outcome Meaning Grants
granted The visible pages were read and the synced subset stored (possibly zero pages). replaced
no_connection The user has no Atlassian connection for the source's connector (or the connector is gone). dropped
unsupported_connector The connector is not a shared, user-scoped Atlassian (v2) connector. Reasons: not_user_scoped (tenant-scoped, or an auth type other than bearer/header), not_shared (a member-owned private connector, which only its owner can use), v1_connector (legacy), not_atlassian_v2 (foreign or custom URL). dropped
user_ineligible The account is disabled or deleted, or its processing is restricted. No Confluence call is made. dropped
rejected The Confluence reply was malformed, oversized or looped. dropped
check_failed The check itself failed: expired or denied credential, rate limit, transport error, a tool error, or an unreadable connector or staged-page list. An invalid source source_ref is check_failed with reason invalid_source_ref; a legacy source stored as a bare space key (no site, see Legacy Confluence sources) is check_failed with reason legacy_source_ref. In both cases no Confluence call is made. The search carries the source's site cloudId. dropped

A refresh that cannot start (invalid ids, a source or user that does not belong to the tenant, a storage fault) returns an error and writes nothing. If the drop itself fails, that is also an error.

  • Accepted page ids. A Confluence search result is accepted only if every id is a string of 1-255 characters from [A-Za-z0-9._:-], or a positive whole number below 2^53 (rendered as digits). Any other element (an object, a negative or fractional number, an empty or over-long string) rejects the whole reply as rejected; it is not skipped.
  • Caps. The search is paged 50 at a time. A reply of more than 5000 distinct pages in total (5000 is accepted, 5001 is not), more than 101 search calls, or a pager that returns the same first page again is rejected. A reply larger than the response size limit is rejected as oversized.
  • Paging assumptions. The walk ends when a page returns fewer than 50 results or the reported totalSize is reached. An empty result list is valid and yields zero grants.
  • Ids outside the synced set. Visible pages the source never synced are filtered out (not a rejection) and logged once at INFO with a count. The comparison ignores letter case, like the stored ids.
  • Logging. Every non-granted refresh (each outcome other than granted, including no_connection and user_ineligible) logs exactly one warning prefixed user_grant_refresher:. The warning carries the status and reason; it never contains the connector URL, a credential, a page id or Confluence text.
  • Project access is not checked here. A grant only widens visibility together with the usual project membership, which is still enforced at read time.

When the refresh runs

The refresh above is triggered automatically; nothing has to call it by hand.

  • On connect. When a user connects (or reconnects) their Atlassian account, the gateway refreshes that user for every Confluence source the connector feeds, in the background. It never delays or fails the connect flow: a failure logs one warning and the daily check below picks the user up.
  • On disconnect. Deleting a user's credential (the credential DELETE route and every other disconnect path, including removing the connector's credentials for all users) first drops that user's grants and refresh state for the connector, then deletes the credential. If dropping the grants fails, the request fails with the existing storage-error 5xx and the credential is kept, so a grant never outlives a disconnect; retry the request.
  • Every 24 hours. The agent scheduler re-verifies each (tenant, user, source) pair that holds a credential and has not been checked within 24 hours, never-checked pairs first and then the oldest. At most 10 pairs are refreshed per scheduler tick, one call per pair, and only while the tick still has time left. Scheduler endpoints: POST /due-grant-refreshes ({now, limit}) lists due pairs and POST /refresh-grant ({tenant_id, user_id, sync_source_id}) refreshes one.
  • Retries. A transient failure (check_failed, a storage error, an unknown outcome) is retried after about one hour. A definitive outcome (granted, unsupported_connector, user_ineligible, rejected) waits the full 24 hours. A user without a connection (no_connection) has their refresh state cleared once the credential is confirmed absent.
  • A disconnect during a refresh is covered twice: after a granted result the credential is read again, and if it is gone the grants are dropped again. In addition, a disconnect drops the user's grants a second time (best-effort) after the credential is deleted, so grants written by a refresh that raced the disconnect do not remain.
  • Offboarding (user deprovisioning and hard erase) deletes the user's grants and refresh state.
  • Connector switched to private or auth_type=none. Other users' existing grants are not removed at that moment. They remain until each user's next check, at most 24 hours later, when the refresher drops them as unsupported_connector.

Manual uploads are unchanged: a document uploaded directly to a project (not via a connector sync) remains visible to the project's members at their project role, as before.

  • Run-as-invoker. A sync runs under the OAuth/MCP credentials of the user who created the source (its created_by), not the person who clicked "Sync now". This is why the run endpoint additionally requires the caller to be the source's creator. If that user is deprovisioned, their credentials stop working — delete and recreate the source under an active user to restore syncing.

Registering a sync source

POST /admin/v1/connector-sync

Registers a new source against a project and connector. Required role: project editor (owner or editor) on the target project.

Field Type Required
project_id string yes
connector_id string yes for sharepoint/confluence/jira; must be omitted for url (a website has no connector — supplying one returns 400).
provider sharepoint | confluence | jira | url yes
source_ref string yes — for sharepoint: the drive id, charset ^[A-Za-z0-9_.!-]+$. For confluence: <cloudId>/<SPACE KEY> — the Atlassian site (cloud) id, a UUID, then the Confluence space key, 1–255 characters from A-Z a-z 0-9 - _ (for example 0a1b2c3d-0000-4000-8000-0123456789ab/DOCS), optionally after one leading ~ for a personal space (for example …/~jdoe or …/~5b10ac8d82e05b22cc7d4ef5; the ~ counts towards the 255). The cloud id is stored lower-cased; the key keeps its case. A bare space key (the format before the site was required), a non-UUID site, extra segments, or a key with any other character (., !, a space, a quote, a ~ anywhere but the first position, ~ alone, ~~…) returns 400 invalid_source_ref with source_ref must be '<cloudId>/<SPACE_KEY>'. For url: the website URL (http/https). Max 512 characters. For jira: <cloudId>/<PROJECT KEY> — the Atlassian site (cloud) id, a UUID, then the Jira project key (for example 0a1b2c3d-0000-4000-8000-0123456789ab/PROJ). The cloud id is stored lower-cased and the key must be upper-case A-Z, digits and _, starting with a letter; list the connector's sites with the Atlassian sites endpoint. Anything else (no slash, extra segments, a lower-case key, a non-UUID site) returns 400 invalid_source_ref.
source_label string no — a human-readable label for the source: valid UTF-8, at most 255 characters, no control or formatting characters. A label that is not a string or breaks these rules is refused 400 invalid_source_label; a longer one 400 source_label_too_long. null, "" or absent means no label.
auto_sync_interval_secs integer no — the automatic re-sync cadence in seconds. Omitted → 86400 (24h, ON). Accepted values: 0 (off) or an integer in 3600–604800 (1 hour to 7 days). Any other value is rejected with 400.

On success the response is 201 Created with the new source at status: "idle":

{
  "id": "src_abc123",
  "project_id": "prj_1",
  "connector_id": "mcp_1",
  "provider": "sharepoint",
  "source_ref": "b!drive-id",
  "source_label": "Team drive",
  "status": "idle",
  "auto_sync_interval_secs": 86400
}

Accepted shape / What is rejected (fail-closed):

  • A missing or wrongly-typed field, or an out-of-range value, returns 400.
  • provider must be exactly sharepoint, confluence, jira, or url; any other value returns 400.
  • auto_sync_interval_secs, when present, must be an integer that is 0 or in 3600–604800. A non-integer (e.g. 3600.5), a value below the 1-hour floor (e.g. 60), a value above the 7-day ceiling, or a non-numeric junk value returns 400. When omitted it defaults to 86400 (24h ON) — a newly registered source auto-syncs daily unless you opt out.
  • source_ref (sharepoint) must match ^[A-Za-z0-9_.!-]+$ and be at most 512 characters — a value containing spaces, /, :, ?, #, %, \, control characters, or any other character outside that set is rejected with 400. The source_ref is a bare selector, never a URL or a path. confluence and jira take <cloudId>/<KEY> instead (see the field table above).
  • Registering a selection the project already holds for the same connector returns 409 source_already_exists. The comparison ignores letter case, so <cloudId>/DOCS after <cloudId>/docs is a duplicate.
  • A project member below editor on project_id returns 403. A project_id the caller has no access to — unknown, malformed, another tenant's, or not shared with the caller — returns the same 404 { "error": "not found" } and is recorded as access.denied (see a project you cannot see).
  • A connector_id that belongs to another tenant (or whose tenant is not the project's) returns the same 404 { "error": "not found" } as an unknown connector — a source can never bind a project to a connector outside its project's tenant, and the answer never confirms that the connector exists. Recorded as access.denied (status 404, no entity; see ids of another tenant).
  • An unknown connector_id returns 404 { "error": "not found" }. If the connector cannot be read (a database fault) the answer is the retryable 503 { "error": "temporarily unavailable; retry later" }, never the 404.
  • A project may hold at most 50 sync sources (all providers); registering beyond that returns 400. This bounds the recurring outbound-fetch fan-out from the gateway's egress.

The url provider (websites) — accepted shape and what is rejected

  • No connector_id. Supplying one with provider: "url" returns 400.
  • The source_ref URL is canonicalised (scheme + host lower-cased; path/query preserved) and stored in that form; a missing scheme defaults to https://. Two URLs that differ only by host/scheme case are the same source; http vs https, a trailing slash, or a www. prefix are treated as distinct sources.
  • The URL is SSRF-checked at registration and again on every fetch (including each redirect hop): a private/internal/loopback/link-local address (e.g. 127.0.0.1, 10.0.0.0/8, 169.254.169.254), a DNS name that resolves to one, or a non-http(s) scheme is rejected with 400 at create (fixed body "URL not allowed" — no internal-reachability oracle) and blocked at fetch time. A private target is accepted only when the acting tenant lists its exact host:port in its connector egress hosts; the deployment-wide AIG_SSRF_ALLOW is not consulted. The same rule applies to the SharePoint / Graph sources.
  • Duplicate URL (same canonical form already a url source in the project) → 409. If the project's sources cannot be read for this duplicate check (a database fault), nothing is created and the answer is the retryable 503.
  • At fetch time (during a sync, not at registration) the page is fetched fail-closed: the response must be text/html or application/xhtml+xml (an absent or other content-type is treated as non-HTML and the page is not indexed), at most 10 MiB (a larger body is aborted), and reachable. A dead 404/410 removes the previously-indexed page; any transient failure (DNS, timeout, 5xx, 401/403, non-HTML, oversize, blocked redirect) surfaces a sync error and retains the last successfully-indexed copy — a blip never empties the knowledge base. Only <script>/<style>/<noscript> content is dropped (including the self-closing <.../> forms — so text hidden from a JS-enabled reader never reaches the index); the visible page text, including any <title>, is indexed.
  • Recurring egress: like the other providers a url source defaults to 24 h automatic re-sync — the gateway will re-fetch the tenant-supplied public URL on that cadence until auto-sync is set to 0. The per-project source cap above bounds the total fan-out.

Listing sync sources

GET /admin/v1/connector-sync?project_id=<id>

Returns every sync source registered on the project. Required role: project viewer (any project member).

The response is a JSON array — [] when the project has no sources. If the sources cannot be read (a database fault) the answer is 503 { "error": "temporarily unavailable; retry later" } — never an empty list. Each element is the full source object:

Field Type Description
id string Source id.
tenant_id string Owning tenant.
project_id string Target project.
connector_id string | null Connector used to reach the source; null for a url source.
provider sharepoint | confluence | jira | url Source system.
source_ref string The source selector.
source_label string | null Human-readable label.
share_scope creator | org Whether documents imported from this source are visible only to their creator or shared with the whole organization (set via the source's share endpoint).
status string See the status table above.
crawl_started_at unix seconds | null When the current/last crawl began.
running_since unix seconds | null When the current run started (null when not running).
last_synced_at unix seconds | null When the last successful pass completed.
last_error string | null Reason the last crawl failed, when status is error.
next_earliest_run unix seconds | null Earliest time a run may start again (set by a rate-limit or auto-sync backoff).
auto_sync_interval_secs integer The automatic re-sync cadence in seconds. 0 = off (manual "Sync now" only); a value in 3600–604800 = auto re-sync every N seconds.
items_synced integer Documents currently held from this source.
items_skipped integer Documents the last run could not import (unsupported type or a transient fetch/stage error). Persisted so the "could not be imported" warning survives a page reload; overwritten each run (last-run count, 0 after a clean pass).
created_by string The user the sync runs as.
created_at unix seconds Registration time.
updated_at unix seconds Last update time.

Accepted shape / What is rejected: project_id is required; a request without it returns 400. The listing is scoped to the caller's tenant and to a project they are a member of.


Running a sync ("Sync now")

POST /admin/v1/connector-sync/{id}/run

Runs one crawl pass of the source. Required role: the caller must be both a project editor and the source's creator (created_by) — this is the run-as-invoker boundary described above. A caller who is a project editor but not the creator (or vice versa) returns 403; a caller who has no access to the source's project at all gets the audited 404.

Before the pass starts, the source's connector and the creator's editor access are re-checked. A connector that no longer exists (or belongs to another tenant) → 404 connector not found; a creator who is no longer a project editor → 403 creator lost project access. If either re-check cannot be read (a database fault), nothing runs and the answer is the retryable 503 { "error": "temporarily unavailable; retry later" } — never the 404 / 403 verdicts. The scheduled sync treats the same fault as a retry on its next tick (no back-off, no last_error).

Restricted creator (GDPR Art. 18). If the source's creator is under a processing restriction (processing_restricted), nothing runs and the answer is 403 { "error": "creator processing restricted" }. The refusal comes before the run is claimed, so the source row is left untouched. The restriction is read from the creator's current account state on every run, so there is no stored pause flag to clear.

On success the response is 200 with the pass result:

{
  "status": "completed",
  "items_synced": 12,
  "skipped": 3
}
Field Type Description
status string The source status after this pass (completed, paused_cap, paused_rate_limited, or error).
items_synced integer Documents newly ingested, updated, or re-confirmed unchanged this pass.
skipped integer Items that could not be ingested this pass: an unsupported file type (always skipped), or a transient fetch/stage error (a later run may pick it up).
error string Present only when the pass ended in error.

Supported file types. A synced document is ingested only when the async extraction pipeline can extract it: PDF, DOCX, legacy Word (.doc), PPTX, XLSX/XLSM, OpenDocument spreadsheets (.ods) and text documents (.odt), the text formats (.txt, .md, .markdown, .csv, .yaml, .yml, .rst, .log), structured text (.xml, .json, .html, .htm), and images (.png, .jpg, .jpeg, .webp, OCR-extracted) — the same set the project knowledge upload form accepts. Other types — including legacy .xls (no extractor) — are skipped and counted in skipped, never reported as failed. A corrupt synced .doc fails as malformed and a password-protected one as password-protected; the source's download cap applies first (SharePoint/OneDrive 20 MB, URL pages 10 MB), and the extractor also refuses any .doc over 100 MB. A synced document is ingested identically to one uploaded directly in the knowledge UI (both take the async path).

Structured formats are validated at the trust boundary and a hostile file is rejected (skipped), not ingested: an .xml that declares a DOCTYPE or any entity (billion-laughs / XXE / an external SYSTEM DTD) is refused before parsing, and a .json that is not valid UTF-8 JSON — or contains NaN/Infinity — is refused. Accepted .xml is reduced to its text content; accepted .json is pretty-printed so each key/value segments for retrieval.

When a run cannot start, the response is 409 with { "conflict": true }. This happens when a sync is already running for the source, or when the rate-limit backoff has not yet elapsed (next_earliest_run is in the future). Retry once the running pass finishes or the backoff expires.

The error back-off counts too: after a skipped scheduled run (see Automatic re-sync) the source waits one hour, and a manual "Sync now" during that hour is also 409 { "conflict": true }, even if the cause has since been fixed. The source resumes on the first attempt after the back-off.

Accepted shape / What is rejected (fail-closed):

  • A caller who is not both a project editor and the source's creator returns 403; one with no access to the source's project gets the audited 404.
  • A source id that is not in the caller's tenant returns 404 { "error": "not found" } (identical to an unknown id, recorded as access.denied) — it is never resolved outside the tenant you can access.
  • A concurrent run or an un-elapsed backoff returns 409 { "conflict": true }, never a partial double-crawl.
  • A source whose provider has no run wiring returns 400 with the reason in error.
  • Third-party responses are validated at the trust boundary and treated as hostile. Every item the Microsoft Graph or Confluence API returns is checked before ingestion: an item with a null or missing required field is rejected, an oversize payload is rejected, and a document download URL that is not https is refused. The connector's bearer token is sent only to graph.microsoft.com (the Graph API host) — it is never attached to a document downloadUrl, so a malicious or redirected download target can never capture the caller's token. A source that returns malformed data fails closed (status error) rather than ingesting unvalidated content.
  • Jira issues are validated the same way, with a per-issue fetch policy. The issue search lists only issues whose key belongs to the source's project (<KEY>-<number>); any other element is skipped. Results are paged with the server's nextPageToken: a malformed token fails the run closed, and a full page that carries no token and is not flagged as the last page is not treated as a finished crawl, so no issue is tombstoned on an unproven listing. Each issue is then fetched (getJiraIssue) and must be a JSON object with an object fields and, if it carries a key, the key of the issue that was asked for. A reply of the wrong shape (a non-object, an Atlassian {"errorMessages": [...]} error body, no fields, fields not an object, or a different issue key) is an error for that item: it is treated as transient and retried on the next run, and the previously synced content is left untouched. A reply that is too large for the transport cap or cannot be decoded (garbled or nested too deeply) is replaced by a short document containing the issue title and [truncated]; because the stored content hash is the issue's updated timestamp, that stub is kept until the issue's next edit. When an issue is rendered, depth, size and count caps apply (nested rich text deeper than 32 levels, more than 20,000 rich-text nodes, more than 500 comments, or a document over about 8 MiB); anything beyond them is dropped and the document ends in [truncated]. A valid issue with no summary is still indexed, titled by its issue key.

Setting the sharing scope of a Confluence or Jira source

PATCH /admin/v1/connector-sync/{id}/share

Publishes a Confluence or Jira sync source org-wide, or reverts it to the creator-only default. Required permission: MCP_TENANT_MANAGE (tenant-admin gate class; a project editor/member is not sufficient — org-wide publishing is a tenant-governance action). This is the admin org-wide opt-in described above: publishing makes every page the source synced visible to everyone who can open the project, including pages or issues restricted in Confluence or Jira (admin curation, not permission mirroring).

Request body:

{ "scope": "org" }
Field Type Notes
scope "org" | "creator" org publishes the source org-wide; creator reverts to the creator-only default (visible only to the sync creator). Any other value is rejected.

The response is 200 with { "id": "<source id>", "share_scope": "<scope>" }. Reverting to creator takes effect immediately — no re-sync is needed (the underlying creator grant was never removed).

Accepted shape / What is rejected (fail-closed):

  • A caller who is not a tenant admin (or platform admin) returns 403; an unauthenticated caller returns 401. The client is never the authz boundary.
  • A source id that is not in the caller's tenant returns 404 { "error": "not found" } (identical to an unknown id, recorded as access.denied) — it is never resolved outside the tenant you can access, so a tenant admin can never share another tenant's source.
  • A source that is neither Confluence nor Jira (e.g. SharePoint or a website) returns 400 org_share_unsupported: org-wide sharing deliberately bypasses per-item source ACLs, which is valid only for Confluence and Jira (neither of which exposes per-item ACLs to the sync). SharePoint keeps its real per-item ACL (see above) and cannot be org-shared here.
  • A scope that is absent, non-string, or not exactly "org"/"creator" returns 400. Nothing is written.

Listing the Atlassian sites of a connector

GET /admin/v1/connector-sync/atlassian-sites?project_id={id}&connector_id={id}

Lists the Atlassian Cloud sites the calling user can reach through an Atlassian MCP connector, so a client can offer the cloudId half of a Confluence or Jira source_ref. Required role: project editor on project_id. The call is made with the caller's own credential (getAccessibleAtlassianResources), never the creator's or the tenant's.

{ "sites": [ { "id": "0a1b2c3d-0000-4000-8000-0123456789ab", "name": "Acme", "url": "https://acme.atlassian.net" } ] }

Only id, name and url are returned; scopes and any other upstream field are dropped. An account with no site returns 200 with "sites": [].

What is rejected (fail-closed):

  • A missing project_id or connector_id returns 400. A connector that is not the Atlassian Remote MCP connector (a SharePoint, custom or foreign-URL connector) returns 400 not_atlassian_connector and no upstream call is made.
  • A connector outside the caller's tenant, or an unknown one, returns the audited 404 { "error": "not found" }; a connector that cannot be read returns the retryable 503.
  • An expired or revoked credential returns 409 connector_reauth_required: reconnect the Atlassian account.
  • Any other upstream failure returns 502 atlassian_sites_unavailable (the cause is not echoed).
  • The reply is validated as a whole: if any element is malformed (an id that is not a UUID, a missing or empty name over 255 characters, a url that is not https, over 512 characters or contains whitespace), or the reply is not a JSON array, the whole answer is 502 invalid_atlassian_sites (formerly atlassian_sites_invalid); nothing is partially returned.

Automatic re-sync

Every source can re-crawl itself on a schedule, so connector-sourced knowledge stays current without anyone clicking "Sync now".

  • New sources default to every 24 hours (auto_sync_interval_secs: 86400). Registering a source with POST /admin/v1/connector-sync and no auto_sync_interval_secs opts it into daily re-sync.
  • Existing sources (registered before this feature) start OFF (auto_sync_interval_secs: 0) and re-sync only when you set a cadence — no source silently begins re-crawling on upgrade.
  • Per-source opt-out / retune at any time with the schedule endpoint below: 0 turns automatic re-sync off (manual "Sync now" still works); 3600–604800 sets a cadence of 1 hour to 7 days.

How the cadence is honoured. Due-ness is derived from last_synced_at: a source becomes due again auto_sync_interval_secs seconds after its last successful crawl. A manual "Sync now" therefore also pushes the next automatic run out by a full interval (no redundant crawl right after a manual one). The scheduler re-crawls due sources a few at a time; a run that pauses (ingest cap or rate limit) simply stays due and resumes on the next tick, so the cadence is "at least every N seconds", drifting by at most one crawl duration — deliberately spread out to level load, not a to-the-second guarantee. A source whose creator has lost project access, or whose connector was removed, is skipped and backed off rather than run. A creator whose account is deleted or disabled counts as having lost project access: that run is skipped, the source's last_error records creator lost project access, and the next attempt waits the 1-hour error backoff. The source itself is not removed. The creator re-check is evaluated on every run against the account's current state, so once the account is re-enabled the source resumes on its own at its next attempt.

When a scheduled run is skipped. Before each scheduled crawl the gateway re-checks the connector and the creator, exactly as for a manual run. If that check fails, the crawl does not start. The source gets status error, last_error set to the reason, and a one-hour back-off (next_earliest_run). The reasons are creator processing restricted (the creator is under a GDPR Art. 18 processing restriction), creator lost project access and connector not found. This applies to every such skip, not only the restriction. Nothing is stored to mark the pause: once the restriction is lifted (or access is restored), the source resumes on its first attempt after the back-off, so within about an hour. A crawl that is already running when the restriction is set runs to completion; the restriction takes effect from the next run.

Setting the auto-sync cadence of a source

PATCH /admin/v1/connector-sync/{id}/schedule

Enables, disables, or retunes a source's automatic re-sync. Required role: project editor (owner or editor) on the source's project — the same gate as "Sync now" and delete.

Request body:

{ "auto_sync_interval_secs": 86400 }
Field Type Notes
auto_sync_interval_secs integer 0 disables automatic re-sync (manual "Sync now" still works); an integer in 3600–604800 sets the cadence (1 hour to 7 days).

The response is 200 with { "id": "<source id>", "auto_sync_interval_secs": <secs> }.

Accepted shape / What is rejected (fail-closed):

  • auto_sync_interval_secs is required; a body without it returns 400.
  • The value must be an integer that is 0 or in 3600–604800. A non-integer, a value below the 1-hour floor (a per-minute connector crawl is deliberately not allowed), a value above the 7-day ceiling, or non-numeric junk returns 400 and nothing is written.
  • A project member below editor returns 403; a project_id the caller cannot see returns the audited 404; an unauthenticated caller returns 401.
  • A source id not in the caller's tenant returns 404 { "error": "not found" } (identical to an unknown id, recorded as access.denied) — it is never resolved outside the tenant you can access.

Error codes

Every refusal on /admin/v1/connector-sync carries a top-level code beside the unchanged status and error text, except the shared answers listed below.

Route Codes (status)
Atlassian sites project_id_required, connector_id_required, not_atlassian_connector (400); connector_reauth_required (409); atlassian_sites_unavailable, invalid_atlassian_sites (502; formerly atlassian_sites_invalid)
Register (POST) project_id_required, invalid_provider, connector_id_not_allowed, connector_id_required, source_ref_required, invalid_source_ref, url_not_allowed, source_limit_reached (400); source_already_exists (409)
Run not_source_creator, creator_lost_project_access, creator_restricted (403); connector_not_found (404); unsupported_provider (400); sync_in_progress (409)
Cadence and sharing auto_sync_interval_required, invalid_auto_sync_interval, org_share_unsupported, invalid_share_scope (400)
List project_id_required (400)
Cadence and sharing (update) not_found (404) — the source was removed between the visibility check and the update
Any route unauthenticated (401)

Exceptions, which carry no code (branch on the status):

  • A source id outside the caller's tenant, or an unknown one, returns the audited 404 { "error": "not found" } — identical for both, so it reveals nothing about other tenants.
  • A storage fault returns the shared 503 (temporarily unavailable; retry later) or the sanitised 500.

Deleting a sync source

DELETE /admin/v1/connector-sync/{id}

Removes the source registration and all knowledge rows this source produced in the project. Required role: project editor.

The response is 200 with { "deleted": true }. Deleting a source detaches its synced documents from the project knowledge base (they are removed, not orphaned); uploaded files and other sources are untouched. A source id outside the caller's tenant is not resolved (404 { "error": "not found" }, identical to an unknown id and recorded as access.denied).


Setup: the SharePoint Graph-scoped OAuth connector

SharePoint sync uses a separate connector from the SharePoint MCP tool connector. The MCP tool connector lets the assistant call SharePoint tools during a chat; connector sync uses a dedicated Graph-scoped OAuth connector that reads drive contents through the Microsoft Graph API. The two are distinct registrations and are not interchangeable.

The Graph-scoped OAuth connector is a delegated OAuth connection requesting the scopes:

  • Sites.Read.All
  • Files.Read.All
  • GroupMember.Read.All (optional, enables group-membership snapshots; without it group grants fall back to the SCIM/IdP group mapping)

To set up SharePoint sync:

  1. In Microsoft Entra, register an enterprise application and grant it the delegated Graph scopes Sites.Read.All and Files.Read.All.
  2. In the gateway, create and connect the Graph-scoped OAuth connector using that Entra app (supply your Directory (tenant) GUID and the enterprise-app client id — see the tenant-scoped connector setup). Completing the delegated OAuth sign-in stores the per-user credential the sync will run under.
  3. Add a sync source with POST /admin/v1/connector-sync, referencing that connector_id, provider: "sharepoint", and the drive's source_ref.

Confluence and Jira sync need no separate OAuth connector: they use the existing Atlassian MCP connector, with provider: "confluence" and <cloudId>/<SPACE KEY> as source_ref, or provider: "jira" and <cloudId>/<PROJECT KEY> as source_ref. The Atlassian MCP needs the site cloudId on every call, so the gateway sends it with every Confluence and Jira tool call (search, page/issue read, and the per-user grant refresh); list the connector's sites with the Atlassian sites endpoint. The "Add Atlassian source" page offers the site picker for both.

Legacy Confluence sources (bare space key)

A Confluence source created before the site became part of source_ref is stored as a bare space key (for example DOCS). It has no cloudId to send, and the gateway never guesses a site. Such a source is not synced:

  • Sync now and the automatic re-sync end with status error and last_error re-create the source with its site. No Confluence call is made, and documents synced earlier are kept (never removed by this error).
  • The per-user grant refresh for it returns check_failed with reason legacy_source_ref and drops that user's grants on the source.

To fix it, delete the source and add it again with its Atlassian site.

A renamed or moved Jira project key makes syncs of that source fail transiently (issues come back under the new key prefix) until the source is re-created with the new key.