You'll need to authenticate your requests to access any of the endpoints in the MindsDB Cloud. In this guide, we'll look at how authentication works.

OAuth2 with bearer token

The recommended way to authenticate with the MindsDB API is by using OAuth2. When establishing a connection using OAuth2, you will need your access token — you will find it in the MindsDB dashboard under API settings. Here's how to add the token to the request header using cURL or OpenAI Python SDK:

Example request with bearer token

curl \
  -H "Authorization: Bearer {token}"

Example using OpenAI SDK

  from openai import OpenAI
  client_mindsdb_serve = OpenAI(

Always keep your token safe and revoke it if you suspect it has been compromised.

Was this page helpful?