Skip to main content

Authentication

Getting Your API Key

After deploying your ekoDB instance, you'll need an API key to connect your application.

Step 1: Access Your Deployment

  1. Go to app.ekodb.io
  2. Navigate to your deployment from the dashboard
  3. Click on the "Keys" tab

Direct link format: https://app.ekodb.io/deployments/{YOUR_DEPLOYMENT_ID}?active_tab=keys

Step 2: Use Your Admin API Key

By default, ekoDB automatically generates an admin API key when you create a deployment. This key has full access to all collections and operations.

warning

Admin API keys should only be used for development and testing. For production applications, create API keys with limited permissions (see below).

Step 3: Copy Your API Key

Copy the API key from the dashboard and store it securely. You'll use this to initialize your client library:

use ekodb_client::Client;

let client = Client::builder()
.base_url("https://your-subdomain.production.aws.ekodb.io")
.api_key("your-api-key-here") // ← Your API key from the dashboard
.build()?;

Creating API Keys with Limited Permissions

For production applications, create API keys with specific collection permissions.

Register API Key

Register a new API key for authentication:

POST https://{EKODB_API_URL}/api/auth/register
Content-Type: application/json

{
"api_key": "{ADMIN_KEY}",
"label": "{LABEL}",
"description": "{DESCRIPTION}",
# Only required if you want to grant collection permissions to a non-admin API key
"collection_permissions": {
"{COLLECTION_NAME}": ["write", "read"]
},
"is_admin": true || false,
}

# Response
{
"label": "{LABEL}",
"description": "{DESCRIPTION}",
"collection_permissions": {
"{COLLECTION_NAME}": ["write", "read"]
},
"is_admin": true || false,
"key": "{YOUR_NEW_API_KEY}"
}

Generate JWT Token

Generate a JWT token using your API key:

POST https://{EKODB_API_URL}/api/auth/token
Content-Type: application/json

{
"api_key": "{YOUR_API_KEY}"
}

# Response
{
"token": "{YOUR_JWT_TOKEN}"
}

Use JWT Token

Use the JWT token in the Authorization header:

GET https://{EKODB_API_URL}/api/collections
Authorization: Bearer {YOUR_JWT_TOKEN}

Great! You can now use the JWT token to authenticate your requests to the ekoDB API.

Next, you can learn how to use the ekoDB API to manage your data!

If you have any issues, please email support@ekodb.io to create a ticket.