Content Enrichment API / Text Generation
Generate text
PageMore page actions
POST /v2/project/content/generateText
Queue an asynchronous text-generation run for a selection of the project's hotels and return the created run object.
The run starts in the queued state and is processed in the background. Use the returned run ID with getTextGenerationStatus to poll its status and progress until it reaches complete or failed.
Hotels are selected by HotelIDs and/or TagIDs (combined and deduplicated, capped at 100), and every selected hotel must belong to the calling project. If a selected hotel already has a run in progress, the request is rejected with 409.
Example request
curl -X POST 'https://api.ygo.ai/v2/project/content/generateText' \
-H "Authorization: Bearer $YGO_API_KEY" \
-H "X-Project-ID: $YGO_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{
"HotelIDs": [
"0192fb17-5dc6-7abc-8def-123456789abc",
"0192fb18-6ed7-7abc-8def-223456789abc"
]
}'Authorization
Authorization: Bearer <key>
Project-scoped API key
Headers
X-Project-IDstring (uuid) requiredProject UUID. Required for all project-scoped endpoints.
Request body required
application/json object GenerateTextRequest
Request body for queuing a text-generation run. At least one of HotelIDs or TagIDs must be provided. HotelIDs and the hotels resolved from TagIDs are combined and deduplicated; the result is capped at 100 hotels.
HotelIDsarray of string (uuid)Explicit hotel UUIDs to generate text for. Each hotel must belong to the calling project; a hotel outside the project's scope returns 404. Required if TagIDs is empty.
TagIDsarray of string (uuid)Tag UUIDs. Hotels carrying ALL of the given tags (intersection) and belonging to the project are added to the selection. Required if HotelIDs is empty.
TemplateKeysarray of stringOptional subset of active template keys to (re)generate. Each key must be an active template of the project. Empty means all active templates. Maximum 100 keys.
Localesarray of stringOptional subset of BCP 47 language tags to generate. Empty means the locales configured on the matched templates (always including en-US).
RegenModestringControls which texts are (re)generated. 'fill_missing' (the default) generates only missing or stale texts; 'full' regenerates every selected text.
Example request: Regenerate all active templates for two hotels in all template locales
{
"HotelIDs": [
"0192fb17-5dc6-7abc-8def-123456789abc",
"0192fb18-6ed7-7abc-8def-223456789abc"
]
}Example request: Regenerate only the Summary template, two locales, full regeneration
{
"HotelIDs": [
"0192fb17-5dc6-7abc-8def-123456789abc"
],
"TemplateKeys": [
"Summary"
],
"Locales": [
"en-US",
"de-DE"
],
"RegenMode": "full"
}Example request: Fill missing texts for every project hotel carrying a tag
{
"TagIDs": [
"0192fb40-7aa1-7abc-8def-aabbccddeeff"
],
"RegenMode": "fill_missing"
}Responses
200 OK
Text-generation run queued successfully. The run is processed asynchronously; poll getTextGenerationStatus with the returned run ID.
Headers
X-Trace-IDstringRequest trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.
Body
application/json object GenerateTextResponse
Single-object response envelope wrapping the queued text-generation run.
Dataobject TextGenerationRun requiredA text-generation run with its own status and progress.
8 fields
IDstring (uuid) requiredUnique run UUID. Pass this to getTextGenerationStatus to poll the run.
Statusstring requiredRun lifecycle status. A freshly created run is 'queued'; it transitions to 'processing' while running, then to 'complete' or 'failed'.
Progressobject RunProgress requiredPer-hotel progress counters for the run.
4 fields
Totalinteger requiredTotal number of hotels in the run.
Generatedinteger requiredNumber of hotels for which text has been generated so far.
Failedinteger requiredNumber of hotels that failed processing.
Skippedinteger requiredNumber of hotels skipped because they needed no work.
ErrorMessagestringHuman-readable error message when the run has failed. Empty or omitted otherwise.
StartedAtstring (date-time)Timestamp when the run started processing (RFC3339). Omitted until the run has started.
CompletedAtstring (date-time)Timestamp when the run finished (RFC3339). Omitted until the run has finished.
CreatedAtstring (date-time) requiredTimestamp when the run record was created (RFC3339).
UpdatedAtstring (date-time) requiredTimestamp when the run record was last updated (RFC3339).
Example response: A freshly queued run for two hotels
{
"Data": {
"ID": "0192fb50-8bb2-7abc-8def-112233445566",
"Status": "queued",
"Progress": {
"Total": 2,
"Generated": 0,
"Failed": 0,
"Skipped": 0
},
"CreatedAt": "2026-06-26T09:15:00Z",
"UpdatedAt": "2026-06-26T09:15:00Z"
}
}Example response: A freshly queued scoped run for one hotel
{
"Data": {
"ID": "0192fb51-9cc3-7abc-8def-2233445566aa",
"Status": "queued",
"Progress": {
"Total": 1,
"Generated": 0,
"Failed": 0,
"Skipped": 0
},
"CreatedAt": "2026-06-26T09:20:00Z",
"UpdatedAt": "2026-06-26T09:20:00Z"
}
}Example response: A freshly queued run resolved from a tag
{
"Data": {
"ID": "0192fb52-add4-7abc-8def-3344556677bb",
"Status": "queued",
"Progress": {
"Total": 5,
"Generated": 0,
"Failed": 0,
"Skipped": 0
},
"CreatedAt": "2026-06-26T09:25:00Z",
"UpdatedAt": "2026-06-26T09:25:00Z"
}
}400 Bad Request
Bad Request - Validation error or invalid request body.
Headers
X-Trace-IDstringRequest trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.
Body
application/json object ErrorResponse
Standard v2 error response wrapper.
Errorobject ErrorDetail requiredError detail containing a machine-readable code and human-readable message.
3 fields
Codestring requiredMachine-readable error code for programmatic handling.
Messagestring requiredHuman-readable error message.
Fieldsarray of object FieldErrorField-level validation errors. Only present for VALIDATION_ERROR responses.
4 fields
Fieldstring requiredName of the field that failed validation.
Messagestring requiredHuman-readable validation error message for this field.
CodestringMachine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.
Paramsmap of string to anyMachine-readable values the message is built from, such as limits or allowed values. Keys are PascalCase; which keys are present depends on Code. Optional.
Example response: Neither HotelIDs nor TagIDs provided
{
"Error": {
"Code": "VALIDATION_ERROR",
"Message": "Request validation failed",
"Fields": [
{
"Field": "HotelIDs",
"Message": "HotelIDs or TagIDs is required"
}
]
}
}Example response: RegenMode not in the allowed set
{
"Error": {
"Code": "VALIDATION_ERROR",
"Message": "RegenMode must be 'fill_missing' or 'full'"
}
}Example response: One or more template keys are not active templates of the project
{
"Error": {
"Code": "VALIDATION_ERROR",
"Message": "unknown or inactive template keys: Headline"
}
}Example response: Selection exceeds the per-run cap
{
"Error": {
"Code": "VALIDATION_ERROR",
"Message": "selection must not exceed 100 hotels"
}
}401 Unauthorized
Unauthorized - Invalid or missing API key.
Headers
X-Trace-IDstringRequest trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.
Body
application/json object ErrorResponse
Standard v2 error response wrapper.
Errorobject ErrorDetail requiredError detail containing a machine-readable code and human-readable message.
3 fields
Codestring requiredMachine-readable error code for programmatic handling.
Messagestring requiredHuman-readable error message.
Fieldsarray of object FieldErrorField-level validation errors. Only present for VALIDATION_ERROR responses.
4 fields
Fieldstring requiredName of the field that failed validation.
Messagestring requiredHuman-readable validation error message for this field.
CodestringMachine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.
Paramsmap of string to anyMachine-readable values the message is built from, such as limits or allowed values. Keys are PascalCase; which keys are present depends on Code. Optional.
Example response: Invalid API key
{
"Error": {
"Code": "UNAUTHORIZED",
"Message": "Invalid API key"
}
}403 Forbidden
Forbidden - Valid API key but insufficient permissions for this operation. Also returned with code INSUFFICIENT_SCOPE when the API key does not carry the content.generation:write permission this endpoint requires.
Headers
X-Trace-IDstringRequest trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.
Body
application/json object ErrorResponse
Standard v2 error response wrapper.
Errorobject ErrorDetail requiredError detail containing a machine-readable code and human-readable message.
3 fields
Codestring requiredMachine-readable error code for programmatic handling.
Messagestring requiredHuman-readable error message.
Fieldsarray of object FieldErrorField-level validation errors. Only present for VALIDATION_ERROR responses.
4 fields
Fieldstring requiredName of the field that failed validation.
Messagestring requiredHuman-readable validation error message for this field.
CodestringMachine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.
Paramsmap of string to anyMachine-readable values the message is built from, such as limits or allowed values. Keys are PascalCase; which keys are present depends on Code. Optional.
Example response: Missing required scope
{
"Error": {
"Code": "INSUFFICIENT_SCOPE",
"Message": "token lacks scope content.generation:write"
}
}Example response: Project access required
{
"Error": {
"Code": "FORBIDDEN",
"Message": "Project access required"
}
}404 Not Found
Not Found - One of the selected hotels does not exist or is not in the calling project's scope.
Headers
X-Trace-IDstringRequest trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.
Body
application/json object ErrorResponse
Standard v2 error response wrapper.
Errorobject ErrorDetail requiredError detail containing a machine-readable code and human-readable message.
3 fields
Codestring requiredMachine-readable error code for programmatic handling.
Messagestring requiredHuman-readable error message.
Fieldsarray of object FieldErrorField-level validation errors. Only present for VALIDATION_ERROR responses.
4 fields
Fieldstring requiredName of the field that failed validation.
Messagestring requiredHuman-readable validation error message for this field.
CodestringMachine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.
Paramsmap of string to anyMachine-readable values the message is built from, such as limits or allowed values. Keys are PascalCase; which keys are present depends on Code. Optional.
Example response: A selected hotel is not in the project
{
"Error": {
"Code": "NOT_FOUND",
"Message": "hotel not found"
}
}409 Conflict
Conflict - One or more selected hotels already have a text-generation run in progress.
Headers
X-Trace-IDstringRequest trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.
Body
application/json object ErrorResponse
Standard v2 error response wrapper.
Errorobject ErrorDetail requiredError detail containing a machine-readable code and human-readable message.
3 fields
Codestring requiredMachine-readable error code for programmatic handling.
Messagestring requiredHuman-readable error message.
Fieldsarray of object FieldErrorField-level validation errors. Only present for VALIDATION_ERROR responses.
4 fields
Fieldstring requiredName of the field that failed validation.
Messagestring requiredHuman-readable validation error message for this field.
CodestringMachine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.
Paramsmap of string to anyMachine-readable values the message is built from, such as limits or allowed values. Keys are PascalCase; which keys are present depends on Code. Optional.
Example response: A hotel already has a run in progress
{
"Error": {
"Code": "ALREADY_EXISTS",
"Message": "one or more hotels already have a text-generation run in progress"
}
}429 Too Many Requests
Too Many Requests. The response includes a Retry-After header with the number of seconds to wait before retrying.
Headers
X-Trace-IDstringRequest trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.
Retry-AfterintegerNumber of seconds to wait before retrying the request. Present on 429 responses.
Body
application/json object ErrorResponse
Standard v2 error response wrapper.
Errorobject ErrorDetail requiredError detail containing a machine-readable code and human-readable message.
3 fields
Codestring requiredMachine-readable error code for programmatic handling.
Messagestring requiredHuman-readable error message.
Fieldsarray of object FieldErrorField-level validation errors. Only present for VALIDATION_ERROR responses.
4 fields
Fieldstring requiredName of the field that failed validation.
Messagestring requiredHuman-readable validation error message for this field.
CodestringMachine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.
Paramsmap of string to anyMachine-readable values the message is built from, such as limits or allowed values. Keys are PascalCase; which keys are present depends on Code. Optional.
Example response: Limit exceeded
{
"Error": {
"Code": "RATE_LIMIT_EXCEEDED",
"Message": "Rate limit exceeded. Retry after the number of seconds in the Retry-After header."
}
}500 Internal Server Error
Internal Server Error - Unexpected server error. Include the X-Trace-ID header value when contacting support.
Headers
X-Trace-IDstringRequest trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.
Body
application/json object ErrorResponse
Standard v2 error response wrapper.
Errorobject ErrorDetail requiredError detail containing a machine-readable code and human-readable message.
3 fields
Codestring requiredMachine-readable error code for programmatic handling.
Messagestring requiredHuman-readable error message.
Fieldsarray of object FieldErrorField-level validation errors. Only present for VALIDATION_ERROR responses.
4 fields
Fieldstring requiredName of the field that failed validation.
Messagestring requiredHuman-readable validation error message for this field.
CodestringMachine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.
Paramsmap of string to anyMachine-readable values the message is built from, such as limits or allowed values. Keys are PascalCase; which keys are present depends on Code. Optional.
Example response: Internal server error
{
"Error": {
"Code": "INTERNAL_ERROR",
"Message": "Failed to create text-generation run"
}
}