Skip to main content

Authentication

API Authentication

The FoundryDB API uses HTTP Basic Authentication. Pass your credentials on every request.

curl -u USERNAME:PASSWORD https://api.foundrydb.com/managed-services

With most HTTP clients you can set this once per client instance rather than on every call.

Node.js (axios)

import axios from 'axios';

const client = axios.create({
baseURL: 'https://api.foundrydb.com',
auth: { username: 'admin', password: 'your_password' },
});

const { data } = await client.get('/managed-services');

Python (httpx)

import httpx

client = httpx.Client(
base_url='https://api.foundrydb.com',
auth=('admin', 'your_password'),
)

resp = client.get('/managed-services')

Go

req, _ := http.NewRequest("GET", "https://api.foundrydb.com/managed-services", nil)
req.SetBasicAuth("admin", "your_password")

resp, err := http.DefaultClient.Do(req)

Database User Credentials

Database users are separate from API credentials. Each service has its own set of database users.

List users

curl -u admin:password \
https://api.foundrydb.com/managed-services/{id}/database-users

Reveal a password

Passwords are not stored in plaintext. Use this endpoint to retrieve them:

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/database-users/{username}/reveal-password
{
"password": "generated_password_here"
}

Reset a password

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/database-users/{username}/reset-password

Create a new database user

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/database-users \
-H "Content-Type: application/json" \
-d '{"username": "app_readonly", "role": "readonly"}'

Available roles depend on the database engine. For PostgreSQL: admin, readonly. For MySQL: admin, readonly. For MongoDB: readWrite, read.