PostliftDevelopers
Documentation menu
AI generation

Generate content using the active account voice

Use this endpoint from your own integration, with the same account permissions and safeguards as the app.

Scope · ai:writeIdempotency-Key required10 expensive operations / minute / user

Request

POST/api/v1/voice/{accountId}/generate
Example requestcURL
curl -X POST 'https://postlift.io/api/v1/voice/{accountId}/generate' \
  -H "Authorization: Bearer $POSTLIFT_API_KEY" \
  -H 'Idempotency-Key: integration-operation-0001' \
  -H 'Content-Type: application/json' \
  --data '{
  "kind": "draft",
  "brief": "Explain one lesson from a small product release.",
  "model": "openai/gpt-6-luna",
  "maxOutputTokens": 1024,
  "stream": false
}'

Replace path placeholders with your Postlift resource IDs. Example timestamps must be replaced with a future time; preserve the same timestamp when retrying the same operation.

Parameters

NameLocationDescription
accountIdrequiredpathPostlift resource ID belonging to the API key owner.
Idempotency-KeyrequiredheaderUnique operation key. Reuse only for the same payload/account. See retry semantics in the guide.Pattern: ^[A-Za-z0-9_-]{8,128}$.

Request body

Send JSON with Content-Type: application/json.

FieldType & constraints
kindrequiredstringValues: draft, rewrite, thread, hook, reply, ideas.
briefrequiredstringMin. characters: 1. Max. characters: 8000.
modeloptionalstringDefault: "openai/gpt-6-luna".
maxOutputTokensoptionalintegerDefault: 1024. Minimum: 32. Maximum: 2048.
streamoptionalbooleanDefault: false.
View JSON schema
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "draft",
        "rewrite",
        "thread",
        "hook",
        "reply",
        "ideas"
      ]
    },
    "brief": {
      "type": "string",
      "minLength": 1,
      "maxLength": 8000
    },
    "model": {
      "default": "openai/gpt-6-luna",
      "type": "string"
    },
    "maxOutputTokens": {
      "default": 1024,
      "type": "integer",
      "minimum": 32,
      "maximum": 2048
    },
    "stream": {
      "default": false,
      "type": "boolean"
    }
  },
  "required": [
    "kind",
    "brief"
  ],
  "additionalProperties": false
}

Response

200 Successful operation.

Streaming supported. Set stream:false for JSON. Stream errors can occur after HTTP 200; retain X-AI-Request-ID and inspect request status.
FieldType & constraints
requestIdrequiredstring
modelrequiredstring
textrequiredstring
finishReasonrequiredstring
usagerequiredobject
Explore Generation ↗
View JSON schema
{
  "type": "object",
  "properties": {
    "requestId": {
      "type": "string"
    },
    "model": {
      "type": "string"
    },
    "text": {
      "type": "string"
    },
    "finishReason": {
      "type": "string"
    },
    "usage": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "required": [
    "requestId",
    "model",
    "text",
    "finishReason",
    "usage"
  ],
  "additionalProperties": true
}

Errors & retries

Failures use a stable error code and request ID. Check the current resource version or request status before retrying a write.

StatusMeaning
400Invalid input or Jev rejection
401Invalid, expired or revoked API key
402Plan, publishing quota or AI credit requirement
403Missing scope
404Resource not found or not owned
409Version conflict, missing voice or duplicate AI operation
413Payload too large
429Rate or concurrency limit
500Internal error
502Upstream failure; inspect operation status
503Service or review unavailable
Read the retry guide ↗