API Tokens

An API token (bf_pat_…) lets a script, a CI job or an AI agent manage your account and projects without signing in to the dashboard. Each token holds a set of permissions (scopes) and, optionally, a team: it can do what those permissions allow, inside that team, and nothing else.

API tokens are for the management API. Your application's own data traffic (rows, storage, SQL, auth) uses the project's keys instead; see API Reference.

Create a token

Open Account → API Tokens and choose Create Token. Name it, turn on only the permissions it needs, pick a team if it should stay inside one, and set an expiry for automation. The token is shown once; copy it then. Lost tokens are rolled, not recovered.

Use it

curl -s https://api.basefyio.com/api/projects?teamId=<TEAM_ID> \
  -H "Authorization: Bearer $BASEFYIO_TOKEN"            # needs projects:read

curl -s -X POST https://api.basefyio.com/api/projects/<PROJECT_ID>/database/indexes \
  -H "Authorization: Bearer $BASEFYIO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"table":"orders","columns":["customer_id"]}'      # needs schema:write

Where a token is accepted

Reading (GET) needs the area's :read permission; creating, changing and deleting (POST, PUT, PATCH, DELETE) need its :write permission.

AreaRoutesPermissions
Projects/api/projects, /api/projects/:id, imports, /api/projects/:id/branchesprojects:read · projects:write
Project settingsrow limit, connection limit, /api/project-folders, /api/project-tags, AI disclosuresettings:read · settings:write
Credentials/api/projects/:projectId/api-keys, database passwords and rolessecrets:read · secrets:write
Database objects/api/projects/:projectId/database/* (indexes, triggers, functions, extensions, policies)schema:read · schema:write
Data import/api/projects/:projectId/data-imports/*data:read · data:write
Exports, backups, recovery/api/projects/:id/export, /backups, /pitrbackups:read · backups:write
Activity/api/projects/:id/activitylogs:read
Embeddings/api/projects/:projectId/embeddings/*embeddings:read · embeddings:write
Realtime/api/projects/:projectId/realtime-bindingsrealtime:read · realtime:write
Integrations/api/projects/:projectId/integrations/*, /api/team-integrations/:teamId/*integrations:read · integrations:write
Sheet to App/api/blueprints, /api/migrations/:runIdblueprints:read · blueprints:write
Teams/api/teams, members, roles, invitationsteam:read · team:write
Billing (read only)subscription, usage, project costs, invoices, billing account, payment methodbilling:read
Notifications/api/notificationsaccount:read · account:write
Feedback/api/feedback, comments, historyfeedback:read · feedback:write

Always a dashboard session

These answer 403 to any token, whatever its permissions:

  • creating, rolling, listing or revoking API tokens
  • sign-in, profile, MFA and organizations
  • every billing change: checkout, payment methods, plan changes, cancelling or resuming
  • creating, deleting or leaving a team, transferring ownership, changing a team's security or role permissions, answering an invitation, and moving a project to another team
  • the dashboard assistant, search and suggestions

Routes for a project's own data (tables, rows, storage, SQL, flows) take the project's keys, not an API token. An agent that needs SQL or data access with a token can use the MCP server.

How access is enforced

  • Closed by default. A route accepts a token only when it names the permission it needs. Any route that does not is refused with 403, so a new feature never becomes reachable with a token by accident.
  • Team restriction. A token created for one team gets 403 This API token is limited to another team. on any project or team of another team, and lists only show its own team, even when you belong to several teams.
  • Your rights, never more. The token acts as you: it reaches only teams you are a member of, and your team role still applies to every action.

Errors

StatusMeaning
401Missing, invalid, revoked or expired token
403The token lacks the permission (API token is missing required scope(s): …), the route needs a dashboard session, or the target belongs to another team
404The project or resource is not in a team the token can reach