Skip to main content

Authentication

Every request to cmfy.cloud requires an API key. This page explains the key format, how to include it in requests, and security best practices.

API Key Format

cmfy.cloud uses bearer token authentication with prefixed API keys:

sk_live_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk012345
PrefixEnvironmentPurpose
sk_live_ProductionReal jobs, billed to your account
sk_test_SandboxTesting and development (coming soon)

Keys are 51 characters total: an 8-character prefix plus 43 characters of cryptographically random data.

Including Your API Key

Add your key to the Authorization header with the Bearer scheme:

curl https://api.cmfy.cloud/v1/jobs \
-H "Authorization: Bearer sk_live_your_api_key_here"
Never Put Keys in URLs

Don't include API keys in query parameters. URLs are logged by web servers, proxies, and browsers. Always use the Authorization header.

Code Examples

Python

import requests

API_KEY = "sk_live_your_api_key"
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}

response = requests.post(
"https://api.cmfy.cloud/v1/jobs",
headers=HEADERS,
json={"prompt": {...}}
)

JavaScript/TypeScript

const API_KEY = "sk_live_your_api_key";

const response = await fetch("https://api.cmfy.cloud/v1/jobs", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ prompt: {...} })
});

Node.js

const https = require("https");

const options = {
hostname: "api.cmfy.cloud",
path: "/v1/jobs",
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.CMFY_API_KEY}`,
"Content-Type": "application/json"
}
};

const req = https.request(options, (res) => {
// Handle response
});

Managing API Keys

Creating Keys

  1. Log in to the cmfy.cloud portal
  2. Go to API Keys
  3. Click Create New Key
  4. Give it a descriptive name (e.g., "Production Server", "CI/CD Pipeline")
  5. Copy the key immediately - it won't be shown again

Viewing Keys

The portal shows:

  • Key prefix (first 12 characters)
  • Name you assigned
  • Creation date
  • Last used timestamp
  • Current status

You cannot view the full key after creation - only the prefix for identification.

Revoking Keys

If a key is compromised:

  1. Go to API Keys in the portal
  2. Find the key by its prefix or name
  3. Click Revoke
  4. Confirm the action

Revoked keys immediately stop working. Any in-flight requests will fail.

Security Best Practices

Store Keys Securely

Do:

  • Use environment variables
  • Use a secrets manager (AWS Secrets Manager, HashiCorp Vault, etc.)
  • Store in encrypted configuration files

Don't:

  • Commit keys to version control
  • Include in client-side code (browser JavaScript)
  • Share in chat or email
  • Log keys in application logs

Use Environment Variables

# .env file (add to .gitignore)
CMFY_API_KEY=sk_live_your_key_here
import os
api_key = os.environ.get("CMFY_API_KEY")
const apiKey = process.env.CMFY_API_KEY;

Rotate Keys Regularly

Even without a breach, periodic rotation limits exposure:

  1. Create a new key
  2. Update your application to use the new key
  3. Deploy the change
  4. Revoke the old key

Use Separate Keys Per Environment

EnvironmentKey NamePermissions
Developmentdev-localTest key (when available)
Stagingstaging-serverProduction key, limited use
Productionprod-primaryProduction key
CI/CDgithub-actionsProduction key

This makes it easy to identify which system is using which key and revoke specific keys if needed.

Monitor Usage

Check your portal dashboard for:

  • Unusual spikes in requests
  • Requests from unexpected IP addresses
  • Failed authentication attempts

Authentication Errors

HTTP StatusError CodeCauseSolution
401missing_authNo Authorization headerAdd the Authorization: Bearer <key> header
401invalid_auth_formatWrong header formatUse Bearer <key>, not just the key
401invalid_api_keyKey doesn't existCheck for typos, verify key is correct
401revoked_api_keyKey was revokedCreate a new key in the portal
403account_suspendedAccount issueContact support

Example error response:

{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key"
}
}

Rate Limits by Key

Each API key has rate limits based on your account tier:

TierRequests/minConcurrent JobsQueue Depth
Free6025
Pro3001050
Enterprise100050500

Rate limit headers are included in every response:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1699574400

See Rate Limiting for more details.

What's Next?

Was this page helpful?