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

# Update contract metadata

PATCH https://integrators.prod.api.tabsplatform.com/v3/contracts/{id}/metadata
Content-Type: application/json

Merges the keys you send into the contract's existing metadata, following JSON Merge Patch (RFC 7386) at the top level. A key with a value overwrites whatever is stored under that key; a key set to `null` removes it; a key you leave out of the payload is preserved. Removing a key that does not exist succeeds and changes nothing, so the same request can be replayed safely.

Only top-level `null`s delete. The merge is shallow — sending an object as a value replaces the stored value outright rather than merging into it — so a `null` inside a nested object is stored as part of that object, not treated as a deletion.

Removing every remaining key leaves an empty object, not null. Use DELETE on this path to clear the metadata back to null. Scoped to the authenticated merchant: a contract belonging to another merchant returns 404.

The stored metadata is capped at 16KB, measured as the UTF-8 byte length of its JSON serialization. The cap applies to the merged result rather than to the request body, so a payload that is small on its own is still rejected with 400 if it would push the stored document over; the error names the attempted size. A request that only removes keys is always accepted, so metadata that is already over the cap can be brought back under it.

Reference: https://docs.tabs.com/api-reference/contracts/integrators-api-contractsv-3-controller-update-contract-metadata

## Authentication

- `Authorization` header (required)

## Request

### Path parameters

- `id` (string, required) — Contract Id

### Body (application/json)

- `metadata` (map from string to any, required) — Keys to merge into the contract's existing metadata. A key with a value overwrites the existing key; a key set to `null` removes it; a key you leave out is preserved. Removing a key that is not there succeeds and changes nothing. Only top-level `null`s delete — a `null` inside a nested object is stored as part of that object's value. The merged document may not exceed 16KB of UTF-8 encoded JSON; the limit is checked against the merge result, not against this payload on its own.

## Response

### 200

The contract's metadata after the merge

- `payload` (object, required) — Response payload, will be empty when success is false
- `success` (boolean, required) — Boolean with true=success, false=failure
- `message` (string, required) — Plain-text description of the result
- `error` (object, optional) — json element with any error messages or warnings
  - `code` (double, required) — API response code
  - `message` (string, required) — API response message
  - `details` (object, optional) — Additional details about the error

## Examples

**Request**

```json
{
  "metadata": {
    "renewalOwner": "ops@example.com",
    "region": "EMEA",
    "legacyCode": null
  }
}
```

**Response**

```json
{
  "payload": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "metadata": {
      "renewalOwner": "ops@example.com",
      "region": "EMEA"
    }
  },
  "success": true,
  "message": "string",
  "error": {
    "code": 1.1,
    "message": "string",
    "details": {}
  }
}
```

**SDK Code**

```python
import requests

url = "https://integrators.prod.api.tabsplatform.com/v3/contracts/123e4567-e89b-12d3-a456-426614174000/metadata"

payload = { "metadata": {
        "renewalOwner": "ops@example.com",
        "region": "EMEA",
        "legacyCode": None
    } }
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://integrators.prod.api.tabsplatform.com/v3/contracts/123e4567-e89b-12d3-a456-426614174000/metadata';
const options = {
  method: 'PATCH',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"metadata":{"renewalOwner":"ops@example.com","region":"EMEA","legacyCode":null}}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://integrators.prod.api.tabsplatform.com/v3/contracts/123e4567-e89b-12d3-a456-426614174000/metadata"

	payload := strings.NewReader("{\n  \"metadata\": {\n    \"renewalOwner\": \"ops@example.com\",\n    \"region\": \"EMEA\",\n    \"legacyCode\": null\n  }\n}")

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

	req.Header.Add("Authorization", "<apiKey>")
	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))

}
```

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

url = URI("https://integrators.prod.api.tabsplatform.com/v3/contracts/123e4567-e89b-12d3-a456-426614174000/metadata")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"metadata\": {\n    \"renewalOwner\": \"ops@example.com\",\n    \"region\": \"EMEA\",\n    \"legacyCode\": null\n  }\n}"

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://integrators.prod.api.tabsplatform.com/v3/contracts/123e4567-e89b-12d3-a456-426614174000/metadata")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"metadata\": {\n    \"renewalOwner\": \"ops@example.com\",\n    \"region\": \"EMEA\",\n    \"legacyCode\": null\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://integrators.prod.api.tabsplatform.com/v3/contracts/123e4567-e89b-12d3-a456-426614174000/metadata', [
  'body' => '{
  "metadata": {
    "renewalOwner": "ops@example.com",
    "region": "EMEA",
    "legacyCode": null
  }
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://integrators.prod.api.tabsplatform.com/v3/contracts/123e4567-e89b-12d3-a456-426614174000/metadata");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"metadata\": {\n    \"renewalOwner\": \"ops@example.com\",\n    \"region\": \"EMEA\",\n    \"legacyCode\": null\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["metadata": [
    "renewalOwner": "ops@example.com",
    "region": "EMEA",
    "legacyCode": 
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://integrators.prod.api.tabsplatform.com/v3/contracts/123e4567-e89b-12d3-a456-426614174000/metadata")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```