API Documentation

Integrate WriterAI's content generation into your own applications.

Authentication

To use the WriterAI API, you must include your personal API key in each request. You can generate and find your API key on your profile page.

The API key must be sent in the Authorization header using the Bearer schema.

Authorization: Bearer <YOUR_API_KEY>

Generate Content Endpoint

This endpoint allows you to generate academic drafts based on a topic and key points.

POST /api/v1/generate.php

Request Body

The request body must be a JSON object with the following parameters:

  • topic (string, required): The main topic or title of the document.
  • key_points (string, required): A comma-separated list of key points or keywords to include.
  • tone (string, optional): The desired tone of the output (e.g., "Academic", "Formal"). Defaults to "Academic".
{ "topic": "The Impact of Renewable Energy in Rural Nigeria", "key_points": "solar power, economic benefits, challenges, government policy", "tone": "Analytical" }

Example Request (cURL)

Here is an example of how to call the API using cURL from your terminal.

# Replace YOUR_API_KEY with your actual key curl --location --request POST 'https://writerai.example.com/api/v1/generate.php' \ --header 'Authorization: Bearer <YOUR_API_KEY>' \ --header 'Content-Type: application/json' \ --data-raw '{ "topic": "The Impact of Renewable Energy in Rural Nigeria", "key_points": "solar power, economic benefits, challenges, government policy" }'

Success Response (200 OK)

A successful request will return a JSON object containing the generated text.

{ "success": true, "generated_text": "The integration of renewable energy, particularly solar power, in rural Nigeria presents a significant opportunity for economic growth. The primary benefits include..." }