APIs

API Key

In shortA secret code that identifies your project when a script or tool calls an API, so the provider can authorise the request and bill your account.

Updated 24 Oct 2026· 2 min read

An API key is a long, unique string that a program sends with each request to an API. It tells the provider which project or account is making the call, so it can check permissions, apply rate limits and bill usage. Almost every practical in MLforSEO’s courses, from the Google Natural Language API in Google Sheets to OpenAI in Colab, starts with creating one.

How it works

You create a key in the provider’s console. In Google Cloud, you select a project, enable the API you need (for example the Cloud Natural Language API), make sure billing is enabled, then go to APIs & Services, Credentials, Create credentials, API key. In OpenAI or Anthropic, you generate a key in the account’s API settings and set up billing. Your script then includes the key in the request, usually in a header or a URL parameter.

API keys are the simplest form of authentication, and the least secure. Google Cloud also offers OAuth client IDs (acting on behalf of a signed-in user) and service accounts (for server-to-server jobs), which suit larger or more sensitive projects.

How it’s used in SEO and marketing

  • Running NLP analysis (entities, sentiment, classification) from Google Sheets with Apps Script.
  • Calling LLMs through the OpenAI API to rewrite titles and meta descriptions or generate content briefs in Google Colab.
  • Pulling SERP, keyword and Search Console data from tools such as DataForSEO or the Search Console API.
  • Connecting automation tools such as Zapier or n8n to the AI services they call.

Example

To run the entity extraction template, you create a Google Cloud project, enable the Natural Language API, create an API key, then restrict it to that API only. You paste the key into the Apps Script editor (never into a visible cell of a shared sheet) and run a function that sends each row of text to the API and writes the entities back.

Limitations and things to watch

  • Treat keys like passwords. Anyone who has one can run up charges on your account.
  • Never commit keys to GitHub, paste them into shared notebooks or send them in chat. Use environment variables, Colab secrets or Apps Script properties.
  • Restrict each key to the APIs (and, where possible, the apps or IP addresses) that need it, and set budget alerts.
  • Rotate or delete keys you no longer use, and revoke a key immediately if it leaks.

Learn it on MLforSEO

Where API Key shows up on MLforSEO

Sources and further reading

Other terms from APIs

See all 15 APIs terms →