> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keywordinsights.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Public API: Keyword Content

> Extract People Also Ask, Reddit/Quora questions, and AI-generated meta titles and descriptions via the API

Extract content research data for any keyword — People Also Ask questions, Reddit and Quora discussions, and AI-generated meta titles and descriptions.

> [!NOTE]
>
> Full endpoint reference available on [Swagger](https://api.keywordinsights.ai/apidocs/#/Keyword%20Content).

### Quick Start

Create a keyword content order to extract People Also Ask questions:

```python Python theme={null}
import os
import requests

API_KEY = os.environ["KWI_API_KEY"]
BASE_URL = "https://api.keywordinsights.ai"
HEADERS = {"X-API-Key": API_KEY}

payload = {
    "keyword": "best project management tools",
    "language": "en",
    "location": "United States",
    "content_insights": ["paa"],
}

response = requests.post(
    f"{BASE_URL}/api/keyword-content/order/",
    headers=HEADERS,
    json=payload,
)

data = response.json()
print(data)
# {"status": true, "order_id": "2879fa0b-...", "cost": 50}
```

```javascript JavaScript theme={null}
const API_KEY = process.env.KWI_API_KEY;
const BASE_URL = "https://api.keywordinsights.ai";
const HEADERS = {
  "X-API-Key": API_KEY,
  "Content-Type": "application/json"
};

const payload = {
  keyword: "best project management tools",
  language: "en",
  location: "United States",
  content_insights: ["paa"],
};

async function createOrder() {
  const response = await fetch(`${BASE_URL}/api/keyword-content/order/`, {
    method: "POST",
    headers: HEADERS,
    body: JSON.stringify(payload),
  });

  const data = await response.json();
  console.log(data);
  // {"status": true, "order_id": "2879fa0b-...", "cost": 50}
}

createOrder();
```

### Endpoints

| Method | Path | Description |
| - | - | - |
| POST | `/api/keyword-content/order/` | Create a keyword content order |
| GET | `/api/keyword-content/order/?order_id={id}` | Get order status and results |

### Parameters

#### Required

| Parameter | Type | Description |
| - | - | - |
| `keyword` | string | Target keyword to research |
| `language` | string | Language code (e.g. `en`). See `/api/content-brief/languages/` |
| `location` | string | Location name (e.g. `United States`). See `/api/keywords-insights/locations/` |
| `content_insights` | string\[] | Types of content insights to extract (see below) |

#### Optional

| Parameter | Type | Default | Description |
| - | - | - | - |
| `device` | string | `desktop` | `desktop` or `mobile` |

### Content Insight Types

The `content_insights` array controls which data is extracted. You can combine multiple types in a single order:

| Insight | Description | Cost |
| - | - | - |
| `paa` | People Also Ask questions from Google SERP | 50 credits |
| `reddit_questions` | Related Reddit discussions and questions | 50 credits |
| `quora_questions` | Related Quora questions | 50 credits |
| `meta_titles` | AI-generated meta title suggestions | 200 credits |
| `meta_descriptions` | AI-generated meta description suggestions | 200 credits |

Total cost = sum of selected insights.

### Customizations

#### All Content Insights

Extract everything in a single order:

```python Python theme={null}
payload = {
    "keyword": "email marketing automation",
    "language": "en",
    "location": "United States",
    "content_insights": [
        "paa",
        "reddit_questions",
        "quora_questions",
        "meta_titles",
        "meta_descriptions",
    ],
}
# Cost: 50 + 50 + 50 + 200 + 200 = 550 credits
```

```javascript JavaScript theme={null}
const payload = {
  keyword: "email marketing automation",
  language: "en",
  location: "United States",
  content_insights: [
    "paa",
    "reddit_questions",
    "quora_questions",
    "meta_titles",
    "meta_descriptions",
  ],
};
// Cost: 50 + 50 + 50 + 200 + 200 = 550 credits
```

#### Questions Only

Get user questions from multiple platforms at a lower cost:

```python Python theme={null}
payload = {
    "keyword": "best CRM software",
    "language": "en",
    "location": "United States",
    "content_insights": ["paa", "reddit_questions", "quora_questions"],
}
# Cost: 50 + 50 + 50 = 150 credits
```

```javascript JavaScript theme={null}
const payload = {
  keyword: "best CRM software",
  language: "en",
  location: "United States",
  content_insights: ["paa", "reddit_questions", "quora_questions"],
};
// Cost: 50 + 50 + 50 = 150 credits
```

### Retrieving Results

Poll until the order status is `"done"`:

```python Python theme={null}
import os
import time
import requests

API_KEY = os.environ["KWI_API_KEY"]
BASE_URL = "https://api.keywordinsights.ai"
HEADERS = {"X-API-Key": API_KEY}

order_id = "2879fa0b-deae-4aab-ad87-fd8fb8db9717"

while True:
    response = requests.get(
        f"{BASE_URL}/api/keyword-content/order/",
        headers=HEADERS,
        params={"order_id": order_id},
    )

    data = response.json()["result"]["payload"]

    if data["status"] == "done":
        break

    print("Processing...")
    time.sleep(10)

results = data["results"]

# People Also Ask
if "paa" in results:
    print("People Also Ask:")
    for q in results["paa"]:
        print(f"  - {q}")

# Reddit questions
if "reddit_questions" in results:
    print("\nReddit questions:")
    for q in results["reddit_questions"]:
        print(f"  - {q}")

# AI meta titles
if "meta_titles" in results:
    print("\nSuggested meta titles:")
    for title in results["meta_titles"]:
        print(f"  - {title}")
```

```javascript JavaScript theme={null}
const API_KEY = process.env.KWI_API_KEY;
const BASE_URL = "https://api.keywordinsights.ai";
const HEADERS = { "X-API-Key": API_KEY };

const order_id = "2879fa0b-deae-4aab-ad87-fd8fb8db9717";

async function getResults() {
  let data;
  while (true) {
    const url = new URL(`${BASE_URL}/api/keyword-content/order/`);
    url.searchParams.append("order_id", order_id);

    const response = await fetch(url, {
      headers: HEADERS,
    });

    const json = await response.json();
    data = json.result.payload;

    if (data.status === "done") {
      break;
    }

    console.log("Processing...");
    await new Promise((r) => setTimeout(r, 10000));
  }

  const results = data.results;

  // People Also Ask
  if (results.paa) {
    console.log("People Also Ask:");
    for (const q of results.paa) {
      console.log(`  - ${q}`);
    }
  }

  // Reddit questions
  if (results.reddit_questions) {
    console.log("\nReddit questions:");
    for (const q of results.reddit_questions) {
      console.log(`  - ${q}`);
    }
  }

  // AI meta titles
  if (results.meta_titles) {
    console.log("\nSuggested meta titles:");
    for (const title of results.meta_titles) {
      console.log(`  - ${title}`);
    }
  }
}

getResults();
```

The results include download links for CSV exports:

```python Python theme={null}
# Download CSV files
files = results.get("files", {}).get("csv", {})
for insight_type, download_url in files.items():
    print(f"{insight_type}: {download_url}")
```

```javascript JavaScript theme={null}
// Download CSV files
const files = results.files?.csv || {};
for (const [insight_type, download_url] of Object.entries(files)) {
  console.log(`${insight_type}: ${download_url}`);
}
```

### Complete Example

Extract People Also Ask and Reddit questions, then save results to a file:

```python Python theme={null}
import os
import time
import json
import requests

API_KEY = os.environ["KWI_API_KEY"]
BASE_URL = "https://api.keywordinsights.ai"
HEADERS = {"X-API-Key": API_KEY}


def create_content_order(keyword, insights, language="en", location="United States"):
    """Create a keyword content order."""
    response = requests.post(
        f"{BASE_URL}/api/keyword-content/order/",
        headers=HEADERS,
        json={
            "keyword": keyword,
            "language": language,
            "location": location,
            "content_insights": insights,
        },
    )
    response.raise_for_status()
    return response.json()


def wait_for_results(order_id):
    """Poll until results are ready."""
    while True:
        response = requests.get(
            f"{BASE_URL}/api/keyword-content/order/",
            headers=HEADERS,
            params={"order_id": order_id},
        )
        data = response.json()["result"]["payload"]

        if data["status"] == "done":
            return data["results"]

        print("Processing...")
        time.sleep(10)


# --- Run ---

result = create_content_order(
    keyword="best project management tools",
    insights=["paa", "reddit_questions"],
)
order_id = result["order_id"]
print(f"Order created: {order_id} (cost: {result['cost']} credits)")

results = wait_for_results(order_id)

# Save to file
with open("content_research.json", "w") as f:
    json.dump(results, f, indent=2)

paa_count = len(results.get("paa", []))
reddit_count = len(results.get("reddit_questions", []))
print(f"Saved {paa_count} PAA questions and {reddit_count} Reddit questions")
```

```javascript JavaScript theme={null}
const fs = require("fs");
const API_KEY = process.env.KWI_API_KEY;
const BASE_URL = "https://api.keywordinsights.ai";
const HEADERS = {
  "X-API-Key": API_KEY,
  "Content-Type": "application/json"
};

async function createContentOrder(keyword, insights, language = "en", location = "United States") {
  const response = await fetch(`${BASE_URL}/api/keyword-content/order/`, {
    method: "POST",
    headers: HEADERS,
    body: JSON.stringify({
      keyword,
      language,
      location,
      content_insights: insights,
    }),
  });

  if (!response.ok) {
    throw new Error(`HTTP error! status: ${response.status}`);
  }

  return await response.json();
}

async function waitForResults(order_id) {
  while (true) {
    const url = new URL(`${BASE_URL}/api/keyword-content/order/`);
    url.searchParams.append("order_id", order_id);

    const response = await fetch(url, {
      headers: HEADERS,
    });

    const json = await response.json();
    const data = json.result.payload;

    if (data.status === "done") {
      return data.results;
    }

    console.log("Processing...");
    await new Promise((r) => setTimeout(r, 10000));
  }
}

// --- Run ---

async function run() {
  const result = await createContentOrder(
    "best project management tools",
    ["paa", "reddit_questions"]
  );
  const order_id = result.order_id;
  console.log(`Order created: ${order_id} (cost: ${result.cost} credits)`);

  const results = await waitForResults(order_id);

  // Save to file
  fs.writeFileSync("content_research.json", JSON.stringify(results, null, 2));

  const paa_count = (results.paa || []).length;
  const reddit_count = (results.reddit_questions || []).length;
  console.log(`Saved ${paa_count} PAA questions and ${reddit_count} Reddit questions`);
}

run();
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.