Documentation Index
Fetch the complete documentation index at: https://mintlify.com/artistatbl/Mantlz/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Mantlz API uses API keys to authenticate requests. API keys are unique identifiers linked to your user account and provide secure access to your forms and data.API Key Format
API keys follow this format:mk_live_abc123xyz456def789
Creating an API Key
To create an API key:- Log in to your Mantlz dashboard
- Navigate to Settings > API Keys
- Click Create New API Key
- Give your key a descriptive name (e.g., “Production Website”, “Mobile App”)
- Copy the key immediately - it won’t be shown again
Authentication Methods
The API supports two authentication methods. Both are equally secure, but the header method is recommended.Method 1: X-API-Key Header (Recommended)
Pass your API key in theX-API-Key header:
Method 2: Authorization Bearer Token
Alternatively, use theAuthorization header with a Bearer token:
The Authorization header is particularly useful when integrating with tools that expect OAuth-style authentication.
Method 3: Query Parameter (Legacy)
For backward compatibility, you can pass the API key as a query parameter:API Key Validation
When you make an API request, the system performs these checks:- Existence - Validates the API key exists in the database
- Active Status - Ensures the key is active (not revoked)
- User Association - Verifies the associated user account is valid
- Last Used Update - Updates the
lastUsedAttimestamp for tracking
Validation Flow
API Key Database Schema
API keys are stored with the following structure (fromprisma/schema.prisma:192):
Response Codes
Successful Authentication
When authentication succeeds, you’ll receive a200 status code with your requested data:
Authentication Failures
Missing API Key
401 Unauthorized
Invalid or Inactive API Key
401 Unauthorized
User Not Found
404 Not Found
Managing API Keys
Viewing Your API Keys
You can view all your API keys in the dashboard, including:- Key name
- Created date
- Last used timestamp
- Active status
For security reasons, the full API key is only displayed once when created. You’ll see a truncated version (e.g.,
mk_live_abc...789) in the dashboard.Revoking API Keys
To revoke an API key:- Go to Settings > API Keys
- Find the key you want to revoke
- Click Revoke or toggle the active status
- Confirm the action
Rotating API Keys
For security best practices, rotate your API keys periodically:- Create a new API key
- Update your application to use the new key
- Test that everything works correctly
- Revoke the old key
Security Best Practices
Environment Variables
Store API keys in environment variables, never in code:Server-Side Only
API keys should only be used in server-side code:Separate Keys for Different Environments
Use different API keys for development, staging, and production:Monitor Usage
Regularly check the “Last Used” timestamp in your dashboard to detect:- Unused keys (candidates for revocation)
- Unexpected usage patterns
- Potentially compromised keys
Rate Limiting by API Key
Rate limits are applied per API key to ensure fair usage:Troubleshooting
”API key is required” Error
Cause: No API key was provided in the request. Solution: Add theX-API-Key header or Authorization header to your request.
”Invalid or inactive API key” Error
Cause: The API key doesn’t exist, was revoked, or is inactive. Solutions:- Verify you’re using the correct API key
- Check if the key was revoked in the dashboard
- Create a new API key if needed
”User not found” Error
Cause: The user associated with the API key no longer exists. Solution: Contact support - this typically indicates a data integrity issue.Authentication Works But Request Fails
Cause: The API key is valid, but you don’t have access to the requested resource. Example:Example Implementation
Here’s a complete example of implementing API key authentication in a Node.js application:Next Steps
Submit Forms
Learn how to submit form data
Retrieve Submissions
Fetch and filter form submissions
View Analytics
View form analytics and metrics
Forms API
List and manage your forms