---
title: "Archive (or purge) a data-object definition"
---

> 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.

# Archive (or purge) a data-object definition

Path: CloudRaker Workspace API › Data Objects

`DELETE /objects/definitions/{definitionId}`

Soft-archives a definition. Authorization: organization administrators only — other callers get 403. Query: `purge=true` forces removal even when live objects exist; without it, a definition that still has live objects returns 409 `objects_exist` (with `count`). Unknown id → 404. Returns the archived `{ definition }`.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `definitionId` (`deleteObjectDefinition.path.definitionId`; string, required)

## Query parameters

- `purge` (`deleteObjectDefinition.query.purge`; string, optional) — Pass `true` to archive even when live objects still exist (they are left untouched).
  - one of `"true"`, `"false"`

## Code samples

### cURL

```bash
curl --request DELETE \
  --url 'https://api.cloudraker.com/objects/definitions/<definitionId>' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/objects/definitions/<definitionId>';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

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/objects/definitions/<definitionId>"

headers = {"Authorization": "Bearer <token>"}

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

print(response.text)
```

## Responses

### 200

The archived definition.

#### Example

```json
{
  "definition": {
    "_id": "def_contract",
    "nameSingular": "contract",
    "namePlural": "contracts",
    "labelSingular": "Contract",
    "labelPlural": "Contracts",
    "description": "string",
    "icon": "string",
    "color": "string",
    "labelFieldKey": "string",
    "fields": [
      {
        "property1": null,
        "property2": null
      }
    ],
    "fieldGroups": [
      {
        "property1": null,
        "property2": null
      }
    ],
    "version": 0,
    "archivedAt": "2019-08-24T14:15:22Z",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "createdBy": "string"
  }
}
```

- `definition` (`deleteObjectDefinition.response.200.definition`; object, required)
  - `_id` (`deleteObjectDefinition.response.200.definition._id`; string, required)
    - example `"def_contract"`
  - `nameSingular` (`deleteObjectDefinition.response.200.definition.nameSingular`; string, required)
    - example `"contract"`
  - `namePlural` (`deleteObjectDefinition.response.200.definition.namePlural`; string, required)
    - example `"contracts"`
  - `labelSingular` (`deleteObjectDefinition.response.200.definition.labelSingular`; string, required)
    - example `"Contract"`
  - `labelPlural` (`deleteObjectDefinition.response.200.definition.labelPlural`; string, required)
    - example `"Contracts"`
  - `description` (`deleteObjectDefinition.response.200.definition.description`; string, required)
  - `icon` (`deleteObjectDefinition.response.200.definition.icon`; string, required)
  - `color` (`deleteObjectDefinition.response.200.definition.color`; string | null, required)
  - `labelFieldKey` (`deleteObjectDefinition.response.200.definition.labelFieldKey`; string, required) — Field key whose value is the object’s display label.
  - `fields` (`deleteObjectDefinition.response.200.definition.fields`; array<map<unknown>>, required) — The type-discriminated field model (13 field types plus composites). Emitted permissively so the resource stays navigable.
  - `fieldGroups` (`deleteObjectDefinition.response.200.definition.fieldGroups`; array<map<unknown>>, required)
  - `version` (`deleteObjectDefinition.response.200.definition.version`; number, required) — Bumps only on a schema-affecting change.
  - `archivedAt` (`deleteObjectDefinition.response.200.definition.archivedAt`; any of, required)
    - any of: `string`, `null`
  - `createdAt` (`deleteObjectDefinition.response.200.definition.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` (`deleteObjectDefinition.response.200.definition.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` (`deleteObjectDefinition.response.200.definition.createdBy`; string, required)

### 403

Caller is not an org admin.

### 404

No definition with that id.

### 409

`objects_exist` — live objects remain and `purge` was not set.


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