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

# Update Goal

> Sets or updates the goal definition for a digital employee.

### **Code Examples**

<CodeGroup>
  ```http cURL theme={null}
  curl --request PUT \
    --url 'https://api.tess.im/digital-employees/123/goal' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'x-workspace-id: 10' \
    --header 'Content-Type: application/json' \
    --data '{
      "title": "Increase Q3 revenue by 15%",
      "description": "Monitor and report on key revenue metrics weekly.",
      "success_criteria": "Revenue reaches $1.5M by September 30",
      "status": "active"
    }'
  ```

  ```json Node.js theme={null}
  const axios = require('axios');

  const config = {
    method: 'put',
    url: 'https://api.tess.im/digital-employees/123/goal',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'x-workspace-id': '10',
      'Content-Type': 'application/json'
    },
    data: {
      title: 'Increase Q3 revenue by 15%',
      description: 'Monitor and report on key revenue metrics weekly.',
      success_criteria: 'Revenue reaches $1.5M by September 30',
      status: 'active'
    }
  };

  try {
    const response = await axios(config);
    console.log(response.data);
  } catch (error) {
    console.error(error);
  }
  ```

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

  url = "https://api.tess.im/digital-employees/123/goal"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "x-workspace-id": "10",
      "Content-Type": "application/json"
  }
  payload = {
      "title": "Increase Q3 revenue by 15%",
      "description": "Monitor and report on key revenue metrics weekly.",
      "success_criteria": "Revenue reaches $1.5M by September 30",
      "status": "active"
  }

  response = requests.put(url, headers=headers, json=payload)
  print(response.json())
  ```

  ```php PHP theme={null}
  <?php
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.tess.im/digital-employees/123/goal",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_POSTFIELDS => json_encode([
      "title" => "Increase Q3 revenue by 15%",
      "description" => "Monitor and report on key revenue metrics weekly.",
      "success_criteria" => "Revenue reaches \$1.5M by September 30",
      "status" => "active"
    ]),
    CURLOPT_HTTPHEADER => [
      "Authorization: Bearer YOUR_API_KEY",
      "x-workspace-id: 10",
      "Content-Type: application/json"
    ]
  ]);

  $response = curl_exec($curl);
  curl_close($curl);
  echo $response;
  ```

  ```java Java theme={null}
  import java.net.URI;
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;

  String body = """
      {
        "title": "Increase Q3 revenue by 15%",
        "description": "Monitor and report on key revenue metrics weekly.",
        "success_criteria": "Revenue reaches $1.5M by September 30",
        "status": "active"
      }
      """;

  HttpClient client = HttpClient.newHttpClient();
  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://api.tess.im/digital-employees/123/goal"))
      .header("Authorization", "Bearer YOUR_API_KEY")
      .header("x-workspace-id", "10")
      .header("Content-Type", "application/json")
      .PUT(HttpRequest.BodyPublishers.ofString(body))
      .build();

  HttpResponse<String> response = client.send(request,
      HttpResponse.BodyHandlers.ofString());
  System.out.println(response.body());
  ```

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

  import (
      "fmt"
      "io/ioutil"
      "net/http"
      "strings"
  )

  func main() {
      payload := strings.NewReader(`{
          "title": "Increase Q3 revenue by 15%",
          "description": "Monitor and report on key revenue metrics weekly.",
          "success_criteria": "Revenue reaches $1.5M by September 30",
          "status": "active"
      }`)

      client := &http.Client{}
      req, _ := http.NewRequest("PUT", "https://api.tess.im/digital-employees/123/goal", payload)
      req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
      req.Header.Add("x-workspace-id", "10")
      req.Header.Add("Content-Type", "application/json")
      resp, _ := client.Do(req)
      defer resp.Body.Close()
      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```jsonnet .NET theme={null}
  using System.Net.Http;
  using System.Text;

  using var client = new HttpClient();
  client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
  client.DefaultRequestHeaders.Add("x-workspace-id", "10");

  var json = """
      {
        "title": "Increase Q3 revenue by 15%",
        "description": "Monitor and report on key revenue metrics weekly.",
        "success_criteria": "Revenue reaches $1.5M by September 30",
        "status": "active"
      }
      """;

  var content = new StringContent(json, Encoding.UTF8, "application/json");
  var response = await client.PutAsync("https://api.tess.im/digital-employees/123/goal", content);
  Console.WriteLine(await response.Content.ReadAsStringAsync());
  ```

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

  uri = URI('https://api.tess.im/digital-employees/123/goal')
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Put.new(uri)
  request['Authorization'] = 'Bearer YOUR_API_KEY'
  request['x-workspace-id'] = '10'
  request['Content-Type'] = 'application/json'
  request.body = {
    title: 'Increase Q3 revenue by 15%',
    description: 'Monitor and report on key revenue metrics weekly.',
    success_criteria: 'Revenue reaches $1.5M by September 30',
    status: 'active'
  }.to_json

  response = http.request(request)
  puts response.read_body
  ```
</CodeGroup>

### **Headers**

<Note>
  Include your API key in the `Authorization` header as `Bearer YOUR_API_KEY` on all requests.
</Note>

<ParamField header="x-workspace-id" type="integer" required>
  ID of the workspace. Required for all Digital Employees API requests.
</ParamField>

### **Path Parameters**

<ParamField path="employeeId" type="integer" required>
  The unique identifier of the digital employee.
</ParamField>

### **Body Parameters**

<ParamField body="title" type="string" required>
  Goal title. Max 500 characters.
</ParamField>

<ParamField body="description" type="string">
  Detailed goal description. Max 2000 characters.
</ParamField>

<ParamField body="success_criteria" type="string">
  Measurable criteria for goal completion. Max 1000 characters.
</ParamField>

<ParamField body="status" type="string">
  Goal status. Accepted values: `planned`, `active`, `achieved`, `cancelled`.
</ParamField>

### **Response**

```json theme={null}
{
  "data": {
    "id": 123,
    "name": "Finance Ops",
    "goal_json": {
      "title": "Increase Q3 revenue by 15%",
      "description": "Monitor and report on key revenue metrics weekly.",
      "success_criteria": "Revenue reaches $1.5M by September 30",
      "status": "active"
    }
  }
}
```
