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.

Endpoint

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

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
targetKeywordstringYesThe main keyword or topic for the article. Multiple keywords can be provided, separated by newlines.
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).

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

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

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

Response

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

PropertyTypeDescription
dataarrayAn array of generated article IDs.
errorstringError message if the request fails.

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",
    articleMode: "Bulk Writer",
    language: "english",
    country: "United States",
    toneOfVoice: "informative",
    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 `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.
  • The API supports multiple target keywords. Provide them as a newline-separated string in the `targetKeyword` field.
  • 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.

For any questions or support, please contact contact@semanticpen.com.