Content Feature Test Doc

Corgi Intelligence turns raw payment data into ranked, explainable insights: which transactions to worry about, where approvals are leaking, and how much revenue is in play. This guide covers authentication, your first request, the response shape, and the SDKs. Every snippet uses synthetic data you can copy and adapt.

This article doubles as the docs-site rendering reference — every supported block appears at least once, including the cross-doc links and the raw Markdoc source near the end.

Linking to other docs

To link another doc, type @ in Notion and pick the doc you want — that creates a mention. You don't have to wait until that doc is published. The site figures out the rest when it builds:

  • If the doc you linked is already live, the mention becomes a real, clickable link.

  • If the doc isn't published yet, it shows as plain text for now — and it turns into a real link automatically the next time the site builds after that doc goes live. You never have to come back and fix it.

The three links below show exactly that. One points at a live doc, two point at docs still in Draft:

  • A live doc, so this is a working link: Overview Dashboard

  • A doc that hasn't gone through the pipeline yet — plain text now, auto-links once it ships: Payment Analytics

  • Another not-yet-published doc, same behavior: Dispute Management

Always @mention the doc — don't paste a /docs/... web address by hand. The mention stays correct even if the doc's address changes, and it's what lets an unpublished link heal itself later.

Before you start

You'll need a few things in place:

  • [x] A Corgi account with Intelligence enabled

  • [ ] A secret API key (created below)

  • [ ] The analysis window you care about, for example the last 30 days

Authentication

Every request authenticates with a secret API key, sent as a bearer token. To create one:

  1. Open the dashboard and go to Settings → API keys.

  2. Click Create key and choose the live environment.

  3. Copy the key once — it is shown only at creation. Live keys are prefixed ck_live_.

Never ship a secret key in client-side code or commit it to git. If a key leaks, roll it from the dashboard immediately.

Store the key as an environment variable so it never lands in your shell history:

export CORGI_API_KEY="ck_live_9f2a7c41e8b04d6fa1c3e5079b2d8a64"

Make your first request

The quickest way to confirm everything works is to list your most recent insights. Pick the language you work in:

curl -s "https://api.corgilabs.ai/v1/insights?window=30d" \
  -H "Authorization: Bearer $CORGI_API_KEY"

A successful call returns a list of insight objects, newest first. Here is a trimmed response:

{
  "object": "list",
  "window": "30d",
  "data": [
    {
      "id": "ins_3Qk2",
      "metric": "approval_rate",
      "value": 0.942,
      "delta_30d": -0.013,
      "severity": "high",
      "revenue_at_risk_usd": 18240.50
    },
    {
      "id": "ins_3Qjx",
      "metric": "dispute_rate",
      "value": 0.0071,
      "delta_30d": 0.0009,
      "severity": "medium",
      "revenue_at_risk_usd": 4120.00
    }
  ],
  "has_more": true,
  "next_cursor": "ins_3Qjx"
}

Results are paginated. When has_more is true, pass next_cursor back as the cursor parameter to fetch the next page.

The insight object

Each insight is a single, explainable finding — a metric that moved, why it moved, and the revenue attached to it. A full object looks like this:

{
  "id": "ins_3Qk2",
  "metric": "approval_rate",
  "value": 0.942,
  "delta_30d": -0.013,
  "severity": "high",
  "revenue_at_risk_usd": 18240.50,
  "segment": { "card_brand": "visa", "region": "US" },
  "explanation": "US Visa approvals fell 1.3 points after a new issuer rule on June 11.",
  "created_at": "2026-06-14T09:12:00Z"
}

The fields you'll use most:

FieldTypeDescription
idstringUnique identifier, prefixed ins_.
metricstringThe measured metric, e.g. approval_rate or dispute_rate.
valuenumberCurrent value: a rate is 0–1, money is in USD.
severitystringOne of low, medium, or high.
revenue_at_risk_usdnumberEstimated revenue tied to this insight.

API reference

List insights

Returns insights for a window, newest first.

GET/v1/insights

windowstringrequired

Lookback window, e.g. 30d or 90d.

cursorstring

Pagination cursor from a previous response.

severitystring

Filter by low, medium, or high.

Filtering with severity=high returns only the findings worth acting on today:

{
  "object": "list",
  "data": [
    { "id": "ins_3Qk2", "metric": "approval_rate", "severity": "high" }
  ],
  "has_more": false
}

Export insights

Kicks off an asynchronous export and emails a download link when it's ready.

POST/v1/insights/export

windowstringrequired

Window to export.

emailstringrequired

Address that receives the download link.

include_rawboolean

Attach the raw transaction rows. Defaults to false.

The call returns immediately with a job you can poll:

{
  "object": "export",
  "id": "exp_8Wd1",
  "status": "processing",
  "created_at": "2026-06-16T18:30:00Z"
}

SDK examples

Beyond the quickstart, here is a common task end to end: flagging the high-severity insights that move revenue.

In TypeScript, the list is fully typed, so you can act on each field directly:

const { data } = await corgi.insights.list({ window: "30d", severity: "high" });
for (const insight of data) {
  console.log(`${insight.metric}: ${insight.revenue_at_risk_usd} at risk`);
}

In Python, the client handles pagination for you with auto_paging:

for insight in corgi.insights.auto_paging(window="30d", severity="high"):
    print(insight.metric, insight.revenue_at_risk_usd)

If you mirror insights into your own warehouse, this query ranks metrics by the revenue they put at risk:

SELECT metric,
       AVG(value)                 AS avg_value,
       SUM(revenue_at_risk_usd)   AS total_at_risk
FROM insights
WHERE window = '30d'
GROUP BY metric
ORDER BY total_at_risk DESC;

Authoring these docs with Markdoc

These pages are written in Markdoc. If you contribute docs, here is the source behind several blocks on this page.

A callout is a single tag with a type of info, tip, or warn:

{% callout type="warn" %}
Never ship a secret key in client-side code.
{% /callout %}

A tabbed example compiles to a {% tabs %} group, one {% tab %} per language:

{% tabs %}
{% tab label="cURL" %}
curl -s https://api.corgilabs.ai/v1/insights
{% /tab %}
{% tab label="TypeScript" %}
await corgi.insights.list({ window: "30d" });
{% /tab %}
{% /tabs %}

An API reference block pairs an endpoint with its parameters:

{% api-endpoint method="GET" path="/v1/insights" %}
{% api-param name="window" type="string" required=true %}
Lookback window, e.g. 30d.
{% /api-param %}
{% /api-endpoint %}

An embedded video is a single self-closing tag:

{% video src="https://assets.corgilabs.ai/demo.mp4" title="Intelligence demo" /%}

You don't have to hand-write the {% %} tags above — in Notion, write tabs, API blocks, and videos as plain-text source islands, and the pipeline converts them to Markdoc for you.

How to write a source island

No Markdoc syntax required — just a code block and three rules:

  1. Add a code block in Notion (pick Code from the / menu, or type three backticks).

  2. Set that code block's language to "Plain Text." This is the switch that tells the pipeline to convert it — any other language stays an ordinary code sample.

  3. Make the first line name the type, then add the content underneath:

  • Tabs — first line :::tabs, then one :::tab <Label> lang=<language> per tab, with that tab's code on the lines below it.
  • API — first line :::api <METHOD> <path>, then one parameter per line as name (type[, required]): description.
  • Video — a single line: :::video src="<public URL>" title="<title>".

For example, a Plain Text code block containing this:

:::tabs
:::tab cURL lang=bash
curl https://api.corgilabs.ai/v1/insights
:::tab Python lang=python
corgi.insights.list(window="30d")

…renders on the published page as a cURL / Python tab switcher — just like the one under Make your first request near the top. The :::api and :::video blocks elsewhere on this page work the same way; the only thing that makes them convert is that Plain Text language setting.

Troubleshooting

Getting a 401 Unauthorized?

Check that the Authorization header reads "Bearer <key>" with a live key (prefixed ck_live_), and that the key hasn't been rolled. Keys are environment-specific: a test key won't work against live data.

A tip from the field: start with severity=high and a 30-day window. It surfaces the few insights that actually move revenue before you widen the net.

Watch it work

A two-minute walkthrough of reading and acting on insights:

🚧 PLACEHOLDER. Delete this line and drag in an uploaded video (mp4, webm, mov, or m4v, up to 50 MB). A YouTube or Vimeo link becomes a plain link, not a player.

Dashboard reference

The same insights appear in the dashboard, ranked by revenue at risk:

🚧 PLACEHOLDER. Delete this line and drag in an uploaded screenshot (png, jpg, webp, gif, or svg, up to 50 MB). Do not paste an external URL — only uploaded files get re-hosted for the web.


That's the full surface. If a block renders cleanly here, it's safe to use in any product doc.

Last updated: 2026-06-18