Where API Keys Are Stored
API keys are stored in the PostgreSQL database in theusers table with the following columns:
api_key- The actual API key (64 character hex string)api_key_created_at- When the key was generatedapi_key_last_used_at- When the key was last used for authentication
Methods to Find API Keys
Method 1: Via API Endpoint (Recommended)
If you already have an API key, retrieve it:Method 2: Query Database Directly
Connect to your PostgreSQL database and query:Method 3: Via Railway Dashboard
- Go to your Railway PostgreSQL service
- Click on “Query” tab
- Run the SQL query above
- Copy the API keys from the results
Method 4: Check Bulk Generation Output
If you used the bulk generation script, check the output file:Method 5: Generate New API Key
If a user doesn’t have an API key, generate one:Security Notes
⚠️ Important:- API keys are shown only once when generated
- Store them securely immediately
- Never commit API keys to version control
- Use secure channels (password managers, encrypted email) to share keys
- Delete bulk generation JSON files after distributing keys
Finding Keys for Multiple Users
Get All API Keys for a Tenant
Export to CSV
Troubleshooting
User has no API key
If the query returns no results or NULL:- Generate a new API key using Method 5 above
- The key will be shown once in the response
Can’t access database
If you can’t access the database directly:- Use the API endpoint (Method 1) if you have an existing key
- Contact your database administrator
- Use Railway dashboard SQL editor
Forgot your API key
If you’ve lost your API key:- Regenerate it (old key will stop working):
- Or query the database if you have access
- Or generate via script if you have database access
