> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wistx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Document Metadata

> Update document metadata (name, description, tags) without re-indexing

> Update document metadata (name, description, tags) without re-indexing

<CodeGroup>
  ```bash cURL theme={null}
  curl --request PUT \
    --url https://api.wistx.ai/v1/indexing/documents/res_abc123 \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "name": "Updated Document Name",
      "description": "Updated description",
      "tags": ["updated", "tag"]
    }'
  ```

  ```python Python theme={null}
  import requests

  api_key = "YOUR_API_KEY"
  resource_id = "res_abc123"

  response = requests.put(
      f"https://api.wistx.ai/v1/indexing/documents/{resource_id}",
      headers={
          "Authorization": f"Bearer {api_key}",
          "Content-Type": "application/json"
      },
      json={
          "name": "Updated Document Name",
          "description": "Updated description",
          "tags": ["updated", "tag"]
      }
  )

  resource = response.json()
  print(f"Updated: {resource['name']}")
  ```

  ```javascript JavaScript theme={null}
  const apiKey = "YOUR_API_KEY";
  const resourceId = "res_abc123";

  const response = await fetch(
    `https://api.wistx.ai/v1/indexing/documents/${resourceId}`,
    {
      method: "PUT",
      headers: {
        Authorization: `Bearer ${apiKey}`,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        name: "Updated Document Name",
        description: "Updated description",
        tags: ["updated", "tag"]
      })
    }
  );

  const resource = await response.json();
  console.log(`Updated: ${resource.name}`);
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "net/http"
  )

  func main() {
      apiKey := "YOUR_API_KEY"
      resourceID := "res_abc123"
      url := fmt.Sprintf("https://api.wistx.ai/v1/indexing/documents/%s", resourceID)

      payload := map[string]interface{}{
          "name": "Updated Document Name",
          "description": "Updated description",
          "tags": []string{"updated", "tag"},
      }

      jsonData, _ := json.Marshal(payload)
      req, _ := http.NewRequest("PUT", url, bytes.NewBuffer(jsonData))
      req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apiKey))
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()

      var resource map[string]interface{}
      json.NewDecoder(resp.Body).Decode(&resource)
      fmt.Printf("Updated: %v\n", resource["name"])
  }
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'
  require 'uri'

  api_key = "YOUR_API_KEY"
  resource_id = "res_abc123"
  url = URI("https://api.wistx.ai/v1/indexing/documents/#{resource_id}")

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true

  request = Net::HTTP::Put.new(url)
  request["Authorization"] = "Bearer #{api_key}"
  request["Content-Type"] = "application/json"
  request.body = {
    name: "Updated Document Name",
    description: "Updated description",
    tags: ["updated", "tag"]
  }.to_json

  response = http.request(request)
  resource = JSON.parse(response.body)
  puts "Updated: #{resource['name']}"
  ```

  ```php PHP theme={null}
  <?php

  $apiKey = "YOUR_API_KEY";
  $resourceId = "res_abc123";
  $url = "https://api.wistx.ai/v1/indexing/documents/" . $resourceId;

  $data = [
      "name" => "Updated Document Name",
      "description" => "Updated description",
      "tags" => ["updated", "tag"]
  ];

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer " . $apiKey,
      "Content-Type: application/json"
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  $resource = json_decode($response, true);
  echo "Updated: " . $resource['name'];
  ```

  ```java Java theme={null}
  import java.net.HttpURLConnection;
  import java.net.URL;
  import java.io.OutputStream;
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import com.google.gson.Gson;
  import com.google.gson.JsonObject;

  public class UpdateDocumentMetadata {
      public static void main(String[] args) throws Exception {
          String apiKey = "YOUR_API_KEY";
          String resourceId = "res_abc123";
          URL url = new URL("https://api.wistx.ai/v1/indexing/documents/" + resourceId);
          
          HttpURLConnection conn = (HttpURLConnection) url.openConnection();
          conn.setRequestMethod("PUT");
          conn.setRequestProperty("Authorization", "Bearer " + apiKey);
          conn.setRequestProperty("Content-Type", "application/json");
          conn.setDoOutput(true);
          
          JsonObject payload = new JsonObject();
          payload.addProperty("name", "Updated Document Name");
          payload.addProperty("description", "Updated description");
          
          Gson gson = new Gson();
          String[] tags = {"updated", "tag"};
          payload.add("tags", gson.toJsonTree(tags));
          
          try (OutputStream os = conn.getOutputStream()) {
              byte[] input = gson.toJson(payload).getBytes("utf-8");
              os.write(input, 0, input.length);
          }
          
          BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
          StringBuilder response = new StringBuilder();
          String responseLine;
          while ((responseLine = br.readLine()) != null) {
              response.append(responseLine.trim());
          }
          System.out.println(response.toString());
      }
  }
  ```
</CodeGroup>

## Path Parameters

<ParamField path="resource_id" type="string" required>
  Resource ID of the document to update.
</ParamField>

## Request Parameters

<ParamField body="name" type="string">
  Updated document name.
</ParamField>

<ParamField body="description" type="string">
  Updated document description.
</ParamField>

<ParamField body="tags" type="array[string]">
  Updated tags array.
</ParamField>

## Response

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "resource_id": "res_abc123",
    "resource_type": "document",
    "name": "Updated Document Name",
    "description": "Updated description",
    "tags": ["updated", "tag"],
    "status": "completed",
    "updated_at": "2024-01-15T10:30:00Z"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "Invalid request parameters",
      "details": null
    },
    "metadata": {
      "request_id": "req_abc123",
      "timestamp": 1704067200.0
    }
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "detail": "User ID not found"
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "detail": "Resource not found or access denied"
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "error": {
      "code": "UPDATE_ERROR",
      "message": "Failed to update document metadata",
      "details": null
    },
    "metadata": {
      "request_id": "req_abc123",
      "timestamp": 1704067200.0
    }
  }
  ```
</ResponseExample>

## Related Endpoints

* [Replace Document Content](/api-reference/indexing/replace-document-content) - Replace document content
* [Re-index Document](/api-reference/indexing/reindex-document) - Re-index document
* [Get Resource Status](/api-reference/indexing/resource-status) - Check resource status


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.