Docil answers questions about your billing — revenue by month, churn, which customers went quiet, which subscriptions renew next — by reading your Stripe data. To do that it needs one credential: a restricted API key, created by you, in your own Stripe Dashboard, with read-only permissions.
It takes about three minutes. You never share your password, and you can revoke the key at any time without touching anything else in your Stripe account.
Before you start
- You need to be the owner or an administrator of the Stripe account. Members with limited roles can’t create API keys.
- Have your two-factor authentication device to hand. Stripe asks you to confirm before it reveals a new key.
- Decide which account you’re connecting. If you have several Stripe accounts (one per brand or country), each one needs its own key.
Step 1 — Open the API keys page
- Sign in at dashboard.stripe.com.
- If you have more than one Stripe account, use the account switcher in the top-left corner to select the right one.
- Go to Developers → API keys. You can also go straight there: dashboard.stripe.com/apikeys.
You’ll land on a page with two sections: Standard keys (your publishable and secret keys) and Restricted keys. Ignore the first section — the key you want is the second one.
Step 2 — Make sure you’re in live mode
Look at the Test mode toggle at the top of the Dashboard.
- Test mode off (live mode) → the key reads your real payments. This is what you want.
- Test mode on → the key reads sandbox data only. Docil will connect fine, but every answer will come back empty or fictional.
Live keys contain live in the prefix, test keys contain test. If your key says rk_test_, you were in the wrong mode.
Step 3 — Create a restricted key
In the Restricted keys section, click Create restricted key.
Stripe offers a preconfigured set of permissions or a blank slate with everything set to None. Start from zero permissions — it’s faster to add the eight or nine you need than to audit a long list you didn’t choose.
Give the key a name that will still make sense in a year, for example:
Docil — read only
Step 4 — Grant read-only permissions
Every resource has three options: None, Read, Write. Set Read on the resources below and leave everything else on None. Docil never needs Write on anything — it doesn’t create charges, issue refunds or modify subscriptions.
| Resource | Permission | What it lets Docil answer |
|---|---|---|
| Balance | Read | Available and pending balance |
| Balance transactions | Read | Net revenue after Stripe fees |
| Charges | Read | Payments, declines, failure reasons |
| PaymentIntents | Read | Checkout attempts and outcomes |
| Refunds | Read | Refund volume and reasons |
| Disputes | Read | Chargebacks and their cost |
| Payouts | Read | What actually landed in your bank |
| Customers | Read | Who pays you, since when |
| Products | Read | What you sell |
| Prices / Plans | Read | At what price and interval |
| Invoices | Read | Issued, paid, overdue |
| Subscriptions | Read | MRR, renewals, cancellations |
| Credit notes | Read | Adjustments against invoices |
| Coupons / Promotion codes | Read | Discount impact on revenue |
| Checkout Sessions | Read | Conversion and abandonment |
Nothing to enable for Connect unless you operate a platform with connected accounts — in that case, add read access for the connected accounts you want included.
Then click Create key.
Step 5 — Copy the key and store it
- Complete the two-factor verification Stripe sends you.
- Click the key value to copy it. It starts with
rk_live_. - Save it now. Stripe shows the full value once. If you lose it, you can’t retrieve it — you’d have to roll the key and start again.
- In the Add a note field, write where you stored it (your password manager, for example), then click Done.
Step 6 — Paste it into Docil
- Open app.docil.ai and go to Connessioni.
- Select Stripe.
- Paste the key and save.
Docil validates the key immediately and begins indexing. First sync takes a few minutes on a small account, longer if you have years of invoices. When it finishes, ask it something real:
“Compare this month’s net revenue against the same month last year and tell me what changed.”
Which key is which
Stripe shows several credentials on the same page. Only one of them belongs in Docil.
| Prefix | Name | Use it with Docil? |
|---|---|---|
pk_live_ / pk_test_ |
Publishable key | No. Public, front-end only, reads nothing useful. |
sk_live_ / sk_test_ |
Secret key | No. Full control of your account — never share it with any third party. |
rk_live_ |
Restricted key, live | Yes. This is the one. |
rk_test_ |
Restricted key, test | Only if you’re deliberately testing against sandbox data. |
whsec_ |
Webhook signing secret | No. Different purpose entirely. |
If a tool ever asks you for a key starting with sk_, push back. Stripe’s own recommendation is to use restricted keys instead of unrestricted secret keys wherever possible, and especially when handing access to an AI system.
What this key can and cannot do
Can: read the billing data you selected, so Docil can cross-check it against your contracts, your ads and your CRM in the same conversation.
Cannot: create a charge, refund a customer, cancel or modify a subscription, change a price, trigger a payout, or read anything you left on None.
If you later ask Docil something that needs a resource you didn’t enable, Stripe returns a permission error and Docil tells you exactly which permission is missing. Add it in one click — no need to create a new key.
Revoking access
Disconnecting is entirely on your side, and instant:
- Go to dashboard.stripe.com/apikeys.
- Find your Docil key and open the overflow menu (⋯).
- Select Roll key (replaces the value) or Delete (revokes it outright).
Access stops the moment you confirm. Your other integrations are unaffected, because they use their own keys.
You can also click View request logs from that same menu to see every call Docil has made with the key — a full audit trail, separate from the rest of your account.
Troubleshooting
“I can’t see Developers in the sidebar.”
Your Stripe role doesn’t allow key management. Ask the account owner to create the key and send it to you through a password manager, or to upgrade your role.
“I lost the key before saving it.”
Roll it from the API keys page and copy the new value. Update it in Docil afterwards.
“Docil says the key is invalid.”
Three usual causes: a stray space at the start or end when pasting, a key from a different Stripe account, or a key that has already been rolled. Check the last four characters against the ones shown in your Dashboard.
“The numbers look empty.”
You’re almost certainly on a test-mode key (rk_test_). Turn Test mode off, create a live key, and replace it in Docil.
“Some answers are missing subscription or invoice data.”
The key is missing a Read permission. Open the overflow menu (⋯) next to the key, select Edit key, add the resource, and save. Docil picks it up on the next sync.
Frequently asked questions
Do I need a paid Stripe plan for this?
No. Restricted API keys are part of every Stripe account at no extra cost.
Can I use one key for several tools?
You can, but don’t. Stripe recommends one key per service, so that revoking or rotating one tool’s access never breaks the others.
Does Docil store my key?
It’s held encrypted in your workspace and used only to read the resources you granted. Delete the connection and the credential goes with it. On Enterprise deployments, the key never leaves your own infrastructure.
Can I connect more than one Stripe account?
Yes. Create a restricted key in each account and add them as separate connections.
What if I also want Docil to read my contracts, ads and CRM?
That’s the point of connecting more than one source. Stripe tells you what happened to the money; your contracts and campaigns tell you why.
Connected Stripe? Ask your first question at app.docil.ai — or start a free trial if you haven’t yet.