API Documentation
Write stories and poems from your own website or app. Requests and answers are JSON over HTTPS.
Getting started
- Create an account and confirm your email address.
- Choose an API plan.
- Create a key on your account's Profile page and keep it on your server.
- Call the endpoints below.
Base URL
https://seotoolhub.net/api/v1
Authentication
Send your key with every request, in one of these headers. A key in the address or the body is not read.
Authorization: Bearer sth_live_...
X-API-Key: sth_live_...
Credits and limits
One credit is one word written. A request first takes the most credits its length can use, then gives back every credit for words that were not written, so you pay for the words you get. Refused requests cost nothing.
| AI Story Generator | Most credits |
|---|---|
| Very short (150 to 300 words) | 300 |
| Short (300 to 600 words) | 600 |
| Medium (600 to 900 words) | 900 |
| Long (900 to 1,200 words) | 1200 |
| Very long (1,200 to 1,500 words) | 1500 |
| Extra long (1,500 to 2,000 words) | 2000 |
| AI Poem Generator | Most credits |
|---|---|
| Short poem (about 8 lines) | 100 |
| Medium poem (16 to 20 lines) | 200 |
| Long poem (30 to 40 lines) | 400 |
| Plan | Requests a minute | At once |
|---|---|---|
| Weekly | 10 | 1 |
| Monthly | 20 | 2 |
Limits count per account, over all its keys. Answers carry X-RateLimit-Limit, X-RateLimit-Remaining and X-Request-Id. Writing can take up to a minute, so give your request that long before giving up.
Usage
GET /api/v1/usage
Your plan, the credits left and your limits. Costs no credits.
Request
curl https://seotoolhub.net/api/v1/usage \
-H "Authorization: Bearer $API_KEY"
Answer
{
"plan": {
"id": "api_monthly",
"name": "Monthly"
},
"credits": {
"remaining": 64560,
"total": 65000,
"renews_at": "2027-01-01T00:00:00+00:00"
},
"limits": {
"requests_per_minute": 20,
"concurrent_requests": 2
},
"last_30_days": {
"requests": 5,
"credits_used": 440
}
}
Write a story
POST /api/v1/stories
One story from your idea. You pay one credit for each word written, up to the most its length allows.
| Field | Required | What it is |
|---|---|---|
| idea | yes | What the story is about, up to 5,000 characters. |
| language | no |
Language code. Default en.
Allowed values (33)en, es, ar, de, fr, pt, pt-BR, nl, pl, tl, it, cs, tr, sv, he, ru, fi, ja, ko, hi, id, no, ro, th, hr, da, ka, ga, vi, ur, fa, zh, ms |
| length | no |
Default short. Decides the price.
Allowed values (6)very_short, short, medium, long, very_long, extra_long |
| genre | no |
Genre.
Allowed values (12)original, classic, humor, scifi, action, thriller, horror, realism, biography, fiction, non_fiction, mystery |
| creativity | no |
How adventurous the writing is.
Allowed values (7)standard, innovative, visionary, conservative, imaginative, inspired, realistic |
| audience | no |
Age of the readers.
Allowed values (5)3-6, 7-13, 14-20, 21-35, 35+ |
| narrative | no |
Point of view.
Allowed values (10)first_person, second_person, third_person, omniscient, stream_of_consciousness, epistolary, multiple_perspectives, interactive, observer, camera_eye |
| format | no |
Form of the text.
Allowed values (10)prose, screenplay, stageplay, short_story, letter, diary, fairy_tale, myth, fable, poem |
| characters | no | Who is in it, up to 1,000 characters. |
| setting | no | Where and when, up to 1,000 characters. |
Request
curl https://seotoolhub.net/api/v1/stories \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"idea": "A lighthouse keeper finds a message", "genre": "original", "length": "short"}'
Answer
{
"id": "req_01j0example",
"story": "The Message in the Glass\n\nThe lamp had been burning for an hour when ...",
"words": 412,
"credits_used": 412,
"credits_remaining": 64588
}
Write poems
POST /api/v1/poems
One to three poems from your idea. You pay one credit for each word written, up to the most the length and the number of poems allow.
| Field | Required | What it is |
|---|---|---|
| idea | yes* | What the poem is about, up to 2,000 characters. *Not needed for an acrostic with its word. |
| language | no |
Language code. Default en.
Allowed values (52)en, es, fr, de, it, pt, pt-BR, sq, ar, bn, bg, ca, zh, hr, cs, da, nl, et, tl, fi, ka, el, he, hi, hu, id, ga, ja, kn, ko, lv, ms, ml, mr, ne, no, fa, pl, pa, ro, ru, sl, so, sw, sv, ta, te, th, tr, uk, ur, vi |
| type | no |
Poem form.
Allowed values (27)free_verse, rhyming, haiku, tanka, sonnet, petrarchan, limerick, acrostic, ballad, ode, elegy, blank_verse, couplet, quatrain, villanelle, sestina, epic, epitaph, ghazal, pantoum, cinquain, diamante, narrative, lyric, prose, spoken_word, nursery |
| length | no |
Default short. Decides the price. Forms with a fixed shape keep it.
Allowed values (3)short, medium, long |
| tone | no |
Mood.
Allowed values (13)romantic, joyful, funny, playful, hopeful, inspirational, calm, nostalgic, sad, dark, dramatic, spiritual, formal |
| style | no |
In the manner of a poet, or custom.
Allowed values (29)shakespeare, dickinson, whitman, frost, poe, wordsworth, keats, shelley, byron, blake, browning, tennyson, yeats, eliot, hughes, plath, angelou, neruda, lear, homer, dante, basho, rumi, hafez, ghalib, iqbal, gibran, tagore, custom |
| custom_style | with style custom | Your own style, up to 100 characters. |
| rhyme | no |
Rhyme scheme.
Allowed values (5)rhymed, aabb, abab, abcb, unrhymed |
| occasion | no |
What it is for.
Allowed values (17)birthday, proposal, wedding, anniversary, valentine, friendship, mother, father, baby, graduation, retirement, thank_you, apology, get_well, sympathy, memorial, new_year |
| names | no | Names to include, up to 200 characters. |
| words | no | Words or details to include, up to 200 characters. |
| acrostic_word | no | The word an acrostic spells, up to 30 characters. |
| versions | no | How many different poems, 1 to 3. Default 1. Each is charged. |
Request
curl https://seotoolhub.net/api/v1/poems \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"idea": "The sea at night", "length": "short", "versions": 2}'
Answer
{
"id": "req_01j0example",
"poems": [
{
"title": "Night Water",
"text": "The harbour keeps one lamp awake ..."
},
{
"title": "Tide",
"text": "..."
}
],
"words": 118,
"credits_used": 118,
"credits_remaining": 64470
}
Change a poem
POST /api/v1/poems/revise
Rewrites a poem you send, following your instruction.
| Field | Required | What it is |
|---|---|---|
| poem | yes | The poem to change, up to 6,000 characters. |
| change | yes | What to change, up to 200 characters. |
| language | no | Language code. Default en. |
Request
curl https://seotoolhub.net/api/v1/poems/revise \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"poem": "Night Water\nThe harbour keeps one lamp awake", "change": "Make it more hopeful"}'
Answer
{
"id": "req_01j0example",
"poems": [
{
"title": "Night Water",
"text": "..."
}
],
"words": 64,
"credits_used": 64,
"credits_remaining": 64406
}
Errors
Every error has the same shape. Act on type; the message is for people and may change.
{
"error": {
"type": "insufficient_credits",
"message": "This request needs up to 600 credits (one for each word written) and 2 are left.",
"credits_needed": 600,
"credits_remaining": 2
}
}
| Status | Type | Meaning |
|---|---|---|
| 400 | invalid_json | The body is not a JSON object. |
| 401 | missing_api_key, invalid_api_key | No key, or a key that is wrong or deleted. |
| 402 | insufficient_credits | Not enough API credits. The error says how many are needed and left. |
| 403 | email_unverified, no_api_plan | The account behind the key may not use the API right now. |
| 404 | not_found | No such endpoint. |
| 405 | method_not_allowed | Wrong method for this endpoint. |
| 413 | request_too_large | The body is over 64 KB. |
| 415 | unsupported_media_type | Send Content-Type: application/json. |
| 422 | invalid_request | A field is missing, unknown or not allowed. "fields" says which. |
| 429 | rate_limit_exceeded, too_many_concurrent_requests | Slow down. Wait the seconds in Retry-After. |
| 500 | server_error | Something failed on our side. |
| 503 | generation_failed, server_busy | Nothing was written and no credits were taken. Try again shortly. |
Keeping keys safe
- Keep keys on your server, in an environment variable or a secrets store. Never put one in a web page, a mobile app or a public repository.
- Use one key for each app, so you can delete one without stopping the others.
- A key is shown once, when you create it. If one may have leaked, delete it and create another.
- The API writes only what our content rules allow, the same as the tools on this site. See the terms of service.