clusterify.ai

Generate SEO-Friendly Title API Documentation

Why Use This API?

This API allows blog and e-commerce site owners to generate SEO-optimized titles based on provided keywords and a subject. Well-crafted titles can significantly improve search engine rankings, increase click-through rates (CTR), and enhance visibility, thereby driving more organic traffic and potential customers to your site.

Technical Details

The API is located at https://clusterify.ai/api/generate-title and accepts a POST request.

Request Parameters

ParameterTypeRequiredDescription
keywordsstringYesThe primary keywords for optimizing the titles (10-50 characters).
subjectstringYesA brief description of the subject (5-50 characters).

Response

The API returns a JSON array with SEO-optimized titles, sorted by SEO score (highest to lowest). It is advisable to select the first title, which has the best SEO score.

[
  { "title": "example title 1", "score": 10, "explanation": "Explanation for title 1." },
  { "title": "example title 2", "score": 9, "explanation": "Explanation for title 2." },
  { "title": "example title 3", "score": 8, "explanation": "Explanation for title 3." },
  { "title": "example title 4", "score": 8, "explanation": "Explanation for title 4." },
  { "title": "example title 5", "score": 6, "explanation": "Explanation for title 5." }
]

Authentication

You need a JWT token to authenticate. Use the login API to get your token. Here’s an example with CURL:

curl -X POST https://clusterify.ai/api/login \
  -H "Content-Type: application/json" \
  -d '{"public_key": "your_public_key", "secret_key": "your_secret_key"}'

This call returns a JWT token to use for authentication in the API request.

Example API Call Using CURL

curl -X POST https://clusterify.ai/api/generate-title \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your_token" \
  -d '{
    "keywords": "organic cotton shirts",
    "subject": "the best eco-friendly shirts"
}'

Example API Call Using Python

import requests

url = "https://clusterify.ai/api/generate-title"
headers = {
    "Authorization": "Bearer your_token",
    "Content-Type": "application/json"
}
data = {
    "keywords": "organic cotton shirts",
    "subject": "the best eco-friendly shirts"
}

response = requests.post(url, json=data, headers=headers)
print(response.json())

Example API Call Using Next.js (Fetch)

async function generateTitles() {
  const res = await fetch('https://clusterify.ai/api/generate-title', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer your_token',
    },
    body: JSON.stringify({
      keywords: 'organic cotton shirts',
      subject: 'the best eco-friendly shirts'
    }),
  });

  const data = await res.json();
  console.log(data);
}

Example API Call Using PHP

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://clusterify.ai/api/generate-title");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Authorization: Bearer your_token",
    "Content-Type: application/json"
));
$data = json_encode([
    "keywords" => "organic cotton shirts",
    "subject" => "the best eco-friendly shirts"
]);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>

© 2024, Clusterify.ai All Rights Reserved.