Skip to content

Site approval

Markdown

Your user approves each site before your app can use it. Apigami shows your app’s name and the site you’re asking for. The user can allow access, decline it or remove it later.

Some sites may already be approved when your app first calls. When the user attached their browser in Apigami’s window during the connection, the same click approved the domains your manifest declares with "via": "extension", and those of the applications it uses, except an optional sub-app’s: those are approved when the person accepts it, or at its first call. Every other site goes through the approval below.

So a person who has just connected may still see the approval window at your app’s first call on a site: when their Apigami extension is older than 0.15.0 or was offline, nothing was approved at the connection, and a site your manifest declared after they connected is asked on the screen of new permissions, or at its first call in a browser whose extension cannot approve it there. Tell them to expect it, and to click Authorize in it.

From Apigami 0.15.0, the approval window also shows the email of the account it decides for. When several accounts attached to that browser are connected to your app, the user picks one in the window, and the decision holds for that account only.

An approval belongs to the user, not to one browser: it applies in every browser attached to their account. Each browser also holds the browser’s own permission for the site, and Apigami only sends a call to a browser that has it.

Make your first POST /call for a site. Apigami opens the approval window and waits up to 45 seconds for the user’s answer.

What the user does What your app receives
Allows access The request completes and returns its result.
Declines 403 no grant. Respect the decision; don’t retry automatically.
Hasn’t answered yet 403 consent requested with consentPending: true. Try again after they answer.

Later calls use the saved decision. Repeating a pending request doesn’t open another window.

Nobody waits on a queue’s task, a cron or an action an event subscription runs, nor on what they call: the window still opens for a person connected to your app, and the call answers consent requested at once; for one you reach through another application, none does (When an application calls yours). An action run for an event must then answer an error, never a 2xx, so the delivery is tried again once the user had time to decide; a user who never decides can, on a subscription with no other traffic, get it disabled after seven days of failures.

Use a hostname such as example.com, without a URL path. Approval also covers its subdomains, such as api.example.com, over HTTPS. It doesn’t allow access to other sites.

A declined site isn’t requested again. The user changes their mind on their Apigami space, for a site, emails and AI alike (Apigami’s settings in their browser, opened by its icon in Chrome’s toolbar, allow a site again too): every 403 no grant carries settings_url, the link to hand them, opened on your app’s entry when the refusal is your app’s own. Allowed again, the browser they clicked in asks Chrome’s own permission right away; in another of their browsers, a site’s next call opens that window (with several browsers online, name one with install_ref). A refusal or a revocation applies to all of them at once, and stops subsequent calls with 403 no grant. Live streams on that site close with revoked. Removing an optional sub-app from their account page removes the approvals only that sub-app brought, the same way.

Listen for app_user.updated events to keep your app up to date with these decisions.

Your user grants your emails and your use of an AI the same way, once each, for your app: emails and ai, the permissions your manifest declares. They are granted on Apigami’s pages rather than per site: « Continue » on the connect page grants those it shows, and the box of your emails must be ticked to continue. A grant holds in all their browsers and on their phone.

identity, their name and email, is granted on the connect page only, with their name when they have none, never in the approval window nor on their Apigami space, and is never refused: without it, you receive identity: null, and no call is refused for it. An optional sub-app of another group gets it on its own line of the acceptance screen, in its own name, never as a permission of the root.

A use without it is refused like a site, with the permission named:

Answer Meaning
403 { "error": "consent requested", "permission": "ai" } Never decided. With "consentPending": true, the approval window is on screen.
403 { "error": "no grant", "permission": "emails", "settings_url": "…" } Refused. Only the user changes it, on their Apigami space at settings_url, with Allow. A grant is never taken back there, except by Remove on an optional sub-app they accepted, which takes back the grants only it brought, emails and ai included: someone who no longer wants it stops using your app.

When a browser of theirs runs Apigami 0.16.0 or later, a use the person never decided opens the same approval window as a site, one window per permission, and waits up to 45 seconds; never for a refusal, never for an optional sub-app they have not accepted. An older browser opens nothing: the call answers consent requested at once. Their last answer counts: a window still open, clicked after they decided on another screen, records that click, and you receive app_user.updated.

What a person granted stays granted, and what they refused stays refused: a new version never extends their access in silence. When a version you publish asks for more than they ever decided, yours or a mandatory sub-app’s, or a sub-app turns from optional to mandatory, they are asked on Apigami’s screen « Your app asks for new permissions » at their next opening of one of your pages, of your install link, or of the link your server builds with POST /connect/par for an app without pages here. It is the same screen whatever the link: the sites, emails, AI and identity they never decided, with a field for their name when identity needs one, and one button, Authorize; then your page opens (or « Connected » for an app without pages). The sites are listed only in a browser whose Apigami extension can approve them, in its own window opened by the same click; elsewhere a new site goes through the approval window at its first call. There is no Refuse: what your app asks is what it needs, so someone who does not authorize stays on that screen, and your page does not open for them. A refusal only ever comes from an earlier decision or from an approval window, and the screen never asks it again.

Until they answer, only the use that needs the new permission is refused, 403 consent requested with permission; for identity, nothing is refused and you receive identity: null, so send the person who has to be named to your install link, all the more for an app without pages. To have it decided, send the person to one of your pages, to your install link, or to your link from POST /connect/par. Your app can never grant anything on their behalf. A member of your team who tries a version with app_run or app_page_preview gets its emails, AI and identity granted for that trial, without a screen and without being asked a name: name stays null until they give one.

app_publish tells you what a version will ask again, and app_status how many people still have to decide.

When your manifest declares subprocessors, terms or a data processing agreement, the connect page shows one box per application that brings any, yours and each mandatory sub-app’s: « I accept the terms of app », with the terms, the data processing agreement when you declare one, and the subprocessors, each with its role and where it processes data, as links. Continue and Authorize stay greyed until every box is ticked. An optional sub-app’s box is shown when the person accepts it, on its screen of new permissions. The agreement is recorded per person, per application and per version of its terms, under the application they connected to, and holds in all their browsers. Someone already connected when an application first declared its terms keeps being served under what it declared then, and is asked only for what a later version changes.

A version that adds a subprocessor, moves one to another location, or changes its terms or data processing agreement address is asked again like a new permission, on the screen « Your app asks for new permissions » at the person’s next opening of one of your pages, of your install link or of your link from POST /connect/par. The approval window of the Apigami extension never asks it. Until they agree, every use of that application for them is refused, a site, emails, AI, an action, a sub-app’s action or a task alike, GET /v1/users/{user_ref}/installs included:

{ "error": "consent requested", "terms": ["3f6c2d1e-…"], "connect_url": "https://app.apigami.com/connect?app_id=…" }

terms lists the app_id whose terms wait, bare identifiers, unlike the boxes GET /apps/{app_id} describes; on emails and AI it comes instead of permission, whatever the person granted. A task already queued for them is not lost: it is tried again every hour, for up to a day, then abandoned; a task you add for them is taken and waits the same way; their streams report nothing meanwhile, and resume once they agree. Send the person to connect_url, your install link, present when the person agrees under your application, or to one of your pages; if you reach them through another application, put the work aside and try again later. Their Apigami account page also says which application waits for them. Removing a subprocessor asks nothing. A member of your team trying a version with app_run agrees to your team’s own terms for that trial, without a box; another team’s sub-app waits for theirs. app_publish says which applications’ terms a version asks again, and app_status how many people still have to agree.

If you’d like to ask for a site before making a call, use POST /requests:

Terminal window
curl https://api.eu.apigami.com/requests \
-H "Authorization: Bearer $APIGAMI_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"user_ref\": \"$APIGAMI_USER_REF\",
\"targetDomain\": \"example.com\"
}"

Keep the user’s browser online for this step. The window opens in the browser Apigami would use for a call to that site; add install_ref to choose it.

Approval request responses
Response Meaning
200 { "ok": true } The approval window has been requested. The user’s answer is still pending.
200 { "ok": true, "granted": true } The user already approved this site.
403 no grant The user previously declined or revoked this site; settings_url is where they allow it again.
503 extension offline The browser is offline. Ask again when it’s connected.
503 extension outdated Apigami in that browser must be updated. Chrome installs the update on its own; ask again once it has reconnected.

The user must already be connected to your app, or the API returns 403 not paired without opening a window.