Writesonic empowers businesses and creators with a robust suite of AI-powered writing tools accessible through their API. Their user-friendly API grants programmatic access to a variety of content generation and editing features, helping you automate content creation workflows and save valuable time.

Authentication:

Writesonic utilizes API keys for authentication. You can obtain your free API key by creating an account on the Writesonic platform. Upgraded plans offer increased usage limits and additional features.

Here's a breakdown of some key Writesonic Text API endpoints along with JavaScript example code snippets for each:

1. Article Writing (Write Article)

  • This endpoint generates long-form content like blog posts or articles based on your input.
  • Type: POST
  • JavaScript Example:
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.writesonic.com/v1/longform/write-article';

const data = {
    title: 'Top 5 Benefits of AI in Content Creation',
    keywords: ['AI content creation', 'benefits', 'automation'],
    language: 'en', // Change language code as needed
};

const headers = {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
};

fetch(url, { method: 'POST', headers, body: JSON.stringify(data) })
    .then((response) => response.json())
    .then((data) => {
        console.log('Generated Article Intro:', data.content.intro);
    })
    .catch((error) => console.error(error));

2. Blog Post Intro Writing (Write Blog Intro)

  • This endpoint generates introductions for your blog posts based on a provided title.
  • Type: POST
  • JavaScript Example:
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.writesonic.com/v1/shortform/write-blog-intro';

const data = {
    title: 'The Future of Content Marketing',
    language: 'en', // Change language code as needed
};

const headers = {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
};

fetch(url, { method: 'POST', headers, body: JSON.stringify(data) })
    .then((response) => response.json())
    .then((data) => {
        console.log('Generated Blog Intro:', data.content);
    })
    .catch((error) => console.error(error));

3. Product Description Writing (Write Description)

  • This endpoint generates product descriptions that highlight key features and benefits.
  • Type: POST
  • JavaScript Example:
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.writesonic.com/v1/shortform/write-description';

const data = {
    product_name: 'Smartwatch',
    features: ['Fitness tracking', 'Touchscreen display', 'Water-resistant'],
    language: 'en', // Change language code as needed
};

const headers = {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
};

fetch(url, { method: 'POST', headers, body: JSON.stringify(data) })
    .then((response) => response.json())
    .then((data) => {
        console.log('Generated Product Description:', data.content);
    })
    .catch((error) => console.error(error));

4. Content Summarization (Summarize)

  • This endpoint summarizes factual content into a concise and informative format.
  • Type: POST
  • JavaScript Example:
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.writesonic.com/v1/longform/summarize';

const data = {
    text: 'The quick brown fox jumps over the lazy dog. The rain in Spain falls mainly on the plain.',
};

const headers = {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
};

fetch(url, { method: 'POST', headers, body: JSON.stringify(data) })
    .then((response) => response.json())
    .then((data) => {
        console.log('Content Summary:', data.content.summary);
    })
    .catch((error) => console.error(error));

Explore More with Writesonic

Writesonic's API offers a variety of functionalities beyond what's covered here, including social media copywriting, website content generation, and even creative writing formats like poems or scripts. Explore their comprehensive documentation to discover the full potential of Writesonic's API and unleash the power of AI-driven content creation within your applications. Remember, the free tier has limitations, so consider upgrading for extended use and advanced features.