Skip to navigation

Update contract metadata

View as Markdown

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.

Authentication

Authorizationstring
API Key authentication via header

Path parameters

idstringRequired
Contract Id

Request

This endpoint expects an object.
metadatamap from strings to anyRequired

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

The contract's metadata after the merge
payloadobject
Response payload, will be empty when success is false
successboolean

Boolean with true=success, false=failure

messagestring

Plain-text description of the result

errorobjectOptional
json element with any error messages or warnings

Errors

400
Bad Request Error
404
Not Found Error