Skip to content

Create a Lorebook

POST
/open/v1/worldbook
curl --request POST \
--url https://api.harperharbor.com/open/v1/worldbook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "description": "example", "iconUrl": "example", "tags": [ "example" ], "visibility": "private", "language": "example", "format": "", "idempotencyKey": "example" }'

Creates an empty Lorebook owned by the bearer. name is required. visibility accepts public, private or waitReview; any other value (including omitted) is stored as private. format is ""/omitted for the native format or tavern (aliases sillytavern, st) for SillyTavern-style keyword matching; it cannot be changed after creation; unknown values fail with unknown worldbook format. language is stored as given (not validated here). Add entries and bind the book to a role with POST /worldbook/{worldbookId}/document. Returns 503 worldbook_unavailable when the Lorebook service is not running on this deployment. HarperHarbor supports an optional roleId query parameter: the authenticated author can create a new private Lorebook in that agent configuration’s storage tenant, including from another application. This grants no access to another author’s resources.

roleId
string format: uuid

HarperHarbor: owned target agent configuration for resource placement.

Media typeapplication/json
object
name
required

Trimmed; non-blank.

string
description
string
iconUrl
string
tags

Stored comma-joined.

Array<string>
visibility

Unknown/omitted = private.

string
default: private
Allowed values: private public waitReview
language

Language label stored on the book (not validated).

string
format

tavern enables SillyTavern-style keyword matching (single-character keywords allowed, matchOptions defaults applied). Aliases sillytavern, st. Immutable after creation.

string
""
Allowed values: "" tavern
idempotencyKey

Accepted; not used for deduplication.

string

Created.

Media typeapplication/json
object
worldbookId
required
string
name
string
visibility
string
Allowed values: private public waitReview
patch
object
patchedOperations
required

Number of operations applied.

integer
charsBefore
required

Rune count before.

integer
charsAfter
required

Rune count after.

integer
sha256Before
required

Hex SHA-256 of the text before.

string
sha256After
required

Hex SHA-256 of the text after.

string
textPatches
object
key
additional properties
object
patchedOperations
required

Number of operations applied.

integer
charsBefore
required

Rune count before.

integer
charsAfter
required

Rune count after.

integer
sha256Before
required

Hex SHA-256 of the text before.

string
sha256After
required

Hex SHA-256 of the text after.

string
nextRecommendedTools
required
Array<string>
Example
{
"visibility": "private"
}

invalid JSON body, name is required.

Media typeapplication/json
object
error
required

Error code (snake_case) or, for legacy handlers, a free-text/localized message.

string
message

Human-readable sentence. Present only on middleware errors and /me, /me/wallet.

string
retryable

Whether retrying may succeed. Present only on middleware errors, /me, /me/wallet and service/share routes.

boolean
required_context_tier

Only on a first-turn context_capacity_exceeded: the smallest context tier that fits the whole card with room to talk. Save it as context in player settings and resend. Absent when no tier fits.

integer
>= 1 <= 5
required_context_tokens

The token budget of required_context_tier for the selected model, for display.

integer
constant_lore_trim_fits

Only on a first-turn context_capacity_exceeded: whether saving trimConstantLore=true lets the card play at the current tier. Absent on mid-conversation capacity errors.

boolean
credits_needed

Only on insufficient_credits: the credits this turn needs before it can start. Absent when the refusal came without an estimate.

integer
credits_available

Only on insufficient_credits: the credits the wallet could set aside for it.

integer
Examplegenerated
{
"error": "example",
"message": "example",
"retryable": true,
"required_context_tier": 1,
"required_context_tokens": 1,
"constant_lore_trim_fits": true,
"credits_needed": 1,
"credits_available": 1
}

unauthorized.

Media typeapplication/json
object
error
required

Error code (snake_case) or, for legacy handlers, a free-text/localized message.

string
message

Human-readable sentence. Present only on middleware errors and /me, /me/wallet.

string
retryable

Whether retrying may succeed. Present only on middleware errors, /me, /me/wallet and service/share routes.

boolean
required_context_tier

Only on a first-turn context_capacity_exceeded: the smallest context tier that fits the whole card with room to talk. Save it as context in player settings and resend. Absent when no tier fits.

integer
>= 1 <= 5
required_context_tokens

The token budget of required_context_tier for the selected model, for display.

integer
constant_lore_trim_fits

Only on a first-turn context_capacity_exceeded: whether saving trimConstantLore=true lets the card play at the current tier. Absent on mid-conversation capacity errors.

boolean
credits_needed

Only on insufficient_credits: the credits this turn needs before it can start. Absent when the refusal came without an estimate.

integer
credits_available

Only on insufficient_credits: the credits the wallet could set aside for it.

integer
Examplegenerated
{
"error": "example",
"message": "example",
"retryable": true,
"required_context_tier": 1,
"required_context_tokens": 1,
"constant_lore_trim_fits": true,
"credits_needed": 1,
"credits_available": 1
}

unknown worldbook format or another unclassified error; retryable: true.

Media typeapplication/json
object
error
required

Error code (snake_case) or, for legacy handlers, a free-text/localized message.

string
message

Human-readable sentence. Present only on middleware errors and /me, /me/wallet.

string
retryable

Whether retrying may succeed. Present only on middleware errors, /me, /me/wallet and service/share routes.

boolean
required_context_tier

Only on a first-turn context_capacity_exceeded: the smallest context tier that fits the whole card with room to talk. Save it as context in player settings and resend. Absent when no tier fits.

integer
>= 1 <= 5
required_context_tokens

The token budget of required_context_tier for the selected model, for display.

integer
constant_lore_trim_fits

Only on a first-turn context_capacity_exceeded: whether saving trimConstantLore=true lets the card play at the current tier. Absent on mid-conversation capacity errors.

boolean
credits_needed

Only on insufficient_credits: the credits this turn needs before it can start. Absent when the refusal came without an estimate.

integer
credits_available

Only on insufficient_credits: the credits the wallet could set aside for it.

integer
Examplegenerated
{
"error": "example",
"message": "example",
"retryable": true,
"required_context_tier": 1,
"required_context_tokens": 1,
"constant_lore_trim_fits": true,
"credits_needed": 1,
"credits_available": 1
}

worldbook_unavailable — {"error": "worldbook_unavailable", "retryable": true}.

Media typeapplication/json
object
error
required

Error code (snake_case) or, for legacy handlers, a free-text/localized message.

string
message

Human-readable sentence. Present only on middleware errors and /me, /me/wallet.

string
retryable

Whether retrying may succeed. Present only on middleware errors, /me, /me/wallet and service/share routes.

boolean
required_context_tier

Only on a first-turn context_capacity_exceeded: the smallest context tier that fits the whole card with room to talk. Save it as context in player settings and resend. Absent when no tier fits.

integer
>= 1 <= 5
required_context_tokens

The token budget of required_context_tier for the selected model, for display.

integer
constant_lore_trim_fits

Only on a first-turn context_capacity_exceeded: whether saving trimConstantLore=true lets the card play at the current tier. Absent on mid-conversation capacity errors.

boolean
credits_needed

Only on insufficient_credits: the credits this turn needs before it can start. Absent when the refusal came without an estimate.

integer
credits_available

Only on insufficient_credits: the credits the wallet could set aside for it.

integer
Examplegenerated
{
"error": "example",
"message": "example",
"retryable": true,
"required_context_tier": 1,
"required_context_tokens": 1,
"constant_lore_trim_fits": true,
"credits_needed": 1,
"credits_available": 1
}