Integration Document Guidelines
CCG integration documentation follows the Diataxis framework: every page is one of four types — Tutorial, How-to, Reference, or Explanation — and a feature's documentation is a small folder of pages, not one long monolithic page. This replaces the older "one doc, twelve sections" template; if you find an old-style document that still mixes all of these into a single page, it's a candidate for splitting, not a model to copy.
Use this guide when documenting any API-level feature or use case (e.g., split tender payments, pre-authorization, refunds, sessions). For business-level documentation, see the Business Use Case Guidelines.
The Four Document Types
| Type | Answers | sidebar_label prefix | Typical content in this repo |
|---|---|---|---|
| Tutorial | "Teach me, step by step" | "Tutorial: …" | Rare here — most integrators already know the domain. Only write one for a genuinely first-time, learning-oriented walkthrough. |
| How-to | "Show me how to do X" | "How-to: …" | Request/response steps, enabling a channel, creating a session, initiating a flow — action-oriented, assumes the reader already knows why. |
| Reference | "Look up the exact value/field/status" | "Reference: …" | Field tables, status mapping tables, API contracts, error code tables — information-dense, no narrative. |
| Explanation | "Help me understand why / the concept" | "Explanation: …" | What a concept is, why it exists, the model behind it — no steps to follow. |
A single page should be (mostly) one type. If a how-to page keeps needing a big field-reference table or a conceptual aside, that's usually a sign the reference or explanation content belongs in its own page, cross-linked rather than inlined.
A Feature Is a Folder, Not a Page
Instead of one document with sections like "Overview → Request → Response → Status → Webhooks → Retry → FAQ → Checklist," split a feature into a small category of pages:
my-feature/
_category_.json # label, position, generated-index or doc link
overview.md # Explanation — what it is, why it exists
<action>.md # How-to — the actual steps/requests (one per distinct action)
reference.md # Reference — field tables, status tables, error reference
Reference implementation in this repo: Sessions (overview.md = Explanation, create-a-session.md + vendor-configuration.md = How-to, reference.md = Reference) and Agents (overview.md = Explanation "why/what," agent-sessions.md = How-to, trimmed to steps only once the overview page existed).
_category_.json patterns
- No explicit
slug(defaults to/docs/category/<folder-name>) — use this when every page inside already has its own meaningful slug and the category page itself is just a navigational index. Example:Sessions/Agents/_category_.json. - Explicit
slugmatching an old content URL — use this when a flat page is being converted into a category and you want the old bookmark to open a generated index. Move the original content to a distinct slug (often.../overview), because a generated index and a doc cannot share a route. Example: theWallet-Managementcategory. - A real
index.mdas the category link — use"link": {"type": "doc", "id": "index"}when the overview itself should open at the category URL. Example: HCP API Gateway. Redirect any retired overview URL to the index. - A different category landing file — when
index.mdalready serves another URL, link_category_.jsonto a dedicated navigation page such asstart-here.md. Category-linked landing pages provide navigation and are exempt from the endpoint integration template's required API sections.
Ordering (sidebar_position)
- A category's own landing/overview page is usually
1within its folder — readers should land on context, not jump straight into a sub-page. - An exception: a pure lookup Reference page that isn't the category's entry point (e.g. the
Reference: Manufacturer Cardcontract page, which sits after the how-to pages) can be ordered last, since readers consult it after they know what they're trying to do. - Positions are scoped per directory. A file's
sidebar_positiononly has to be unique among its siblings in the same folder — it does not need to be globally unique across the whole docs tree. Check every level (the folder itself among its own siblings, and each subfolder independently) after any reorg; duplicate positions at the same level are the most common mistake when splitting or merging pages.
Internal vs. Merchant Content
Substantial internal-only content — architecture diagrams, processor-level details, internal status flows — does not live inline in an Integration page; move it to the Engineering Guide and link to it. For how to mark any remaining internal-only aside, see the Internal vs. Merchant Content Guide.
Product scope
For productOnly: frontmatter and per-product pages, see the Optum Wallet & CCG Product Model.
How the lint treats legacy vs Diataxis pages
scripts/docs/lintDocStructure.js and these guidelines are canonical. Under docs/03-Integration/5-convenient-checkout-api, the lint skips index.* files, a category's landing page (the doc named by link.id in _category_.json), and any page whose sidebar_label starts with Explanation:, How-to:, Reference: or Tutorial:. Pages that match none of these (legacy, non-Diataxis pages, apart from a few path-based exemptions) must still contain these headings: API Request, API Response, Status Handling, Error Handling, FAQ, Integration Checklist and Related Documentation, plus a :::tip Integration Details admonition (prerequisites, endpoint(s), scope, API version, links). Error code pages under 4-error-codes require Error Summary and Error Details instead. New pages should use the Diataxis types and not the legacy sections. Business pages have no required headings; the lint only checks their forbidden API content.
Merging Near-Duplicate Pages
If two pages differ only in a literal value or delivery medium — same flows, same config shape, same steps — merge them into one page with a comparison table rather than maintaining parallel copies. (Example: email-channel.md and text-channel.md merged into email-text-channels.md — identical structure, differing only in the channel string and the customer contact field required.) Don't merge pages that happen to be short but cover genuinely different concepts or prerequisites.
Redirects for Moved or Merged Content
Any time a page's slug changes — a rename, a category regroup, a merge — add an entry to config/legacy-redirects.js so old links and bookmarks don't 404:
mirrorPrefix— use for a whole-subtree move (a folder/category renamed or regrouped). It walks every page currently built under the new path and writes a redirect stub for the old path automatically, so you don't have to hand-list every sub-page and new pages added later are covered for free.exact— use for a single page move or a merge (e.g. two old pages now redirect to one new page).
After adding redirects, grep the whole repo for the old slug across docs/, docs-ccg-internal/, docs-site/, versioned_docs/, and src/components/SearchBox/searchPages.json, and update any direct cross-links to point at the new location instead of relying solely on the redirect (the redirect is a safety net for external bookmarks, not a substitute for correct internal links).
AI Assistant Guidance
If you are an AI assistant restructuring or authoring integration documentation in this repo, follow this checklist — it reflects the actual workflow used to build the current Sessions / Resources / Wallet-Management structure:
- Classify before writing. Decide whether the content you're adding is Tutorial, How-to, Reference, or Explanation before choosing a filename or label. Don't default everything to "How-to."
- Use the label convention. Every doc gets a
sidebar_labelprefixed with its type ("How-to: …","Reference: …","Explanation: …"). Keep the H1 title consistent with the label — a mismatched H1 ("How to Configure X" on a page labeledReference:) is a sign the page needs realigning, not just a cosmetic fix. - Check position conflicts at every level, every time. After any move, rename, split, or merge, re-list
sidebar_positionvalues at each affected directory level and confirm there are no duplicates and no illogical ordering (e.g. a category's own landing page ending up last). This is the single most common mistake in this kind of restructuring. - Grep before and after any bulk find/replace. When updating slugs across many files, run the replacement with a precise, ordered sequence of patterns (most specific first) and verify afterward with a repo-wide grep for the old pattern. Be careful that a broad replacement doesn't also mutate
/docs/v1/...or/optum-wallet/...links, which are separate, unrestructured instances — always re-grep specifically for those prefixes after a bulk edit. - Add redirects for every slug that changes, per the section above — do this in the same change as the rename, not as an afterthought.
- Rebuild both audiences before calling the change done. Run
npm run build:merchantandnpm run build:internalsequentially (not in parallel — they share the same./buildoutput directory and will race if run concurrently). A clean build is the actual proof that no cross-link, redirect, or sidebar config broke; passing position-conflict checks alone is not sufficient. - Mark internal-only clarifications as internal rather than leaving them merchant-visible by default; see the Internal vs. Merchant Content Guide.
- Prefer merging over duplicating when two pages are structurally identical (see "Merging Near-Duplicate Pages" above), and prefer improving a page's actual technical content (real request/response fields, real config values) over just relabeling it — a label change without the content to back it up just moves the inaccuracy.
Contributing Guidelines Reference
- API Error Code Documentation Guidelines — How to create MDX error code pages and JSON data files
- Business Use Case Guidelines — How to document business-level features and use cases