API Key Security
Storage
Do:- Store keys in environment variables
- Use secrets management services (AWS Secrets Manager, Vault, etc.)
- Rotate keys periodically
- Commit keys to git
- Include keys in frontend bundles
- Share keys via unencrypted channels
Key Types
Making, Rotating and Deleting Keys
You make and manage your keys in the dashboard: open the workspace, then Settings → API keys (the owner of a workspace opens it). There you make a key (a name and what the key may do), rename it, switch it off, delete it and read what it was used for. The workspace’s plan must include API access (the home workspace of a partner has no plan: its keys work while the partner account is in force). A key works in the workspace it was made for and in no other, whichever workspace you have open afterwards. When the workspace’s plan ends the key is switched off, not deleted, in the REST API, the CLI and the MCP server alike, and it works again when the workspace has a plan (see Keys and your workspace plan); deleting the workspace deletes its keys.- Only a person signed in on widgetic.com can make a key. A request made with an API key or an SDK token is refused with
403, so a leaked key cannot make a second one that outlives its revocation. Switching a key back on needs a person signed in too. - The dashboard asks for your password again before it makes a key, switches one back on or deletes one, although you are signed in. A browser session that was left open, or stolen, then cannot hand out your keys or delete the ones your integrations run on. A few wrong passwords in a row make it wait before it takes another try, even a right one. If you sign in with Google or GitHub there is no password to ask for, so it does not ask. Renaming a key and switching one off need no password, because they can only make a key do less.
- The owner is emailed when a key is made, switched back on or deleted (see Emails About Your Account), so a key that someone else made does not go unnoticed.
- The secret is shown once, when the key is made, and cannot be shown again.
- Choose what the key may do when you make it: Full access, Content, Read only or Custom. See Limit what a key can do.
- A partner makes its keys the same way. In your partner’s home workspace the key you make is a partner key (
wgt_prt_): make one for each integration, named after it (the checkout server, the support tool), with only the access that integration needs. Widgetic does not make or send you a key. A partner has one workspace and nobody else joins it, so the keys of that workspace are the only keys your integration holds. When the partnership ends they can read for 60 days and then stop (see Ending a Partnership).
Limit Where a Key Can Be Used
A key works from any address by default. If a key lives on one server, or on a few, with an address that does not change, you can list the addresses that may use it, so that a copy of the key that leaks is of no use anywhere else.- Where: in the dashboard, when you make a key (Allowed IP addresses, optional) or afterwards, from the menu of the key. Write one address or range on each line:
203.0.113.5,203.0.113.0/24or2001:db8::/32. A list holds up to 20 entries. - What happens: a request that carries the key from an address that is not on the list is refused with
403and the codeAPI_KEY_IP_NOT_ALLOWED. The address that counts is the one Widgetic sees the request come from. Leave the list empty to allow every address, which is how every key starts. The ranges that mean every address (0.0.0.0/0and::/0) are refused as a list, since they would say nothing. - When it applies: at once on the server that took your change, and within five minutes on the others.
- It limits the key, not you: you, signed in on widgetic.com, are not affected by a list, and can always change it. Changing the list asks for your password again, like deleting a key does, and emails the owner.
- Do not use it for a host whose address changes (most serverless platforms, and any server behind an address that moves). The key stops working from the new address, and you have to open the dashboard to put it right.
Protecting Your Account
Whoever signs in as you can make API keys, change the websites your embeds may appear on and read everything in your workspaces. A partner login is worth the most, because it holds the keys of a whole platform. These measures apply to every account, unless a line says that it is for partners.Asking for Your Password Again
The dashboard asks for your password a second time before it does anything that would hand your account to someone else, although you are signed in. A browser session that was left open, or stolen, then cannot take the account over, because the person at the keyboard does not know the password.
A few wrong passwords in a row make the dashboard wait before it takes another try, even a right one. If you sign in with Google or GitHub there is no password to ask for, so it does not ask, and choosing a new password with the link from a “Forgot password” email is proof enough on its own.
A server cannot type a password, so a call made with an API key is not asked. That matters for the two partner settings that are also public API calls, the webhook address and the storage destination: the owner is emailed when either changes (or when the storage destination is removed), whoever changed it, and the change is written to the security activity of the account. Keep API keys on your servers only, and use the allowed addresses of a key to narrow where it works.
Two-Step Sign-In
Two-step sign-in asks for a six-digit code from an authenticator app (1Password, Google Authenticator, Authy or any other app that reads a QR code) as well as your password, so a stolen or guessed password is not enough to sign in.- Open your account settings and find Two-step sign-in.
- Enter your password, scan the QR code with your authenticator app (or type in the secret it shows) and enter the first code the app gives you.
- From then on, signing in asks for a code after the password, whether you sign in with a password, Google or GitHub.
- Turning it on signs you out of your other devices, so nobody who had your password before keeps a session.
- You can add up to three authenticator apps. Add a second one, on another device, as your spare: there are no backup codes. Removing an app asks for your password again.
- API keys and SDK tokens do not ask for a code, because a server cannot type one. The rules for keys above protect them.
- If you lose every device, the support team can remove the second step after they have checked that it is you. You get an email when it is removed, and you set it up again once you are back in.
- Partners must have it. A partner login holds the keys of a whole platform, so two-step sign-in is required for every partner account. A partner that has no authenticator app yet can still sign in, but the dashboard offers nothing except the setup (and signing out) until it is done. API keys keep working meanwhile: the requirement is about the person who signs in, so your integration is not interrupted.
- Partners cannot remove their last app. Add the new app first, then remove the old one. Two apps on two devices is the way back in when one phone is lost.
Emails About Your Account
Widgetic emails the owner of the account when something that is hard to undo happens, so that a change you did not make does not go unnoticed. Nothing is switched on in the dashboard: it applies to every account.
The first sign-in of a new account is not announced, and a browser that has not been used for a long time counts as a new device again. An email holds no password, no code and no link that signs you in: its button opens your security settings. (The email that says a hold was lifted holds a link to choose a new password, because the old one stops working.) Use a shared mailbox that your team reads as the owner address, so the email reaches someone the same day.
If an email is about something you did not do, follow If you think an account or a key was compromised.
Security Activity and Signed-In Devices
Two lists in your account settings show what is happening to the account, so that you can see it before an email does.- Signed-in devices lists every browser and app that is signed in to the account now: the device, when it signed in, when it was last active and whether it gave the code of two-step sign-in. The one you are using is marked. Sign a device out one by one, or choose Sign out of all other devices. A device that was signed out has to sign in again, with the code if the account asks for one. What it already holds can work for the rest of its hour (an access token lasts at most one hour), so after a compromise also change the password and rotate the keys.
- Security activity lists what happened to the account, newest first: a sign-in from a new device, a device signed out, a change of password or email, two-step sign-in turned on or off or reset by Widgetic, a key made, switched back on or deleted, a change of the addresses that may use a key, a change of the allowed websites, of a partner’s webhook address or of its storage destination (set or removed), and a security hold put on or lifted. Each line says what happened and when. It never holds a password, a code, a key or an address, and Widgetic keeps a line for 400 days.
Partner Accounts
A partner account has one login and one workspace, and neither can be deleted from the dashboard: the option is not offered. This is on purpose. Your customers’ editors, embeds and files depend on that account, so a partnership ends by a date that Widgetic writes down, and not by a click (see Ending a Partnership). Deleting a partner key still asks for your password, like on every account.Client-Side Authentication
A browser must never hold an API key (wdg_org_ or wgt_prt_). Keep your API key on your server and have your backend make API calls on behalf of your application, or—when mounting Widgetic’s editors in your page for one of your customers—mint a short-lived editor session on your server:
Domain Validation
You can limit the websites an embedded widget may appear on. If you list nothing, the widget works everywhere.- Open Allowed Domains in the dashboard (for a team workspace, use that workspace’s settings; only its admins and owners can change the list)
- Add each website:
example.comalso coverswww.example.com, and*.example.comcovers the domain and every subdomain - Leave
localhostout: a page on your own machine always works, however short the list is (see below)
{orgId} (GET /tokens/validate answers it as data.workspace.id). GET /organizations/{orgId}/domains reads it, POST on the same path adds a website with the body { "domain": "example.com" }, PUT /organizations/{orgId}/domains/{domainId} changes one, and DELETE on that path removes one. A wildcard such as *.example.com is one entry, however many subdomains it covers. The list of an ordinary account holds up to 50 websites, and the 51st answers 409 with the code BUSINESS_STATE_CONFLICT. If you are a partner, the list of your partner’s workspace has no limit: your customers may publish on their own domains, and you can add each of those by code, one POST for each website. A change applies within about 15 seconds.
Once a list exists, the lookup that returns a widget’s content answers 403 with the code DOMAIN_NOT_ALLOWED to a page on any other website, and the widget’s frame page asks the browser not to show it anywhere else. A very long list, which only a partner can have (more than about fifty websites of ordinary length), does not fit in that request to the browser, so the frame page is then shown without it; the lookup, and the entries a visitor sends, still refuse every website that is not on the list. Widgetic’s own sites always work, and so does your own machine. If you are a partner, your platform’s website always works too (see below). The lookup never refuses a page on localhost, on 127.0.0.1 (or any address from 127.0.0.0 to 127.255.255.255), on [::1] or on a name under .localhost, on any port, and the widget’s frame page may be shown by localhost, 127.0.0.1 and names under .localhost, on any port, over http or https. You can build and test an integration without listing your laptop: only the person who runs such a page can see it, so listing it would protect nothing. A list that cannot be read never blocks a widget.
The frame of a workflow, and its oEmbed card, follow the list of the owner of the workflow’s first composition in the same two ways: the frame asks the browser not to show it on another website, and the card answers 403 there. See Show a workflow where you cannot add a tag.
If you use the Partner API, the allowedDomains of your partner account is added to the list of your partner’s workspace, and applies to the widgets made with your partner keys.
Your platform is always allowed
If you are a partner, the website where you integrate Widgetic is always allowed, with all of its subdomains. Tell Widgetic which website that is when your partner account is set up, for exampleacme.com, and Widgetic records it as your platform domain. acme.com and every subdomain of it (app.acme.com, learn.eu.acme.com) can then always show your widgets, and the entries their visitors send (such as votes or form answers) are always accepted from them, whatever your list holds. The widgets your customers make through you are covered too, because they belong to your account.
- You never have to list it, and a list can never lock it out. It is not an entry of your list, so adding websites to the list, or removing them all, never changes it.
- It never narrows anything. If you list nothing, your widgets still work on every website, not only on your platform.
- Widgetic sets it, you read it.
GET /partners/minegives it asplatformDomainfor each partner you administer, and it isnulluntil Widgetic has set one. To change it, write to the support team. - It is one website. Give Widgetic the bare name, such as
acme.com; an address likehttps://www.acme.com/pricingis shortened to it. A different website that also shows your widgets, such as a separate marketing site, is not covered: put it on your list when you keep one.
A domain list keeps your widgets off other people’s pages. It is not access control: the content of a published widget can still be requested by anyone who has its ID, using a plain HTTP request that names no website for the check to read. Do not rely on it to keep content private.
The
<widgetic> embed script stops at the refusal: it draws nothing, sets data-widgetic-refused="DOMAIN_NOT_ALLOWED" on the element, and writes one warning to the browser console for each widget. It does not fall back to a copy of the widget on Widgetic’s CDN.Webhook Signatures
Widgetic calls your server in two cases: a partner account can be told when something happens to it or to its customers (partner webhooks), and any workspace on a plan with API access can be told when a visitor sends an entry into one of its widgets (MCP events). Every call is signed, with the Standard Webhooks headerswebhook-id, webhook-timestamp and webhook-signature, under a secret that only you hold.
Before you act on a call:
- Check the signature over the raw body, with a Standard Webhooks library or the checks in Verify signatures, which has them in seven languages.
- Refuse a call whose
webhook-timestampis more than five minutes old. - Keep the
webhook-idof every event you handled and drop a repeat: delivery is at least once.
POST /partners/{partnerId}/notifications/webhook-secret, for MCP events by subscribing again with a new secret. The old one keeps signing for a while, so your receiver can switch without a call being rejected. See Rotate a secret.
Rate Limiting
Protect your integration from abuse:Data Protection
Sensitive Data
Don’t store sensitive user data in widget configurations:Audit Logging
Log API interactions for security auditing:Your Customers’ Data
If you are a partner and keep managed users for your customers, Widgetic holds a record for each one. Only partners have managed users, and reading or deleting a record takes an active partner API key:managedUserId label. To erase a customer’s content as well, list it with the managedUserId filter and delete it first, then delete the record (see Managed Users).
If You Think an Account or a Key Was Compromised
Do the first two steps at once.- Stop the key. Switch it off or delete it in the dashboard (Settings → API keys). A key that is switched off or deleted is refused at once by the server that took the request, and within a minute by the others.
- Tell Widgetic, and say that it is urgent. Write to the support team from the address of the account. If you think the login itself is in somebody else’s hands, say so: for a partner account Widgetic can put a security hold on it, which is the one step that locks a login you can no longer trust. A hold does not stop your keys, so say as well if a key may have leaked.
- Change your password and turn on two-step sign-in. Turning it on signs out your other devices. If you can no longer sign in, because the password was changed under you, say so when you write: that is the case the hold is for.
- Sign out the devices you do not recognise (account settings, Signed-in devices), and read the Security activity: it shows what was done with the account, and when.
- Look at what was changed. The list of allowed websites, your webhook address and its secret (make a new secret: see Rotate a secret), your storage destination, and any key you do not recognise.
- Rotate what the intruder could have read. Make the new key, switch your servers over and delete the old one, as in Making, Rotating and Deleting Keys.
The Security Hold on a Partner Account
When Widgetic is told that a partner account may be compromised, it can put a security hold on it. A hold locks the way into the account and nothing else:- Nobody can sign in to the account, with a password, Google or GitHub, and every session of the owner ends, on every device. A request that carries a session of the owner is refused with
403and the codePARTNER_SECURITY_HOLD. - Everything that does not need the owner’s login carries on as normal. Your API keys, the calls your servers make, your customers’ editors and embeds, your published widgets, your webhooks, billing, credits and usage keep working, and your customers see nothing and are not told.
- A hold is not a pause. A pause is what stops your customers’ embeds and calls, for a reason such as a late payment; a hold is only about who may open the account. A hold does not switch your keys off either, so if a key may have leaked, tell Widgetic when you report it: the account can be paused separately while you rotate the keys.
- Nothing is deleted. Your keys, widgets, compositions, managed users, files and invoices stay as they are, and no date of your contract changes.
Security Checklist
API Key Management
API Key Management
- Keys stored in environment variables
- Keys rotated quarterly
- Separate keys for dev/staging/production
- Keys that nothing uses are deleted
- Access logged and monitored
Your Account
Your Account
- Two-step sign-in is on (partner accounts must have it), with a second authenticator app as a spare
- The owner address is a mailbox your team reads, so the security emails reach someone the same day
- An email about a sign-in or a change you did not make is acted on the same day
- The signed-in devices and the security activity are looked at now and then, and what you do not recognise is signed out
- A key that lives on a server with a fixed address is limited to that address
- Partner accounts: you know how to reach the support team in an emergency
Client Security
Client Security
- Token exchange for browser apps
- Short token expiration (a token lasts at most 1 hour)
- Domain validation enabled
- Partner accounts: your platform domain is set (
platformDomaininGET /partners/mine) - CSP headers configured
Webhooks and MCP events
Webhooks and MCP events
- Signature checked on the raw body
- Calls older than five minutes refused
- Repeats dropped by
webhook-id - A
2xxanswer within ten seconds, with the slow work done afterwards - Secret kept out of git, and replaced if it leaks