SemanticPen API Documentation

Article Generation API

Our API allows you to generate high-quality articles programmatically, perfect for integrating with custom CMS, performing bulk article generation, or creating your own user interface.

All paid plans can use our API without additional costs. The usage will be the same as using the article generation feature from our website.

Key Features:

  • Asynchronous article generation
  • Multiple article modes including Pro Mode, Quick Mode, URL to Article, Bulk Writer, Amazon Product Reviews, and YouTube to Article
  • Customizable parameters for tone, language, SEO optimization, and more
  • Optional automatic integration to WordPress, Wix, Webflow, Webhook like Pabbly Connect, Zapier, Integromat, Make, Bubble, Landbot, Integromat, Flowmattic etc.

To use the API, you need an active, paid subscription. Visit your Account page to generate an API key once you have an active plan.

Endpoints

Article Generation

POST https://www.semanticpen.com/api/articles

Creates and manages article generation jobs. Supports bulk operations and returns article IDs.

Article Retrieval

GET https://www.semanticpen.com/api/articles/{articleId}

Retrieves a specific article by ID with full content and metadata.

Authentication

API requests must be authenticated using a Bearer token in the Authorization header.

You can find your API key on your Account page.

You need to have an active paid plan to use the API. If you are not registered yet, you can register here.

Then go to your Account page inside the settings section to generate an API key.

Do note that the API key is only shown once and cannot be retrieved later from the API, so make sure you save it.

API key will look something like this:

b0cf9c2f-60ad-8ujd-87eb-bd8nm042e092

To authenticate your request, you need to pass the API key in the Authorization header like this in every request:

Authorization: Bearer YOUR_API_KEY

Semantic Pen Article generation API works with a number of articles. We don't charge anything extra for the word count.

Request Body

The request body should be a JSON object containing the following properties:

ParameterTypeRequiredDescription
targetKeywordarrayYesArray of keywords or topics for the article. For single keyword, use string format.
projectNamestringNoHuman-readable name for the project containing multiple articles.
personalisationNamestringNoName of the personalization profile to use for internal linking and content customization.
articleTypestringNoType of article for specialized processing (e.g., "review", "how-to", "listicle").
articleModestringNoThe mode of article generation (e.g., "Bulk Writer", "Pro Mode", "Quick Mode"). Default is "Bulk Writer".
targetArticleTopicstringNoAdditional context for the article topic.
languagestringNoThe language for the article. Default is "english".
countrystringNoThe target country for the article.
toneOfVoicestringNoThe desired tone of voice for the article. Default is "professional".
pointOfViewstringNoThe point of view to use in the article. Default is "firstPersonSingular".
includeTableOfContentbooleanNoWhether to include a table of contents.
includeFAQSectionbooleanNoWhether to include an FAQ section.
includeKeyTakeawaysbooleanNoWhether to include key takeaways.
disableConclusionbooleanNoWhether to disable the conclusion.
disableIntroductionbooleanNoWhether to disable the introduction.
aiSeoOptimzationbooleanNoWhether to apply AI-based SEO optimization.
customWritingStylestringNoCustom writing style instructions.
extraTitlePromptstringNoAdditional prompt for title generation.
backgroundContextEntitiesstringNoAdditional context or entities for the article.
customLinksarrayNoCustom links to include in the article.
customCTAHeadingstringNoCustom call-to-action heading.
customCTALinkstringNoCustom call-to-action link.
customCTAInstructionstringNoInstructions for the custom call-to-action.
customOutlinearrayNoCustom outline for the article structure.
extraSectionPromptstringNoAdditional prompt for section generation.
amazonProductURLstringConditionalRequired for "Amazon Product Review Articles" mode. URL of the Amazon product.
amazonAffiliateTagstringNoAmazon affiliate tag for product review articles.
youtubeVideoURLstringConditionalRequired for "Youtube to Article" mode. URL of the YouTube video.
gptVersionstringNoThe GPT model version to use.
maximumExternalLinksnumberNoMaximum number of external links to include.
maximumInternalLinksnumberNoMaximum number of internal links to include.
includeInternalLinksbooleanNoWhether to include internal links.
includeExternalLinksbooleanNoWhether to include external links.
readabilityControllerstringNoControls the readability level of the generated content.
sectionLengthstringNoDesired length for each section (e.g., "200" or "400" words).
mediaPreferencestringNoMedia preference for articles: "None", "Auto", "Images", "Videos". Default is "None".
maxImagesnumberNoMaximum number of images to include in the article.
maxVideosnumberNoMaximum number of videos to include in the article.
imageStylestringNoStyle for generated images: "digital-art", "photographic", "fantasy-art", "isometric", "3d-model", "anime", "neon-punk".
imageSizestringNoSize for generated images: "1024x1024", "1152x896", "1216x832", "1344x768", "1536x640", etc.
imageProviderstringNoImage provider service: "stock-pixabay", "stable-diffusion-v3".
integrationDataobjectNoIntegration settings for publishing to WordPress/Wix. Contains integrationType, websiteID, categoryName, tagNames, authorName, postStatus, publishImmediately, scheduling options.
selectedKnowledgeBaseobjectNoKnowledge base selection for enhanced content generation.
brandVoicestringNoBrand voice guidelines for consistent content tone and style.
targetAudiencestringNoTarget audience description for content personalization.
numberofOutlinestringNoNumber of main headings (sections) in the article. Accepts string values from "2" to "10" (or up to "15" if supported). Controls article length.

Parameter Values

Here are the possible values for some of the parameters:

ParameterPossible Values
articleMode"Quick Mode", "Pro Mode", "URL to Article", "Youtube to Article", "Amazon Product Review Articles", "Bulk Writer"
languageISO 639-1 language codes (e.g., "en" for English, "es" for Spanish, etc.). Full list available in the LanguageData array.
countryCountry names (e.g., "United States", "United Kingdom", etc.). Full list available in the LanguageData array.
toneOfVoice"Professional", "Casual", "Friendly", "Authoritative", "Humorous", "Formal", "Inspirational", "Empathetic", "Neutral", "Confident", "Conversational", etc. Custom tones can also be specified.
pointOfView"firstPersonSingular", "firstPersonPlural", "secondPerson", "thirdPerson"
gptVersion"gpt-4o-mini", "gpt-3.5-turbo-0125", "gpt-4o", "openai/gpt-4o-mini", "openai/gpt-4o", "anthropic/claude-3.5-sonnet", "anthropic/claude-3-sonnet", "google/gemini-flash-1.5", "google/gemini-pro-1.5", "google/gemini-pro"
readabilityController"very_easy", "easy", "medium", "hard", "expert", "advanced", "professional"
introStyle"zero_search_result", "engagement_hook"
imageStyle"digital-art", "photographic", "fantasy-art", "isometric", "3d-model", "anime", "neon-punk"
imageSize"1024x1024", "1152x896", "1216x832", "1344x768", "1536x640", "640x1536", "768x1344", "832x1216", "896x1152"
mediaPreference"None", "Auto", "Images", "Videos"
imageProvider"stock-pixabay", "stable-diffusion-v3"
numberofOutlineString values from "2" to "15", representing the number of main headings. Each section is approximately 200 words, so total article length is estimated as (numberofOutline × 200) words.

Note: For boolean parameters (e.g., includeTableOfContent, includeFAQSection, etc.), use true or false.

For numeric parameters (e.g., maximumExternalLinks, maximumInternalLinks, etc.), use integer values.

Note: The numberofOutline parameter controls the number of main sections/headings in the article, and thus the approximate article length. Each section is roughly 200 words, so the total word count is an estimate.

Response

The API responds with a JSON object containing the following properties:

PropertyTypeDescription
articleIdsarrayArray of generated article IDs (UUIDs) for bulk operations.
projectIdstringProject ID (UUID) grouping multiple articles together.
redisKeystringCache key for prefetched data (returned for task="prefetch").
statusstringArticle generation status: "queued", "processing", "finished", "failed".
progressnumberGeneration progress percentage (0-100).
errorstringError message if the request fails.
messagestringHuman-readable status message.

Example Requests

Basic Article Generation

fetch("https://www.semanticpen.com/api/articles", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    targetKeyword: ["sustainable living tips", "eco-friendly lifestyle"],
    articleMode: "Bulk Writer",
    language: "english",
    country: "United States",
    toneOfVoice: "informative",
    pointOfView: "secondPerson",
    includeTableOfContent: true,
    includeFAQSection: true,
    aiSeoOptimzation: true,
    projectName: "Sustainability Blog Series",
    personalisationName: "eco-brand-voice"
  }),
});

Bulk Article Generation with Media

fetch("https://www.semanticpen.com/api/articles", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    targetKeyword: ["digital marketing trends", "SEO best practices", "content marketing"],
    articleMode: "Bulk Writer",
    projectName: "Marketing Blog Q1 2024",
    mediaPreference: "Images",
    maxImages: 3,
    imageStyle: "photographic",
    imageSize: "1024x1024",
    imageProvider: "stock-pixabay",
    brandVoice: "Professional and authoritative tone with actionable insights",
    targetAudience: "Marketing professionals and business owners",
    language: "english",
    country: "United States",
    toneOfVoice: "professional",
    includeTableOfContent: true,
    includeFAQSection: true,
    aiSeoOptimzation: true
  }),
});

Article Generation with WordPress Integration

fetch("https://www.semanticpen.com/api/articles", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    targetKeyword: "productivity tips for remote workers",
    articleMode: "Bulk Writer",
    projectName: "Remote Work Blog",
    integrationData: {
      integrationType: "WordPress",
      websiteID: "your-website-id",
      categoryName: ["Productivity", "Remote Work"],
      tagNames: ["productivity", "remote", "work-from-home"],
      authorName: "John Doe",
      postStatus: "draft",
      publishImmediately: false,
      scheduleStartDate: "2024-01-15",
      scheduleEndDate: "2024-01-30",
      postFrequency: "daily"
    },
    language: "english",
    country: "United States",
    toneOfVoice: "friendly",
    pointOfView: "secondPerson",
    includeTableOfContent: true,
    includeFAQSection: true,
    aiSeoOptimzation: true
  }),
});

Amazon Product Review Article

fetch("https://www.semanticpen.com/api/articles", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    targetKeyword: "best eco-friendly water bottle",
    articleMode: "Amazon Product Review Articles",
    amazonProductURL: "https://www.amazon.com/Redragon-S101-Keyboard-Ergonomic-Programmable/dp/B00NLZUM36/",
    amazonAffiliateTag: "your-affiliate-tag-20",
    language: "english",
    country: "United States",
    toneOfVoice: "persuasive",
    pointOfView: "firstPersonSingular",
    includeTableOfContent: true,
    includeFAQSection: true,
    aiSeoOptimzation: true
  }),
});

YouTube to Article

fetch("https://www.semanticpen.com/api/articles", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    targetKeyword: "machine learning basics",
    articleMode: "Youtube to Article",
    youtubeVideoURL: "https://www.youtube.com/watch?v=creuUvqslYg",
    language: "english",
    country: "United States",
    toneOfVoice: "educational",
    pointOfView: "thirdPerson",
    includeTableOfContent: true,
    includeFAQSection: true,
    aiSeoOptimzation: true
  }),
});

Error Handling

The API uses standard HTTP response codes to indicate the success or failure of requests. In case of an error, the response will include an `error` field with a description of the issue.

Common error codes:

  • 400: Bad Request - The request was invalid or cannot be served.
  • 401: Unauthorized - The request requires authentication or the provided API key is invalid.
  • 403: Forbidden - The server understood the request but refuses to authorize it.
  • 500: Internal Server Error - The server encountered an unexpected condition that prevented it from fulfilling the request.

Available Languages

Language CodeLanguage NameCountry
arArabicSaudi Arabia
bgBulgarianBulgaria
zhChinese (Simplified)China
zh-twChinese (Traditional)Taiwan
hrCroatianCroatia
csCzechCzech Republic
daDanishDenmark
nlDutchNetherlands
enEnglishUnited States
etEstonianEstonia
fiFinnishFinland
frFrenchFrance
de-formal-sieGerman Formal (Sie)Germany
de-informal-duGerman Informal (du)Germany
elGreekGreece
iwHebrewN/A
hiHindiIndia
huHungarianHungary
idIndonesianIndonesia
gaIrishIreland
itItalianItaly
jaJapaneseJapan
koKoreanSouth Korea
laLatinVatican City
lvLatvianLatvia
ltLithuanianLithuania
noNorwegianNorway
plPolishPoland
ptPortuguesePortugal
roRomanianRomania
ruRussianRussia
gdScottish GaelicScotland
srSerbianSerbia
skSlovakSlovakia
slSlovenianSlovenia
esSpanish (idioma español)Spain
svSwedish (svenska språket)Sweden
thThai (ภาษาไทย)Thailand
trTurkishTurkey
ukUkrainianUkraine
viVietnameseVietnam

Note: This list includes the main supported languages. Some languages may have additional variants or dialects.

SERP Countries and Codes

AngolaAO
ArgentinaAR
ArmeniaAM
AustraliaAU
AustriaAT
BahrainBH
BangladeshBD
BelgiumBE
BoliviaBO
BrazilBR
BulgariaBG
CanadaCA
ChileCL
ColombiaCO
Costa RicaCR
CroatiaHR
CyprusCY
Czech RepublicCZ
DenmarkDK
EcuadorEC
EgyptEG
El SalvadorSV
EstoniaEE
FinlandFI
FranceFR
GermanyDE
GreeceGR
GuatemalaGT
Hong KongHK
HungaryHU
IndiaIN
IndonesiaID
IrelandIE
IsraelIL
ItalyIT
JapanJP
JordanJO
KenyaKE
LatviaLV
LithuaniaLT
MalaysiaMY
MaltaMT
MexicoMX
MoroccoMA
NetherlandsNL
New ZealandNZ
NicaraguaNI
NigeriaNG
NorwayNO
PakistanPK
ParaguayPY
PeruPE
PolandPL
PortugalPT
RomaniaRO
Russian FederationRU
Saudi ArabiaSA
SerbiaRS
SingaporeSG
SlovakiaSK
SloveniaSI
South AfricaZA
South KoreaKR
SpainES
Sri LankaLK
SwedenSE
SwitzerlandCH
TaiwanTW
ThailandTH
TunisiaTN
TurkeyTR
UkraineUA
United Arab EmiratesAE
United KingdomGB
United StatesUS
UruguayUY
VenezuelaVE
Viet NamVN

Note: This list represents countries available for SERP data. Use the country code when making API requests.

Rate Limiting

API requests are subject to rate limiting to ensure fair usage. If you exceed the rate limit, you'll receive a 429 (Too Many Requests) response. Please contact support for information about your specific rate limits.

Additional Notes

  • The API now supports both string and array formats for `targetKeyword`. Use arrays for bulk operations with multiple keywords.
  • API key authentication is required. The system automatically retrieves your organization context and user details from the provided API key.
  • The `articleMode` parameter determines the type of article generation. Available modes include "Bulk Writer", "Pro Mode", "Quick Mode", "Amazon Product Review Articles", and "Youtube to Article".
  • When using the "Amazon Product Review Articles" mode, the `amazonProductURL` is required.
  • For the "Youtube to Article" mode, the `youtubeVideoURL` is required.
  • **Bulk Operations**: Use `projectName` to group multiple articles together. The API returns a `projectId` and array of `articleIds`.
  • **Media Support**: Set `mediaPreference` to "Images" or "Videos" to include media in articles. Configure `imageStyle`, `imageSize`, and `imageProvider` for customization.
  • **Personalization**: Use `personalisationName` to apply saved personalization profiles for consistent brand voice and internal linking.
  • **Publishing Integration**: Use `integrationData` to automatically publish articles to WordPress or Wix with scheduling and categorization.
  • **Knowledge Base**: Use `selectedKnowledgeBase` to enhance articles with organization-specific content and context.
  • The generated articles are queued for processing. The response includes article IDs that can be used to check the status or retrieve the completed articles later.
  • **Rate Limiting**: The API implements credit-based usage tracking. Each request consumes credits based on article length and complexity.

For any questions or support, please contact [email protected].