> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.tabs.com/api-reference/contracts/integrators-api-contractsv-3-controller-update-contract-metadata/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 Updates a contract's metadata by merging the provided top-level keys with the existing metadata. Providing a value sets or replaces that key. Providing `null` removes the key. Keys omitted from the request are left unchanged. The merge is shallow: if a value is an object, it replaces the existing value for that key rather than merging recursively. Nested `null` values are stored as part of the object and do not remove nested keys. Removing a key that does not exist succeeds without changing the metadata. If all keys are removed, the metadata becomes an empty object (`{}`). To clear metadata entirely and set it back to `null`, use `DELETE` on this endpoint. The resulting metadata may not exceed 16KB when serialized as UTF-8 JSON. The limit applies after the update is merged, not to the request payload by itself. Requests that would exceed the limit return `400`. Requests that only remove keys are always allowed. This endpoint only accesses contracts belonging to the authenticated merchant. Requests for contracts owned by another merchant return `404`. Reference: https://docs.tabs.com/api-reference/contracts/integrators-api-contractsv-3-controller-update-contract-metadata ## Authentication - `Authorization` header (required) — API Key authentication via header ## Request ### Path parameters - `id` (string, required) — Contract Id ### Body (application/json) This endpoint expects an UpdateContractMetadataDto. - `metadata` (map from string to any, required) — Metadata keys to add, update, or remove. Providing a value sets or replaces the corresponding top-level key. Providing `null` removes the key. Keys omitted from the request are left unchanged. Objects are replaced as a whole rather than merged recursively. The resulting metadata may not exceed 16KB of UTF-8 encoded JSON; the limit is checked against the merged result, not against this payload on its own. ## Response ### 200 The contract's metadata after the merge - `payload` (V3ContractsIdMetadataPatchResponsesContentApplicationJsonSchemaPayload, 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` (IntegratorsApiError, optional) — json element with any error messages or warnings ## Errors ### 400 Bad Request Error Invalid request body, or the merged metadata would exceed the 16KB limit - `any` ### 404 Not Found Error Contract not found - `any` ## Types ### V3ContractsIdMetadataPatchResponsesContentApplicationJsonSchemaPayload Response payload, will be empty when success is false ### IntegratorsApiError - `code` (double, required) — API response code - `message` (string, required) — API response message - `details` (IntegratorsApiErrorDetails, optional) — Additional details about the error ### IntegratorsApiErrorDetails 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": "", "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: '', '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", "") 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"] = '' 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 response = Unirest.patch("https://integrators.prod.api.tabsplatform.com/v3/contracts/123e4567-e89b-12d3-a456-426614174000/metadata") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"metadata\": {\n \"renewalOwner\": \"ops@example.com\",\n \"region\": \"EMEA\",\n \"legacyCode\": null\n }\n}") .asString(); ``` ```php 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' => '', '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", ""); 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": "", "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() ```