Update a knowledge base collection
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.ai.wpengine.com/v1/kb/collections/example"
payload := strings.NewReader("{ \"name\": \"Product docs\", \"description\": \"Product documentation, API reference guides, and release changelogs.\", \"metadata\": {} }")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.ai.wpengine.com/v1/kb/collections/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Product docs","description":"Product documentation, API reference guides, and release changelogs.","metadata":{}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PATCH', 'https://api.ai.wpengine.com/v1/kb/collections/example', [ 'body' => '{ "name": "Product docs", "description": "Product documentation, API reference guides, and release changelogs.", "metadata": {} }', 'headers' => [ 'Authorization' => 'Bearer <token>', 'Content-Type' => 'application/json', ],]);
echo $response->getBody();curl --request PATCH \ --url https://api.ai.wpengine.com/v1/kb/collections/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Product docs", "description": "Product documentation, API reference guides, and release changelogs.", "metadata": {} }'Updates a collection’s name, description, and/or metadata, scoped to the caller’s project. Omitted fields are preserved; description clears on null or empty string; metadata clears on null. Requires a valid WP Engine bearer token.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The collection ID.
Request Bodyrequired
Section titled “Request Bodyrequired”object
New collection name. Cannot be null. Must be unique within the project.
Example
Product docsDeprecated. Not used by the LLM search tool.
Example
Product documentation, API reference guides, and release changelogs.New structured metadata bag populated by the producer plugin during collection sync. The gateway consumes selected keys when composing the description of this collection’s search tool. When present, must be a JSON object no larger than 64 KB; any other JSON type is rejected with 400. Set to null to clear.
object
Responses
Section titled “Responses”The updated collection
object
Unique identifier for the collection.
The project the collection belongs to.
Human-readable collection name.
Deprecated. Not used by the LLM search tool.
When the collection was created (UTC).
When the collection was last updated (UTC).
Structured metadata bag populated by the producer plugin during collection sync. Omitted from the response when the collection has no metadata set.
object
Example
{ "name": "Product documentation", "description": "Product documentation, API reference guides, and release changelogs."}Invalid request body or parameters
object
object
Correlation ID for this request, matching the X-Request-ID response header — a 32-character trace ID behind the load balancer, otherwise a UUID. Quote it in support reports.
Example
{ "error": { "type": "invalid_request_error", "request_id": "80f1e2c3a4b5c6d7e8f9a0b1c2d3e4f5" }}Missing or invalid bearer token
object
object
Correlation ID for this request, matching the X-Request-ID response header — a 32-character trace ID behind the load balancer, otherwise a UUID. Quote it in support reports.
Example
{ "error": { "type": "invalid_request_error", "request_id": "80f1e2c3a4b5c6d7e8f9a0b1c2d3e4f5" }}Headers
Section titled “Headers”Example
Bearer realm="ai-services"The token is valid, but the caller is not permitted to perform this action — either its scope/permission is insufficient or the authenticated user is not authorized for the target account (error type “permission_error”). On /v1/chat/completions specifically, a 403 with error type “content_policy_violation” instead means the request content was blocked by content moderation policy; that response never identifies which filter or category matched.
object
object
Correlation ID for this request, matching the X-Request-ID response header — a 32-character trace ID behind the load balancer, otherwise a UUID. Quote it in support reports.
Example
{ "error": { "type": "invalid_request_error", "request_id": "80f1e2c3a4b5c6d7e8f9a0b1c2d3e4f5" }}The requested resource was not found
object
object
Correlation ID for this request, matching the X-Request-ID response header — a 32-character trace ID behind the load balancer, otherwise a UUID. Quote it in support reports.
Example
{ "error": { "type": "invalid_request_error", "request_id": "80f1e2c3a4b5c6d7e8f9a0b1c2d3e4f5" }}The request conflicts with an existing resource
object
object
Correlation ID for this request, matching the X-Request-ID response header — a 32-character trace ID behind the load balancer, otherwise a UUID. Quote it in support reports.
Example
{ "error": { "type": "invalid_request_error", "request_id": "80f1e2c3a4b5c6d7e8f9a0b1c2d3e4f5" }}Rate limit exceeded. The request was throttled at the edge; wait and retry later. The response body is a short HTML page generated by the load balancer, not a structured JSON error — clients should rely on the 429 status code rather than parsing the body.
The knowledge base is not currently available. Retry after a short delay.
object
object
Correlation ID for this request, matching the X-Request-ID response header — a 32-character trace ID behind the load balancer, otherwise a UUID. Quote it in support reports.
Example
{ "error": { "type": "invalid_request_error", "request_id": "80f1e2c3a4b5c6d7e8f9a0b1c2d3e4f5" }}