PATCH

Set Item Seo Tags


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Sets the SEO tags of a single item: its title tag, meta description, social share tags, canonical link, structured data, and robots meta tag (SEO Basics and Advanced SEO in the Wix Editor).

List the fields to change in fieldMask.

Setting tags replaces the item's tags in full, so send the complete set you want the item to have. To return the item to the tags it inherits, call Reset Item SEO Tags To Default rather than sending an empty list.

Whether the change reaches the live site immediately depends on the item type. Items that keep no separate draft, such as store products, are always live. Static pages keep a draft and a published version, so set publish to true to update the published one. A blog post that's already published stays published. Setting publish for an item type that keeps no draft has no effect.

For a static page, publish: true saves the changed fields to the draft first, then updates the existing published revision with the same payload. A later Editor publish retains these SEO changes when no intervening edit replaces them. Get and List read the saved revision; this response is not a rendered-page check.

On a headless site, a static page has one live version and no draft, so the change is live right away and publish has no effect. Its item ID is the one List Item SEO Tags returns (for example, {metaSiteId}_HOME for the home page); an editor page ID returns ITEM_NOT_FOUND.

Writes are last-write-wins. The two revisions are not an atomic transaction; concurrent writers can leave them different. Serialize conflicting item edits. This response represents the accepted payload; optional resolved tags are best-effort. If the site isn't published, the draft stays saved, the published revision isn't updated, and the call fails with SITE_NOT_PUBLISHED (FAILED_PRECONDITION): the change isn't live. Error data contains draftSaved: true, publicationStatus: NOT_PUBLISHED, and the savedItemIds. Publish the site to make the change live. If no published revision exists, the draft stays saved and the call fails with DRAFT_SAVED_NOT_PUBLISHED (FAILED_PRECONDITION). Error data contains draftSaved: true and the savedItemIds. This operation never publishes an entire site. Other publication failures also report that the draft saved. Unexpected failures report the saved item IDs and publicationStatus: UNKNOWN in their message; system errors do not expose application error data. For a static page on a site built in the Editor, before publishing a complete tags array read from the draft, establish that it also includes public-only tags using an authoritative Editor or live-page source. Otherwise this replacement can remove live tags that were absent from the draft.

Tags are validated before anything is saved, so a request that contains an invalid tag changes nothing. Tags are validated only when fieldMask includes tags: a request that sets only focusKeywords never fails with INVALID_TAGS. A tag sent back exactly as it's already saved skips the content checks and keeps its saved size, so you can resend the item's full tag list. It must still have string props values, and an extra copy of it is checked as a new tag. An application/ld+json tag with no content that names a preset in meta.schemaType also skips the content checks: Wix saves one for each built-in structured data preset that's switched on or off.

To set structured data, send a script tag with props.type set to application/ld+json and the JSON-LD in children, and leave custom unset. A rejected tag returns API error INVALID_TAGS, whose description lists findings such as TAG_TYPE_NOT_ALLOWED or INVALID_JSON. For TAG_TYPE_NOT_ALLOWED, check both custom and props.type. See Structured data.

Tags can currently be written only for the item's primary language: leave itemSeoTags.language unset. Sending a language fails with LANGUAGE_NOT_SUPPORTED, even when fieldMask doesn't name it.

To set the tags of many items in one call, call Bulk Set Item SEO Tags.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permission Scopes
Manage SEO Settings
Learn more about app permissions.
Endpoint
PATCH
https://www.wixapis.com/seo-metatags-server/v1/item-seo-tags/{itemType}/{itemId}

Errors
400Invalid Argument

There are 3 errors with this status code.

404Not Found

There is 1 error with this status code.

428Failed Precondition

There is 1 error with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Did this help?