Developer API
Generate professional letters programmatically. Integrate CraftMyLetter AI into your application with a simple REST API.
Authentication
All API requests require an API key. Create one from your account dashboard or via the API key management endpoints. Include your key in every request using one of these headers:
X-API-Key: lc_live_your_api_key_here
— or —
Authorization: Bearer lc_live_your_api_key_here
Your full API key is shown only once when created. Store it securely.
Base URL
POST /api/v1/generate
Generate a professional letter. Returns the full letter content as a JSON response (non-streaming).
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| letterType | string | Yes | Letter type ID (e.g. "cover-letter", "resignation") |
| formData | object | Yes | Key-value pairs of form fields for the letter type |
| tone | string | Yes | Tone of the letter (e.g. "Professional", "Friendly") |
| language | string | No | Language code. Defaults to "en". Supported: en, ar, hi, ur, tl |
Example Request
Success Response (200)
Error Response
Status Codes
| Code | Description |
|---|---|
| 200 | Letter generated successfully |
| 400 | Invalid request (bad letter type, missing fields, invalid tone) |
| 401 | Missing or invalid API key |
| 402 | Insufficient credits |
| 429 | Rate limit exceeded |
| 500 | Server error |
Rate Limits
Each API key is limited to 10 requests per minute. If you exceed this limit, you will receive a 429 response. Wait briefly and retry.
Pricing
Each API request costs 1 credit. Credits are the same ones used in the web app. Purchase credit packs to get started:
- Starter — 10 credits for $4.99
- Plus — 25 credits for $9.99
- Pro — 50 credits for $17.99
API Key Management
Manage your API keys programmatically. These endpoints require Firebase authentication (Bearer token), not an API key.
GET /api/keys — List your API keys
POST /api/keys — Create a new API key
Returns the full API key once. Maximum 5 active keys per account.
DELETE /api/keys/:keyId — Revoke an API key
Getting Started
- Purchase credits if you haven't already.
- Create an API key using the POST /api/keys endpoint.
- Send a POST /api/v1/generate request with your API key and letter details.
- Parse the JSON response and use the generated letter content in your application.