Skip to content

Document the API template source endpoints in Preview - #766

Merged
kilian-tennyson merged 4 commits into
mainfrom
kiliantennyson/parthas/882d83d3-document-the-api-template-source-endpoints-in-preview
Oct 23, 2026
Merged

kilian-tennyson merged 4 commits into
mainfrom
kiliantennyson/parthas/882d83d3-document-the-api-template-source-endpoints-in-preview

Conversation

@kilian-tennyson

@kilian-tennyson kilian-tennyson commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Why?

The Preview /ai/api_template_sources endpoint family (create, retrieve, sync) was previously undocumented.

How?

Add the three endpoints to the Preview spec (descriptions/0/api.intercom.io.yaml) along with new api_template, api_template_source and create_api_template_source_request schemas, following the structure and conventions of the sibling /ai/content_import_sources endpoints.

Decisions
  • Documented in the Preview spec only; no other version files touched.
  • Kept the shared error schema unchanged and surfaced field only in 422 examples and descriptions, matching the existing Articles pattern.
  • Pointed the new paths at intercom_version_preview, since the endpoints answer only to Preview.
  • Documented the sync limits (25 MB tree, 50,000 nodes, depth 12, 10 MB item cap, no redirect following, one tree request per sync) and the vendor-429 retry/backoff behaviour on the template schema so they're discoverable alongside the format.
  • Called out that Intercom syncs each source automatically about once a day (unless the vendor has rejected the token), so latest_sync can be a sync the caller didn't start.
  • Documented the two sync 409 shapes separately: an already-running sync, and a deletion that started mid-request.
  • Documented the sync 422 source_unauthorized consequence: the token can't be replaced and auto-sync stops, so a new token means a new source.
  • Captured the token-check error mapping precisely: vendor 401/403 → auth_token rejected; any other non-success (404, redirect, 429, 5xx, timeout) → auth_token could not be reached; tree over 25 MB → template.tree.
  • Used neutral example values (vendor name, token, variables) and generated per-example request_ids to avoid any internal context.
  • Mirrored sibling endpoint conventions for operationIds, scope line, 401 pair, 404 shape and 202 pattern.
  • Left a pre-existing stray ", in the AI Content tag description untouched and flagged it separately rather than mixing an unrelated fix into this change.

Add the API template source endpoints to the Preview spec:

- POST /ai/api_template_sources creates a source from an API template,
  variable values and a vendor token, and starts its first sync (201).
- GET /ai/api_template_sources/{id} returns the source with its template,
  variables and latest sync status.
- POST /ai/api_template_sources/{id}/sync starts a sync (202).

New schemas: api_template (the template format, with each field's checks
and the sync limits), api_template_source and
create_api_template_source_request.

Error responses cover the 401 scope errors, the 403 for workspaces that
can't fetch external URLs, 404, the 409 sync conflicts, the 422
source_unauthorized on sync, and the 422 validation errors on create,
whose examples show the field that failed.
Relabel the second sync 409 example: a sync on a source that's already
being deleted gets the 'already running' conflict, and 'This source is
being deleted' only comes back when a delete starts during the request.

Say that Intercom syncs each source automatically about once a day, on
the sync endpoint and on latest_sync.

Say that a blank node value fails the sync too, not only one with
characters outside letters, digits, '.', '_' and '-'.
- Use the Preview Intercom-Version header for the three endpoints.
- base_url: an unparseable URL fails not_https; drop the invalid check.
- tree.path: a colon in the first segment fails not_relative.
- item.node_values: only values filled into the path must be URL-safe.
- Document one tree request per sync, no paging, 429 retries, and that
  a redirect fails the sync.
- mapping: content without an id or title isn't imported.
- Sync 422: the token can't be replaced and automatic syncs stop.
- Create 422: document the tree size and token check messages, and add
  examples for a large tree, an invalid variable and several errors.
@kilian-tennyson
kilian-tennyson merged commit 1e83728 into main Oct 23, 2026
4 checks passed
@kilian-tennyson
kilian-tennyson deleted the kiliantennyson/parthas/882d83d3-document-the-api-template-source-endpoints-in-preview branch October 23, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants