API Tokens Explained: Keys, Bearer Tokens and OAuth

The kinds of keys business apps hand out, how each one is sent, which to pick when an app offers several, and how to keep them out of a shared sheet.

By Jake Marsh. Updated Nov 29, 2026.

The five kinds of keys you'll meet

Every business app's API needs to know who is asking. They all hand you a secret to prove it, but they call it different names and expect it in different places. These are the five you'll see when connecting apps to a spreadsheet:

KindWhat you copy from the appWhere it goes on each request
API keyOne long stringA header the app names (often X-API-Key), or sometimes the address
Bearer tokenOne long stringAuthorization: Bearer <token>
Personal access tokenOne long string, tied to your user and the permissions you pickUsually Authorization: Bearer <token>
Basic authenticationA username and password, or a key used as the usernameAuthorization: Basic plus the two joined by a colon, Base64-encoded
OAuth 2.0Either a sign-in screen you approve, or a client ID and secretA short-lived token the app issues, sent as a bearer token

API keys

An API key identifies you (or your account) to the app. The app decides where it goes: Airtable and Notion want it as a bearer token, others want a header with a name of their own, and a few accept it in the address as ?api_key=.... That last style is the one to avoid when you have a choice. The OAuth bearer token standard, RFC 6750, says putting a token in the address carries "the high likelihood that the URL containing the access token will be logged", and recommends against it unless nothing else works.

Bearer tokens

"Bearer" describes how the token works, not where it came from: in RFC 6750's words, any party in possession of a bearer token can use it, with no further proof. That's why these tokens are treated like passwords. It's also why the same string can be called an API key on one app's settings page and a bearer token in its API docs.

Personal access tokens

A personal access token acts as you, with permissions you choose when you create it. GitHub's fine-grained tokens are the clearest example: you pick the repositories, the permissions and an expiration date, and GitHub removes tokens that haven't been used in a year. Create a token like this for a spreadsheet and give it read access only, to only what the sheet needs.

Basic authentication

Basic sends a username and password, joined by a colon and encoded in Base64 (RFC 7617). Base64 is an encoding, not encryption, so Basic is only as safe as the https connection carrying it. Some apps use it with an API key in place of the username and a blank or fixed password; their docs say which.

OAuth 2.0

OAuth replaces the long-lived secret with a token the app issues for a short time. There are two kinds you'll meet. With the authorization code flow you sign in to the app and approve what the connection may read on a screen the app shows. With the client credentials flow there is no sign-in: you create an app or integration in the vendor's developer settings, copy its client ID and secret, and the connection trades them for a token whenever the last one expires. The OAuth client credentials glossary entry walks through each step of that trade.

Which one to pick when an app offers several

  1. Read-only beats full access. If the app lets you choose permissions, give the sheet only read access to what it imports. Stripe, for example, lets you create a restricted key that can only read the resources you tick.
  2. Scoped to a user beats scoped to the account. A personal access token that can see your projects is safer than an account-wide admin key that can see everything.
  3. An expiration date beats none, as long as you'll remember to renew it. Put the date in your calendar.
  4. OAuth sign-in beats copying a secret, when the app offers it, because you never handle a long-lived key at all and can revoke the connection from the app's settings.

Keeping keys out of a shared sheet

A spreadsheet is built to be shared, which is exactly what you don't want for a key. Things that expose one:

What doesn't expose it: Apps Script user properties, which belong to one Google account and stay with that person rather than the file. Cellfetch stores every connection there and binds each key to the address it belongs to, so a key saved for one app is never sent anywhere else. When someone else on the team opens the sheet, they see the data, not the key; to refresh it themselves they connect with their own.

What each app asks for

The key each app asks for, and where it goes on every request. Keys stay in your own Google account, locked to the app's own address, and travel only over https.

Keys by app
AppWhat you createHow Cellfetch sends it
GitHubOn GitHub, open Settings, then Developer settings, then Personal access tokens, then Fine-grained tokens, and click Generate new token.Authorization: Bearer <your token>
StripeOpen dashboard.stripe.com/apikeys (Developers, then API keys), signed in to the Stripe account you want in the sheet.Authorization: Bearer <your token>

When a key stops working

Imports usually fail because of the key, not the code. The common causes, in the order to check them: the key was rotated or revoked (someone regenerated it in the app), it expired, its permissions don't cover the data you asked for (the app answers 403), or the person who created it left and their user was removed. Each app's page on the integrations list says where its key lives and what permissions it needs. To go back to how a request carries the key alongside the address, method and headers, see how to use an API in Google Sheets. Each kind of key also has a short entry in the glossary, with a real import that uses it.

Questions

Is an API key the same as a bearer token?

Often, in practice. A bearer token is defined by how it's sent: in an Authorization header after the word Bearer, and whoever holds it can use it. Many apps call that same string an API key or a personal access token. Others send their API key in a header of their own, such as X-API-Key, or in the address.

Is Basic authentication encrypted?

No. Basic joins the username and password with a colon and encodes them in Base64, which anyone can decode. It's only safe over https, which encrypts the whole request.

What happens to my sheet if I rotate a key?

The old key stops working, so every import that uses it fails until you paste the new one. In Cellfetch you update the connection once and every request that uses it picks up the new key.

Can other people who edit my sheet see my key?

Not if it's kept out of the sheet. Anything in a cell, a formula or the code of a script bound to the sheet is readable by its editors. Apps Script user properties, which is where Cellfetch keeps connections, belong to one Google account and aren't shared with the file.

All guides

Install Cellfetch

From inside a sheet: Extensions > Add-ons > Get add-ons, search Cellfetch, Install. Then Extensions > Cellfetch > Start.