Generate Lead Magnet

POST

Create a personalized lead magnet for a prospect

Endpoint

POST https://magnetite.ai/api/projects/{projectId}/generate

Request Body

Send a JSON object with the following fields:

Required Fields

FieldTypeDescription
emailstringLead's email address (required)

Dynamic Fields

The available fields are determined by your project's schema configuration. Use the GET endpoint to retrieve the current schema before sending data.

Common FieldsTypeDescription
fullNamestringProspect's full name
companystringCompany name
domainstringCompany domain (e.g., example.com)
industrystringIndustry or sector
companySizestringCompany size (e.g., "1-10", "11-50")
titlestringJob title
phonestringPhone number
customFieldsstring (JSON)Additional custom data as JSON string

Note: Field requirements are dynamic and based on your project configuration. Use GET /api/projects/{projectId}/generate to retrieve the current schema and required fields.

Example Request

curl -X POST https://magnetite.ai/api/projects/abc123def456ghi789jkl012mno345pq/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "jane.doe@techcorp.com",
    "fullName": "Jane Doe",
    "company": "TechCorp Inc",
    "domain": "techcorp.com",
    "title": "VP of Sales",
    "industry": "SaaS",
    "companySize": "51-200",
    "customFields": {
      "budget": "100000", 
      "timeline": "Q2"
    }
  }'

Success Response

Returns a 200 OK status with:

{
  "success": true,
  "leadId": "lead_xyz789abc123",
  "leadMagnetUrl": "https://acme-corp.go.magnetite.ai/lead_xyz789abc123",
  "jobId": "job_def456ghi789",
  "status": "queued",
  "message": "Lead magnet generation started successfully"
}

leadId: Unique identifier for this lead

leadMagnetUrl: The URL where the lead magnet will be available once generated

jobId: Use this to check the generation status

status: Initial status is always "queued"

Error Responses

400 Bad Request

Missing or invalid parameters

{
  "error": "Missing required fields",
  "missingFields": ["email"]
}

401 Unauthorized

Invalid or missing API key

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

402 Payment Required

Insufficient credits

{
  "error": "Insufficient credits for lead generation"
}

403 Forbidden

Access denied to project

{
  "error": "API key does not have access to this project"
}

429 Too Many Requests

Rate limit exceeded (includes rate limit headers)

HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1642176000
Content-Type: application/json

{
  "error": "Rate limit exceeded. Try again later.",
  "retryAfter": 60
}

Next Steps

Learn how to check the status of your lead magnet generation.

Check Generation Status →