> This page is for version v4.0.
> For other versions, use one of these documentation indexes:
> - v5.0 (default): https://humanloop.com/docs/v5/llms.txt
> - v4.0: https://humanloop.com/docs/v4/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://humanloop.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://humanloop.com/docs/_mcp/server.

# Update

PATCH https://api.humanloop.com/v4/datapoints/{id}

Edit the input, messages and criteria fields of a datapoint.

WARNING: This endpoint has been decommissioned and no longer works. Please use the v5 datasets API instead.

Reference: https://humanloop.com/docs/v4/api/datapoints/update

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Path parameters

- `id` (string, required) — String ID of datapoint.

## Response

### 200

Successful Response

- `id` (string, required)
- `dataset_id` (string, optional)
- `inputs` (map from string to string, optional)
- `messages` (list of ChatMessageWithToolCall, optional)
- `target` (map from string to DatapointResponseTargetValue, optional)

## Errors

### 422 Datapoints Update Request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ChatMessageWithToolCall

- `role` (enum, required) — Role of the message author.
  - Allowed values: `user`, `assistant`, `system`, `tool`, `developer`
- `content` (Content, optional) — The content of the message.
- `name` (string, optional) — Optional name of the message author.
- `tool_call_id` (string, optional) — Tool call that this message is responding to.
- `tool_calls` (list of ToolCall, optional) — A list of tool calls requested by the assistant.
- `thinking` (list of ChatMessageWithToolCallThinkingItem, optional) — Model's chain-of-thought for providing the response. Present on assistant messages if model supports it.
- `tool_call` (FunctionTool, optional, deprecated) — NB: Deprecated in favour of tool_calls. A tool call requested by the assistant.

### DatapointResponseTargetValue

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### Content

The content of the message.

### ToolCall

A tool call to be made.

- `id` (string, required)
- `type` ("function", required) — The type of tool to call.
- `function` (FunctionTool, required) — A function tool to be called by the model where user owns runtime.

### ChatMessageWithToolCallThinkingItem

- `type`: `thinking`
  - `signature` (string, required) — Cryptographic signature that verifies the thinking block was generated by Anthropic.
  - `thinking` (string, required) — Model's chain-of-thought for providing the response.
- `type`: `redacted_thinking`
  - `data` (string, required) — Thinking block Anthropic redacted for safety reasons. User is expected to pass the block back to Anthropic

### FunctionTool

A function tool to be called by the model where user owns runtime.

- `name` (string, required)
- `arguments` (string, optional)

### ValidationErrorLocItem

## Examples

**Response**

```json
{
  "id": "id",
  "dataset_id": "dataset_id",
  "inputs": {
    "key": "value"
  },
  "messages": [
    {
      "role": "user",
      "content": "content",
      "name": "name",
      "tool_call_id": "tool_call_id",
      "tool_calls": [
        {
          "id": "id",
          "type": "function",
          "function": {
            "name": "name"
          }
        }
      ],
      "thinking": [
        {
          "type": "thinking",
          "signature": "signature",
          "thinking": "thinking"
        }
      ],
      "tool_call": {
        "name": "name"
      }
    }
  ],
  "target": {
    "key": "value"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.humanloop.com/v4/datapoints/id"

headers = {"X-API-KEY": "<apiKey>"}

response = requests.patch(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.humanloop.com/v4/datapoints/id';
const options = {method: 'PATCH', headers: {'X-API-KEY': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.humanloop.com/v4/datapoints/id"

	req, _ := http.NewRequest("PATCH", url, nil)

	req.Header.Add("X-API-KEY", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.humanloop.com/v4/datapoints/id")

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

request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.humanloop.com/v4/datapoints/id")
  .header("X-API-KEY", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.humanloop.com/v4/datapoints/id', [
  'headers' => [
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.humanloop.com/v4/datapoints/id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("X-API-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-KEY": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.humanloop.com/v4/datapoints/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```