API docs
Book a demo

Content Enrichment API / Text Generation

Generate text

Page

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-ID string (uuid) required

    Project UUID. Required for all project-scoped endpoints.

    Example
    $YGO_PROJECT_ID

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.

  • HotelIDs array 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.

    Example
    [
      "0192fb17-5dc6-7abc-8def-123456789abc",
      "0192fb18-6ed7-7abc-8def-223456789abc"
    ]
  • TagIDs array 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.

    Example
    [
      "0192fb40-7aa1-7abc-8def-aabbccddeeff"
    ]
  • TemplateKeys array of string

    Optional 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.

    Example
    [
      "Summary",
      "HouseRules"
    ]
  • Locales array of string

    Optional subset of BCP 47 language tags to generate. Empty means the locales configured on the matched templates (always including en-US).

    Example
    [
      "en-US",
      "de-DE"
    ]
  • RegenMode string

    Controls which texts are (re)generated. 'fill_missing' (the default) generates only missing or stale texts; 'full' regenerates every selected text.

    Values
    fill_missing full
    Default
    fill_missing
    Example
    fill_missing
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-ID string

    Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

    Example
    abc123def456ghi789

Body

application/json object GenerateTextResponse

Single-object response envelope wrapping the queued text-generation run.

  • Data object TextGenerationRun required

    A text-generation run with its own status and progress.

    8 fields
    • ID string (uuid) required

      Unique run UUID. Pass this to getTextGenerationStatus to poll the run.

      Example
      0192fb50-8bb2-7abc-8def-112233445566
    • Status string required

      Run lifecycle status. A freshly created run is 'queued'; it transitions to 'processing' while running, then to 'complete' or 'failed'.

      Values
      queued processing complete failed
      Example
      queued
    • Progress object RunProgress required

      Per-hotel progress counters for the run.

      4 fields
      • Total integer required

        Total number of hotels in the run.

        Example
        2
      • Generated integer required

        Number of hotels for which text has been generated so far.

        Example
        0
      • Failed integer required

        Number of hotels that failed processing.

        Example
        0
      • Skipped integer required

        Number of hotels skipped because they needed no work.

        Example
        0
    • ErrorMessage string

      Human-readable error message when the run has failed. Empty or omitted otherwise.

      Example
    • StartedAt string (date-time)

      Timestamp when the run started processing (RFC3339). Omitted until the run has started.

      Example
      2026-06-26T09:15:05Z
    • CompletedAt string (date-time)

      Timestamp when the run finished (RFC3339). Omitted until the run has finished.

      Example
      2026-06-26T09:17:30Z
    • CreatedAt string (date-time) required

      Timestamp when the run record was created (RFC3339).

      Example
      2026-06-26T09:15:00Z
    • UpdatedAt string (date-time) required

      Timestamp when the run record was last updated (RFC3339).

      Example
      2026-06-26T09:15:00Z
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-ID string

    Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

    Example
    abc123def456ghi789

Body

application/json object ErrorResponse

Standard v2 error response wrapper.

  • Error object ErrorDetail required

    Error detail containing a machine-readable code and human-readable message.

    3 fields
    • Code string required

      Machine-readable error code for programmatic handling.

      Example
      VALIDATION_ERROR
    • Message string required

      Human-readable error message.

      Example
      Request validation failed
    • Fields array of object FieldError

      Field-level validation errors. Only present for VALIDATION_ERROR responses.

      Each item

      A single field-level validation error.

      4 fields
      • Field string required

        Name of the field that failed validation.

        Example
        HotelIDs
      • Message string required

        Human-readable validation error message for this field.

        Example
        HotelIDs or TagIDs is required
      • Code string

        Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

        Values
        REQUIRED TOO_LONG TOO_SHORT OUT_OF_RANGE TOO_MANY INVALID_FORMAT NOT_ALLOWED CONFLICT INVALID_ENCODING INSECURE_SCHEME UNSAFE_CONTENT REQUIRED_WHEN_ENABLED
        Example
        TOO_LONG
      • Params map of string to any

        Machine-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
        {
          "Max": 100
        }
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-ID string

    Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

    Example
    abc123def456ghi789

Body

application/json object ErrorResponse

Standard v2 error response wrapper.

  • Error object ErrorDetail required

    Error detail containing a machine-readable code and human-readable message.

    3 fields
    • Code string required

      Machine-readable error code for programmatic handling.

      Example
      VALIDATION_ERROR
    • Message string required

      Human-readable error message.

      Example
      Request validation failed
    • Fields array of object FieldError

      Field-level validation errors. Only present for VALIDATION_ERROR responses.

      Each item

      A single field-level validation error.

      4 fields
      • Field string required

        Name of the field that failed validation.

        Example
        HotelIDs
      • Message string required

        Human-readable validation error message for this field.

        Example
        HotelIDs or TagIDs is required
      • Code string

        Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

        Values
        REQUIRED TOO_LONG TOO_SHORT OUT_OF_RANGE TOO_MANY INVALID_FORMAT NOT_ALLOWED CONFLICT INVALID_ENCODING INSECURE_SCHEME UNSAFE_CONTENT REQUIRED_WHEN_ENABLED
        Example
        TOO_LONG
      • Params map of string to any

        Machine-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
        {
          "Max": 100
        }
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-ID string

    Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

    Example
    abc123def456ghi789

Body

application/json object ErrorResponse

Standard v2 error response wrapper.

  • Error object ErrorDetail required

    Error detail containing a machine-readable code and human-readable message.

    3 fields
    • Code string required

      Machine-readable error code for programmatic handling.

      Example
      VALIDATION_ERROR
    • Message string required

      Human-readable error message.

      Example
      Request validation failed
    • Fields array of object FieldError

      Field-level validation errors. Only present for VALIDATION_ERROR responses.

      Each item

      A single field-level validation error.

      4 fields
      • Field string required

        Name of the field that failed validation.

        Example
        HotelIDs
      • Message string required

        Human-readable validation error message for this field.

        Example
        HotelIDs or TagIDs is required
      • Code string

        Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

        Values
        REQUIRED TOO_LONG TOO_SHORT OUT_OF_RANGE TOO_MANY INVALID_FORMAT NOT_ALLOWED CONFLICT INVALID_ENCODING INSECURE_SCHEME UNSAFE_CONTENT REQUIRED_WHEN_ENABLED
        Example
        TOO_LONG
      • Params map of string to any

        Machine-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
        {
          "Max": 100
        }
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-ID string

    Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

    Example
    abc123def456ghi789

Body

application/json object ErrorResponse

Standard v2 error response wrapper.

  • Error object ErrorDetail required

    Error detail containing a machine-readable code and human-readable message.

    3 fields
    • Code string required

      Machine-readable error code for programmatic handling.

      Example
      VALIDATION_ERROR
    • Message string required

      Human-readable error message.

      Example
      Request validation failed
    • Fields array of object FieldError

      Field-level validation errors. Only present for VALIDATION_ERROR responses.

      Each item

      A single field-level validation error.

      4 fields
      • Field string required

        Name of the field that failed validation.

        Example
        HotelIDs
      • Message string required

        Human-readable validation error message for this field.

        Example
        HotelIDs or TagIDs is required
      • Code string

        Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

        Values
        REQUIRED TOO_LONG TOO_SHORT OUT_OF_RANGE TOO_MANY INVALID_FORMAT NOT_ALLOWED CONFLICT INVALID_ENCODING INSECURE_SCHEME UNSAFE_CONTENT REQUIRED_WHEN_ENABLED
        Example
        TOO_LONG
      • Params map of string to any

        Machine-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
        {
          "Max": 100
        }
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-ID string

    Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

    Example
    abc123def456ghi789

Body

application/json object ErrorResponse

Standard v2 error response wrapper.

  • Error object ErrorDetail required

    Error detail containing a machine-readable code and human-readable message.

    3 fields
    • Code string required

      Machine-readable error code for programmatic handling.

      Example
      VALIDATION_ERROR
    • Message string required

      Human-readable error message.

      Example
      Request validation failed
    • Fields array of object FieldError

      Field-level validation errors. Only present for VALIDATION_ERROR responses.

      Each item

      A single field-level validation error.

      4 fields
      • Field string required

        Name of the field that failed validation.

        Example
        HotelIDs
      • Message string required

        Human-readable validation error message for this field.

        Example
        HotelIDs or TagIDs is required
      • Code string

        Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

        Values
        REQUIRED TOO_LONG TOO_SHORT OUT_OF_RANGE TOO_MANY INVALID_FORMAT NOT_ALLOWED CONFLICT INVALID_ENCODING INSECURE_SCHEME UNSAFE_CONTENT REQUIRED_WHEN_ENABLED
        Example
        TOO_LONG
      • Params map of string to any

        Machine-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
        {
          "Max": 100
        }
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-ID string

    Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

    Example
    abc123def456ghi789
  • Retry-After integer

    Number of seconds to wait before retrying the request. Present on 429 responses.

    Example
    30
    Limits
    min 1

Body

application/json object ErrorResponse

Standard v2 error response wrapper.

  • Error object ErrorDetail required

    Error detail containing a machine-readable code and human-readable message.

    3 fields
    • Code string required

      Machine-readable error code for programmatic handling.

      Example
      VALIDATION_ERROR
    • Message string required

      Human-readable error message.

      Example
      Request validation failed
    • Fields array of object FieldError

      Field-level validation errors. Only present for VALIDATION_ERROR responses.

      Each item

      A single field-level validation error.

      4 fields
      • Field string required

        Name of the field that failed validation.

        Example
        HotelIDs
      • Message string required

        Human-readable validation error message for this field.

        Example
        HotelIDs or TagIDs is required
      • Code string

        Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

        Values
        REQUIRED TOO_LONG TOO_SHORT OUT_OF_RANGE TOO_MANY INVALID_FORMAT NOT_ALLOWED CONFLICT INVALID_ENCODING INSECURE_SCHEME UNSAFE_CONTENT REQUIRED_WHEN_ENABLED
        Example
        TOO_LONG
      • Params map of string to any

        Machine-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
        {
          "Max": 100
        }
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-ID string

    Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

    Example
    abc123def456ghi789

Body

application/json object ErrorResponse

Standard v2 error response wrapper.

  • Error object ErrorDetail required

    Error detail containing a machine-readable code and human-readable message.

    3 fields
    • Code string required

      Machine-readable error code for programmatic handling.

      Example
      VALIDATION_ERROR
    • Message string required

      Human-readable error message.

      Example
      Request validation failed
    • Fields array of object FieldError

      Field-level validation errors. Only present for VALIDATION_ERROR responses.

      Each item

      A single field-level validation error.

      4 fields
      • Field string required

        Name of the field that failed validation.

        Example
        HotelIDs
      • Message string required

        Human-readable validation error message for this field.

        Example
        HotelIDs or TagIDs is required
      • Code string

        Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

        Values
        REQUIRED TOO_LONG TOO_SHORT OUT_OF_RANGE TOO_MANY INVALID_FORMAT NOT_ALLOWED CONFLICT INVALID_ENCODING INSECURE_SCHEME UNSAFE_CONTENT REQUIRED_WHEN_ENABLED
        Example
        TOO_LONG
      • Params map of string to any

        Machine-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
        {
          "Max": 100
        }
Example response: Internal server error
{
  "Error": {
    "Code": "INTERNAL_ERROR",
    "Message": "Failed to create text-generation run"
  }
}