Skip to content
VaultDBDocs

Authentication

Every request to the VaultDB API needs a credential in the Authorization header, as a bearer token:

curl https://api.vaultdb.io/api/databases \
  -H "Authorization: Bearer $VAULTDB_API_KEY"

The API reads no other header and no query parameter for credentials. A request without a valid credential gets 401.

API keys

Create API keys in the admin app under System, then Security, then API keys (admin.vaultdb.io/system/security/keys). A key starts with aak_ followed by 40 letters and digits.

When you create a key you choose:

  • A name. If you use row-level security, a policy can match rows against the name of the key that makes the request.
  • Permissions. A key can do only what its permissions allow, and you can only grant permissions you hold yourself.
  • An expiry date (optional). After it passes, the key stops working.

A key belongs to your account. It can never reach another account's databases, whatever permissions it holds.

A key stops working when you delete it, when it expires, or when the person who created it is deactivated or removed from the account.

Keep keys out of browser code and public repositories. Anyone who has a key can use it.

Permissions

Permission Name in the admin app Allows
Databases Databases Listing databases and tables, reading rows and table schemas, CSV and JSON export, vector search, listing branches and snapshots, the realtime stream, reading the GraphQL schema, downloading the SDKs and the OpenAPI document.
Databases.edit Manage databases Creating and deleting databases and tables, inserting, updating and deleting rows, CSV import, creating branches, taking, restoring and deleting snapshots, running GraphQL queries and mutations.
Databases.sql Run SQL Running raw SQL.
Databases.policies Row-level policies Listing, creating and deleting row-level policies.
Databases.webhooks Webhooks Listing, creating and deleting webhooks.
Databases.schedules Scheduled queries Listing, creating and deleting scheduled queries. Creating one also needs Databases.sql, and so does seeing a schedule's SQL and last result.
Billing Billing Reading the plan, its limits and usage (GET /api/billing/status).

An organization's administrators hold every permission, Databases.sql included. Other members and API keys hold Databases.sql when it is granted to them, and a grant of * or Databases.* includes it. A key that acts as an administrator holds it too.

Running a GraphQL query, even one that only reads, needs Databases.edit, because the same endpoint also runs mutations.

Plans and permissions

A permission lets a key call an endpoint. Your plan decides whether the feature is available at all. For example, a key with Databases.webhooks on the Free plan still gets 403 when it creates a webhook, because the Free plan includes no webhooks. See Plans and limits.

Rate limits

The API can refuse a request with 429 Too Many Requests when too many requests arrive in a short time. The response includes a Retry-After header. Wait that many seconds before you retry. A request made with an API key also gets 429 once your account has used its plan's API calls per day; then Retry-After counts down to 00:00 UTC.

Signed-in sessions

The admin app calls the same API with the session token of the person who is signed in. The API accepts that token in the same header. For your own code, use an API key.