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

https://www.craftmyletter.com/api/v1

POST /api/v1/generate

Generate a professional letter. Returns the full letter content as a JSON response (non-streaming).

Request Body

FieldTypeRequiredDescription
letterTypestringYesLetter type ID (e.g. "cover-letter", "resignation")
formDataobjectYesKey-value pairs of form fields for the letter type
tonestringYesTone of the letter (e.g. "Professional", "Friendly")
languagestringNoLanguage code. Defaults to "en". Supported: en, ar, hi, ur, tl

Example Request

curl -X POST https://www.craftmyletter.com/api/v1/generate \ -H "Content-Type: application/json" \ -H "X-API-Key: lc_live_your_api_key_here" \ -d '{ "letterType": "cover-letter", "formData": { "recipientName": "Jane Smith", "companyName": "Acme Corp", "position": "Software Engineer", "experience": "5 years in full-stack development", "skills": "React, Node.js, TypeScript", "motivation": "Passionate about building great products" }, "tone": "Professional", "language": "en" }'

Success Response (200)

{ "success": true, "letter": { "type": "cover-letter", "tone": "Professional", "language": "en", "content": "March 30, 2026\n\nDear Jane Smith,\n\nI am writing to express..." }, "creditsRemaining": 24 }

Error Response

{ "success": false, "error": "Insufficient credits. Purchase more credits at /pricing." }

Status Codes

CodeDescription
200Letter generated successfully
400Invalid request (bad letter type, missing fields, invalid tone)
401Missing or invalid API key
402Insufficient credits
429Rate limit exceeded
500Server 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

View all pricing options

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

curl https://www.craftmyletter.com/api/keys \ -H "Authorization: Bearer YOUR_FIREBASE_TOKEN"

POST /api/keys — Create a new API key

curl -X POST https://www.craftmyletter.com/api/keys \ -H "Authorization: Bearer YOUR_FIREBASE_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "My App" }'

Returns the full API key once. Maximum 5 active keys per account.

DELETE /api/keys/:keyId — Revoke an API key

curl -X DELETE https://www.craftmyletter.com/api/keys/KEY_ID \ -H "Authorization: Bearer YOUR_FIREBASE_TOKEN"

Getting Started

  1. Purchase credits if you haven't already.
  2. Create an API key using the POST /api/keys endpoint.
  3. Send a POST /api/v1/generate request with your API key and letter details.
  4. Parse the JSON response and use the generated letter content in your application.