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

# Core concepts & gotchas

> How Cloneable models jobs, configurations, EAV data objects, base64 query parameters, photos, and soft archives.

## Jobs, configurations, and templates

* **Configuration** (`configuration_id`): Shared setup defining which templates, picklists, measurement units, and export modules a set of jobs uses.
* **Job** (`id`): One field work package referencing a `configuration_id`.
* **Template** (`object_id`): Schema for one record type (for example `Pole`, `Span`, `Midspan`, `Guy Anchor`). Always reference templates by their **`object_id` UUID**, not legacy row IDs.
* **Data Object** (`id`): An individual pole, span, midspan, or point record. Objects belong to a job via their **`job_id`** field (a Cloneable job UUID).

> [!TIP]
>
> **Configuration safety:** When updating a configuration via `PUT /pole-inspection/configurations/{id}`, always read-modify-write the full `config_data` object and preserve unknown keys verbatim. Collection keys are read by the iOS field app and must remain strictly additive.

## Data objects (EAV model)

Data objects store custom attributes as entity-attribute-value (EAV) fields:

* Field values are stored as strings (`stored_value`). JSON-typed fields (such as `measurement_data`) can occasionally be double-encoded — parse JSON tolerantly and never schema-strip unknown keys when writing back.
* All stored lengths, heights, and clearances are in **meters**.
* Pole heights live under `measurement_data.pole_information.height` / `manualHeight` / `calculatedHeight` (not camera `imageHeight`).

## Encoding object & array query parameters (`jsonQuery`)

On query endpoints such as `GET /data-object-sync/filtered-data-objects`, object and array query parameters (`filters`, `sorting`) must be encoded as **base64 JSON**, not raw JSON text:

```ts TypeScript theme={null}
function encodeQueryValue(value: unknown): string {
  const json = JSON.stringify(value).replace(
    /[\u007f-\uffff]/g,
    (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`,
  )
  return btoa(json)
}

const filters = encodeQueryValue([
  { field: 'job_id', operator: 'eq', value: '71ed980b-2269-49fd-b7b8-1e97280f2963' },
])
const url = `https://api.cloneable.ai/data-object-sync/filtered-data-objects?filters=${encodeURIComponent(filters)}`
```

```python Python theme={null}
import base64, json, urllib.parse

def encode_query_value(value) -> str:
    raw = json.dumps(value, ensure_ascii=True).encode("ascii")
    return base64.b64encode(raw).decode("ascii")

filters = encode_query_value([
    {"field": "job_id", "operator": "eq", "value": "71ed980b-2269-49fd-b7b8-1e97280f2963"}
])
url = f"https://api.cloneable.ai/data-object-sync/filtered-data-objects?filters={urllib.parse.quote(filters)}"
```

## Photos & `file.url`

* **`file.url` is an R2 storage key, never a usable download URL.** Always call `GET /file/{id}/download-url` to obtain a signed one-hour URL.
* **`saved_to_cloud: false`** means the field device created the photo record offline and has not finished uploading the image bytes yet.
* Overview photos on a pole are referenced as bare file UUIDs in `measurement_data.images[].image`.

## Soft archiving & history

Cloneable does not hard-delete field work:

* **Jobs & templates** set `archived_at`.
* **Data objects** set `meta_data.archived_at` and clear their live field rows — **data is not lost**. Every field write remains in `GET /data-object/{id}/history`, and photos are always retained. Reconstruct an archived object's last values from the newest history row per field key.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.