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:writeWhere a token is accepted
Reading (GET) needs the area's :read permission; creating, changing and deleting (POST, PUT, PATCH, DELETE) need its :write permission.
| Area | Routes | Permissions |
|---|---|---|
| Projects | /api/projects, /api/projects/:id, imports, /api/projects/:id/branches | projects:read · projects:write |
| Project settings | row limit, connection limit, /api/project-folders, /api/project-tags, AI disclosure | settings:read · settings:write |
| Credentials | /api/projects/:projectId/api-keys, database passwords and roles | secrets: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, /pitr | backups:read · backups:write |
| Activity | /api/projects/:id/activity | logs:read |
| Embeddings | /api/projects/:projectId/embeddings/* | embeddings:read · embeddings:write |
| Realtime | /api/projects/:projectId/realtime-bindings | realtime:read · realtime:write |
| Integrations | /api/projects/:projectId/integrations/*, /api/team-integrations/:teamId/* | integrations:read · integrations:write |
| Sheet to App | /api/blueprints, /api/migrations/:runId | blueprints:read · blueprints:write |
| Teams | /api/teams, members, roles, invitations | team:read · team:write |
| Billing (read only) | subscription, usage, project costs, invoices, billing account, payment method | billing:read |
| Notifications | /api/notifications | account:read · account:write |
| Feedback | /api/feedback, comments, history | feedback: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
403This 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
| Status | Meaning |
|---|---|
401 | Missing, invalid, revoked or expired token |
403 | The token lacks the permission (API token is missing required scope(s): …), the route needs a dashboard session, or the target belongs to another team |
404 | The project or resource is not in a team the token can reach |