---
title: "Update an object"
---

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

# Update an object

Path: CloudRaker Workspace API › Data Objects

`PATCH /spaces/{spaceId}/objects/{definitionId}/{objectId}`

Partially updates an object. Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (no `space:read` → 404). Body: `{ data?, unset?, fieldMeta? }` — `data` merges field values, `unset` clears the named field keys, `fieldMeta` sets `source`/`locked` per key (and can lock/unlock without writing). A `fieldMeta`-locked **or** review-approved/rejected field refuses a write/unset with 409 `field_locked` (unless the `fieldMeta` lock is cleared in the same request; a review-lock must be dismissed via the review routes first). Unique collision → 409 `duplicate_value`, invalid data → 422, unknown object → 404. A human edit clears that field's `provenance`. Returns `{ object }`.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `spaceId` (`updateObject.path.spaceId`; string, required)
- `definitionId` (`updateObject.path.definitionId`; string, required)
- `objectId` (`updateObject.path.objectId`; string, required)

## Request body

_Required._

- `data` (`updateObject.data`; map<unknown>, optional) — Field values to merge.
- `unset` (`updateObject.unset`; array<string>, optional) — Field keys to clear.
- `fieldMeta` (`updateObject.fieldMeta`; map<map<unknown>>, optional) — May lock or unlock a field without writing a value.

## Example request

```json
{
  "data": {
    "property1": null,
    "property2": null
  },
  "unset": [
    "string"
  ],
  "fieldMeta": {
    "property1": {
      "property1": null,
      "property2": null
    },
    "property2": {
      "property1": null,
      "property2": null
    }
  }
}
```

## Code samples

### cURL

```bash
curl --request PATCH \
  --url 'https://api.cloudraker.com/spaces/<spaceId>/objects/<definitionId>/<objectId>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "data": {
    "property1": null,
    "property2": null
  },
  "unset": [
    "string"
  ],
  "fieldMeta": {
    "property1": {
      "property1": null,
      "property2": null
    },
    "property2": {
      "property1": null,
      "property2": null
    }
  }
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/spaces/<spaceId>/objects/<definitionId>/<objectId>';
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    data: {property1: null, property2: null},
    unset: ['string'],
    fieldMeta: {
      property1: {property1: null, property2: null},
      property2: {property1: null, property2: null}
    }
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/spaces/<spaceId>/objects/<definitionId>/<objectId>"

payload = {
    "data": {
        "property1": None,
        "property2": None
    },
    "unset": ["string"],
    "fieldMeta": {
        "property1": {
            "property1": None,
            "property2": None
        },
        "property2": {
            "property1": None,
            "property2": None
        }
    }
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

The updated object.

#### Example

```json
{
  "object": {
    "_id": "string",
    "spaceId": "string",
    "definitionId": "string",
    "definitionVersion": 0,
    "data": {
      "property1": null,
      "property2": null
    },
    "fieldMeta": {
      "property1": {
        "modifiedBy": "string",
        "modifiedAt": "2019-08-24T14:15:22Z",
        "source": "string",
        "locked": true
      },
      "property2": {
        "modifiedBy": "string",
        "modifiedAt": "2019-08-24T14:15:22Z",
        "source": "string",
        "locked": true
      }
    },
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "createdBy": "string",
    "updatedBy": "string",
    "deletedAt": "2019-08-24T14:15:22Z",
    "provenance": {
      "property1": [
        {
          "property1": null,
          "property2": null
        }
      ],
      "property2": [
        {
          "property1": null,
          "property2": null
        }
      ]
    },
    "review": {
      "property1": {
        "status": "pending",
        "by": "string",
        "at": "2019-08-24T14:15:22Z",
        "note": "string"
      },
      "property2": {
        "status": "pending",
        "by": "string",
        "at": "2019-08-24T14:15:22Z",
        "note": "string"
      }
    },
    "origin": {
      "actionRunId": "string",
      "playbookRunId": "string"
    }
  }
}
```

- `object` (`updateObject.response.200.object`; object, required)
  - `_id` (`updateObject.response.200.object._id`; string, required)
  - `spaceId` (`updateObject.response.200.object.spaceId`; string, required)
  - `definitionId` (`updateObject.response.200.object.definitionId`; string, required)
  - `definitionVersion` (`updateObject.response.200.object.definitionVersion`; number, required)
  - `data` (`updateObject.response.200.object.data`; map<unknown>, required) — Field values keyed by field key.
  - `fieldMeta` (`updateObject.response.200.object.fieldMeta`; map<object>, required)
  - `createdAt` (`updateObject.response.200.object.createdAt`; string, required)
    - format `date-time`; pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
  - `updatedAt` (`updateObject.response.200.object.updatedAt`; string, required)
    - format `date-time`; pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
  - `createdBy` (`updateObject.response.200.object.createdBy`; string, required)
  - `updatedBy` (`updateObject.response.200.object.updatedBy`; string, required)
  - `deletedAt` (`updateObject.response.200.object.deletedAt`; any of, required)
    - any of: `string`, `null`
  - `provenance` (`updateObject.response.200.object.provenance`; map<array<map<unknown>>>, optional) — Per-field grounding: field key → citation pointers, imported verbatim from the extraction feed.
  - `review` (`updateObject.response.200.object.review`; map<object>, optional) — Per-field review state. An approved or rejected field is locked against edits.
  - `origin` (`updateObject.response.200.object.origin`; object, optional) — Set on create, never patchable.
    - `actionRunId` (`updateObject.response.200.object.origin.actionRunId`; string, optional)
    - `playbookRunId` (`updateObject.response.200.object.origin.playbookRunId`; string, optional) — Set only when a playbook dispatched the run; callers cannot claim it.

### 403

Missing `space:contribute`.

### 404

No such object (or missing `space:read`).

### 409

`field_locked` (locked/review-locked field) or `duplicate_value`.

### 422

`validation_failed` — the merged data fails the schema.


Source: https://docs.cloudraker.com/workspace/api/data-objects/update-object/index.md
