TrainFog Developers
Posts

Generate content for a specific post

Generates content (artifacts) for the post using an AI model. This operation requires a post ID and a model name in the request body.

POST
/posts/{id}/generate
AuthorizationBearer <token>

In: header

Path Parameters

id*string

The id of the post to generate content for

Request Body

application/json

Generation request body. Requires the model field.

model*string

The AI model to use for generation.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.trainfog.com/developers/v1.0/posts/string/generate" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-4"  }'
{
  "id": "688874b1a08a60001dd72e1d",
  "product": "some-product-id",
  "topic": "How to use the Trainfog API",
  "type": "blog",
  "artifacts": [
    {
      "title": "API Guide: Getting Started",
      "body": "This is the generated blog post body..."
    }
  ],
  "createdAt": "2025-07-29T07:13:53.474Z",
  "updatedAt": "2025-07-29T07:13:53.474Z"
}
{
  "error": "Bad request"
}
{
  "error": "Unauthorized"
}
{
  "error": "Not found"
}