---
title: "Save a run's result to the site: SEO texts into Yoast SEO / Rank Math (or the excerpt; includeTitle also sets the title), the chosen alt texts into the media library, or a draft whose automatic save failed"
method: POST
path: "/projects/{projectId}/wordpress/ai/runs/{runId}/apply"
tags: ["WordPress"]
---

# Save a run's result to the site: SEO texts into Yoast SEO / Rank Math (or the excerpt; includeTitle also sets the title), the chosen alt texts into the media library, or a draft whose automatic save failed

`POST /projects/{projectId}/wordpress/ai/runs/{runId}/apply`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/projects/{projectId}/wordpress/ai/runs/{runId}/apply`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

## Path parameters

- `projectId` string, uuid, required
- `runId` string, uuid, required

## Request body

- object
  - `attachmentIds` integer[]: Alt texts: apply only these images (default: all proposed)
  - `includeTitle` boolean: SEO without Yoast or Rank Math: also replace the page title with the SEO title (default false)

## Response `200`

Saved

- object
  - `id` string, uuid, required
  - `site` object, required
    - `kind` 'hosted' | 'external', required
    - `projectId` string, uuid, nullable, required
    - `connectionId` string, uuid, nullable, required
  - `task` 'write' | 'rewrite' | 'seo' | 'alt_text' | 'translate', required
  - `status` 'running' | 'ready' | 'applied' | 'failed', required
  - `item` object, nullable, required
    - `id` integer, required
    - `type` 'page' | 'post' | 'null', nullable, required
    - `title` string, nullable, required
  - `language` string, nullable, required
  - `output` union, required
    - object
      - `kind` 'content', required
      - `title` string, required
      - `excerpt` string, required
      - `preview` string, required: The start of the text, without markup
      - `characters` integer, required
    - object
      - `kind` 'seo', required
      - `title` string, required
      - `description` string, required
      - `target` 'yoast' | 'rankmath' | 'core', required
      - `current` object, required
        - `title` string, nullable, required
        - `description` string, nullable, required
    - object
      - `kind` 'alt_text', required
      - `images` object[], required
        - `attachmentId` integer, required
        - `filename` string, required
        - `title` string, required
        - `currentAlt` string, required
        - `alt` string, required
    - unknown
  - `draft` object, nullable, required
    - `postId` integer, required
    - `type` 'page' | 'post', required
    - `title` string, required
    - `status` string, required
    - `editUrl` string, nullable, required: wp-admin editor of the draft
    - `previewUrl` string, nullable, required: WordPress preview of the draft (needs a wp-admin login)
    - `updatedInPlace` boolean, required: true: an existing draft was updated (WordPress keeps the previous text as a revision); false: a new draft
  - `appliedAttachmentIds` integer[], required
  - `error` object, nullable, required
    - `code` string, required
    - `message` string, required
  - `applyError` string, nullable, required
  - `usage` object, required
    - `model` string, nullable, required
    - `inputTokens` integer, required
    - `outputTokens` integer, required
    - `cachedInputTokens` integer, required
    - `costMicros` integer, required: Model cost in micro-USD (1,000,000 = $1)
    - `millicredits` integer, required
    - `credits` number, required: Build Credits this run used
  - `createdAt` string, required: ISO-8601 timestamp
  - `finishedAt` string, nullable, required: ISO-8601 timestamp
  - `appliedAt` string, nullable, required: ISO-8601 timestamp
  - `createdBy` string, uuid, nullable, required

## Other responses

- `400`: Invalid request (code invalid_request)
- `401`: Missing or invalid session/token (code unauthorized)
- `402`: A paid add-on (code upgrade_required, details.feature) or no Build Credits left (code limit_reached)
- `403`: Authenticated but not permitted (code forbidden)
- `404`: Not found or not visible to the caller (code not_found)
- `409`: Conflicting state: a run is already running on the site, or the result was already saved (code conflict)
- `429`: Too many requests, or the AI assistant's daily capacity is used up (code rate_limited); see Retry-After
- `501`: No AI model, or no public API address for the site containers, on this server (code not_configured)
- `503`: The site or the model did not answer (code provider_unavailable)

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
