Authentication & Credits

CallMeLater uses API key authentication combined with a credit-based usage system to provide secure and predictable access to the scheduling service.

API Key Authentication

All requests to the CallMeLater API must include your API key in the request headers.

Getting Your API Key

  1. Sign up for a CallMeLater account
  2. Navigate to your dashboard
  3. Go to the “API Keys” section
  4. Click “Create New API Key”
  5. Give your key a descriptive name
  6. Copy and securely store the generated key
API keys are only shown once during creation. Make sure to copy and store them securely.

Using Your API Key

Include your API key in the x-api-key header for all requests:
curl -H "x-api-key: your_api_key_here" \
  https://api.callmelater.xyz/stats/remaining-credits
const response = await fetch("https://api.callmelater.xyz/schedule", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "your_api_key_here",
  },
  body: JSON.stringify({
    // ... request data
  }),
});

Credit System

CallMeLater operates on a credit-based system where each scheduled request consumes credits from your account.

How Credits Work

  • 1 Credit = 1 Scheduled Request: Each successfully scheduled HTTP request consumes one credit
  • Immediate Deduction: Credits are deducted when you schedule a request, not when it executes
  • Refund on Cancellation: If you cancel a scheduled request before it executes, the credit is refunded
  • No Charge for Failures: If scheduling fails (invalid request, etc.), no credits are consumed

Checking Your Credit Balance

curl -H "x-api-key: your_api_key_here" \
  https://api.callmelater.xyz/stats/remaining-credits
Response:
{
  "creditsRemaining": 150
}

Credit Consumption Examples

ActionCredits UsedNotes
Schedule a POST request1Standard consumption
Schedule a GET request1Same cost regardless of method
Cancel a scheduled request0 (refund +1)Credit returned to account
Failed scheduling (invalid URL)0No charge for failed requests
Request execution fails0No additional charge if target fails

API Key Management

Security Best Practices

Environment Variables

Store API keys in environment variables, never in your source code

Rotate Regularly

Create new API keys periodically and deactivate old ones

Scope Access

Use different API keys for different environments (dev, staging, prod)

Monitor Usage

Regularly check your credit usage and API key activity

Key Lifecycle

  1. Creation: Generate a new API key with a descriptive name
  2. Active Use: Use the key for API requests
  3. Monitoring: Track usage and credit consumption
  4. Rotation: Create new keys and update your applications
  5. Deactivation: Disable old keys when no longer needed

Environment Setup

# .env file
CALLMELATER_API_KEY=your_api_key_here
CALLMELATER_BASE_URL=https://api.callmelater.xyz
// Using environment variables
const apiKey = process.env.CALLMELATER_API_KEY;
const baseUrl = process.env.CALLMELATER_BASE_URL;

const scheduleRequest = async (requestData) => {
  const response = await fetch(`${baseUrl}/schedule`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": apiKey,
    },
    body: JSON.stringify(requestData),
  });

  return response.json();
};

Error Handling

Authentication Errors

Status CodeErrorDescription
401Invalid API keyThe provided API key is invalid or inactive
401Missing API keyNo API key was provided in the request
402Insufficient creditsYour account doesn’t have enough credits

Example Error Response

{
  "error": "Invalid or inactive API key"
}

Handling Errors in Code

try {
  const response = await fetch("https://api.callmelater.xyz/schedule", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": apiKey,
    },
    body: JSON.stringify(requestData),
  });

  if (!response.ok) {
    const error = await response.json();

    switch (response.status) {
      case 401:
        console.error("Authentication failed:", error.error);
        // Handle invalid API key
        break;
      case 402:
        console.error("Insufficient credits:", error.error);
        // Handle low credits
        break;
      default:
        console.error("Request failed:", error.error);
    }
    return;
  }

  const result = await response.json();
  console.log("Request scheduled:", result.scheduleId);
} catch (error) {
  console.error("Network error:", error);
}