Docs contents

Authentication with API keys

Send your GoiAPI API key in the Authorization Bearer or x-api-key header, keep it in environment variables, and restrict each key by IP and model.

Ask AI and more
View as Markdown

Every request to https://api.goiapi.com/v1/... needs an API key, sent in one of two headers:

HTTP
Authorization: Bearer <API_KEY>
HTTP
x-api-key: <API_KEY>

If both are present, x-api-key is used. Keys passed as URL query parameters are not accepted.

  • Missing key: 401 error "Missing API key. Send your key in the Authorization: Bearer <key> header or the x-api-key header."
  • Wrong or revoked key: 401 error "The API key is invalid or has been revoked."

Per-key restrictions

In the dashboard, you can restrict each key to:

  • Allowed models: calling a model outside the list returns 403.
  • Allowed IP addresses: calling from any other IP returns 403.

Keep your key safe

  • Never put keys in code you push to GitHub or paste them into chats. Use environment variables.
  • Use a separate key for each tool or project so you can revoke one without touching the rest.
  • If you think a key has leaked, revoke it in the dashboard and create a new one. Our support team will never ask for your key.