Getting Started with Crazytel API

A quick start guide covering authentication, technical details and important concepts about the API.

CrazyTel API Authentication Guide

This guide explains how to authenticate your requests to the CrazyTel API. Proper authentication is required for all API endpoints to ensure secure access to your account resources.

Base URL

All API requests should be made to: https://www.crazytel.io/api/

API Key Authentication

All requests to the CrazyTel API must include your API key for authentication. Your API key serves as your account's unique identifier and secure credential.

1. Request Header (Recommended)

Include your API key in the x-crazytel-api-key header:

curl -X GET 'https://www.crazytel.io/api/v1/balance/' \
  -H 'accept: application/json' \
  -H 'x-crazytel-api-key: YOUR_API_KEY'

2. Request Body

Alternatively, you can include your API key in the request body:

{
  "api_key": "YOUR_API_KEY"
}

Response Format

Successful responses will return HTTP 200 with JSON data:

{
  "account_code": "0000000",
  "balance": 2405.4415187741
}

Standard response headers include:

  • content-encoding: gzip
  • content-type: application/json
  • date: Thu,06 Feb 2025 22:51:00 GMT
  • server: nginx

Security Best Practices

To keep your API key secure:

  • Never share your API key: Keep it confidential and never commit it to version control
  • Use environment variables: Store your API key in environment variables rather than hardcoding it
  • Regular rotation: Periodically rotate your API keys, especially if you suspect they may have been compromised
  • Restrict access: Only share API keys with trusted team members who need them
  • Use header method: Prefer using the header method over request body to prevent API keys from appearing in logs

Rate Limiting

API requests are subject to rate limiting based on your account. The current limits are:

  • 60 requests per minute

When you exceed the rate limit, requests will receive a 429 Too Many Requests response.

Error Responses

If authentication fails, you'll receive one of these error responses:

  • 401 Unauthorized: Invalid or missing API key
  • 403 Forbidden: Valid API key but insufficient permissions
  • 429 Too Many Requests: Rate limit exceeded

Example error response:

{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key",
    "status": 401
  }
}

Include your API key in the X-Crazytel-Api-Key header:

X-Crazytel-Api-Key: your_api_key