Hook generator API
Start your post with a first line people stop for. Pick a style, type your topic, and copy a hook from 83 free templates, or let AI write hooks for your exact post.
- Endpoint:
POST https://postboost.co/app/api/tools/hook-generator(operationIdgenerateHooks) - Web tool: postboost.co/tools/hook-generator
- Token: required. A new generation spends 1 AI credit of the workspace you name (or your active workspace); a repeated identical request is answered from the cache for free. A scoped API key needs the
aiability and pays with its own workspace - MCP: tool
generate-hooksonhttps://postboost.co/mcp/tools(listed only with a token)
Request
| Field | Type | Default | Description |
|---|---|---|---|
topic | string | What the post is about. | |
tone | string: friendly, professional, playful, inspirational, bold | "friendly" | Tone of the hooks, as on the caption generator. |
count | integer | 5 | How many hooks to write. |
network | string: instagram, tiktok, linkedin, x, threads, facebook | "instagram" | The network the text is written for. |
workspace | string | UUID of the workspace whose AI credits pay for the call. Default: your active workspace (a scoped API key: its own workspace). |
Call it
- curl
- Python
- Node.js
- PHP
- Go
- Ruby
- Java
- C#
- Rust
- CLI
curl -X POST https://postboost.co/app/api/tools/hook-generator \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"topic":"Email newsletters for a small bakery","network":"instagram","count":2}'
from postboost import ApiClient, Configuration
from postboost.api.free_tools_api import FreeToolsApi
from postboost.models import FreeToolGenerateHooksRequest
with ApiClient(Configuration()) as client:
api = FreeToolsApi(client)
result = api.generate_hooks(FreeToolGenerateHooksRequest.from_dict({"topic": "Email newsletters for a small bakery", "network": "instagram", "count": 2}))
print(result.to_dict())
import { FreeToolsApi } from 'postboost';
const api = new FreeToolsApi();
const { body } = await api.generateHooks({ topic: "Email newsletters for a small bakery", network: "instagram", count: 2 });
console.log(body);
use PostBoostClient\Api\FreeToolsApi;
use PostBoostClient\Model\FreeToolGenerateHooksRequest;
$api = new FreeToolsApi(new GuzzleHttp\Client());
$result = $api->generateHooks(new FreeToolGenerateHooksRequest(['topic' => "Email newsletters for a small bakery", 'network' => "instagram", 'count' => 2]));
echo $result;
import (
"context"
"encoding/json"
"fmt"
postboost "github.com/postboost-co/postboost-go"
)
var request postboost.FreeToolGenerateHooksRequest
if err := json.Unmarshal([]byte(`{"topic":"Email newsletters for a small bakery","network":"instagram","count":2}`), &request); err != nil {
panic(err)
}
client := postboost.NewAPIClient(postboost.NewConfiguration())
result, _, err := client.FreeToolsAPI.GenerateHooks(context.Background()).FreeToolGenerateHooksRequest(request).Execute()
fmt.Println(result, err)
require 'postboost'
api = PostBoost::FreeToolsApi.new
result = api.generate_hooks(PostBoost::FreeToolGenerateHooksRequest.new({ topic: "Email newsletters for a small bakery", network: "instagram", count: 2 }))
puts result.to_hash
import com.postboost.ApiClient;
import com.postboost.api.FreeToolsApi;
import com.postboost.model.FreeToolGenerateHooksRequest;
import com.postboost.model.FreeToolGenerateHooksResponse;
FreeToolsApi api = new FreeToolsApi(new ApiClient());
FreeToolGenerateHooksRequest request = FreeToolGenerateHooksRequest.fromJson("{\"topic\":\"Email newsletters for a small bakery\",\"network\":\"instagram\",\"count\":2}");
FreeToolGenerateHooksResponse result = api.generateHooks(request);
System.out.println(result.toJson());
using Newtonsoft.Json;
using PostBoost.Client.Api;
using PostBoost.Client.Client;
using PostBoost.Client.Model;
var api = new FreeToolsApi(new Configuration());
var request = JsonConvert.DeserializeObject<FreeToolGenerateHooksRequest>(@"{""topic"":""Email newsletters for a small bakery"",""network"":""instagram"",""count"":2}");
var result = await api.GenerateHooksAsync(request);
Console.WriteLine(result.ToJson());
use postboost::apis::configuration::Configuration;
use postboost::apis::free_tools_api;
use postboost::models::FreeToolGenerateHooksRequest;
let config = Configuration::new();
let request: FreeToolGenerateHooksRequest = serde_json::from_str(r##"{"topic":"Email newsletters for a small bakery","network":"instagram","count":2}"##)?;
let result = free_tools_api::generate_hooks(&config, request).await?;
println!("{:?}", result);
echo '{"topic":"Email newsletters for a small bakery","network":"instagram","count":2}' | ./postboost-cli --content-type application/json generateHooks -
This tool needs a token: send Authorization: Bearer YOUR_API_TOKEN as a default header (how, per SDK).
Response
{
"hooks": [
{
"text": "What would you want in your inbox from your favourite bakery?",
"category": "question"
},
{
"text": "We sent our first newsletter with no discount in it. People still opened it.",
"category": "story"
}
],
"credits_spent": 1,
"cached": false
}
With MCP
Connect https://postboost.co/mcp/tools (setup) and ask, for example: Generate hooks (opening lines) for a social media post with AI (needs a token, spends AI credits) with the PostBoost generate-hooks tool.
Errors
| Status | When |
|---|---|
401 | No token, or an invalid one. The body has register_url to create a free account. |
403 | workspace is not a workspace you belong to, or your account has no workspace, or a scoped API key lacks the ai ability or is bound to another workspace (code: insufficient_scope). |
413 | The JSON body is larger than 128 KB. |
422 | A field is invalid; the body lists the errors per field. |
429 | The workspace has no AI credits left this billing cycle (code: ai_credits_exhausted, upgrade_url), or the per-minute limit is reached. |
502 | The AI provider failed or timed out. No credit was spent. |
503 | AI tools are switched off right now. |