# Object ID Representation

The **JSON API** represents the unique identifier as a 32 byte character hexadecimal string.  For example: `90e9361f38c156df654ecd27b92f398c`.\
\
When **proxied** via the **HTSP** `api` method, the unique identifier is encoded as a 16 byte binary field.  When this field is represented as a hexadecimal string, it matches that used by the JSON API.\
\
The **HTSP API** represents the unique identifier of an object using an unsigned 32 bit big-endian integer.\
\
When represented as a hexadecimal string, the value matches the first 8 characters of the JSON unique identifier.\
\
When evaluated as binary data, it matches the first 4 bytes of the proxied JSON value.

**Mixing and Matching API Values**\
\
The following table summarises UUID handling by API.

<table><thead><tr><th width="148">API Used</th><th width="372">UUID Value Returned</th><th>Encoding</th></tr></thead><tbody><tr><td>JSON</td><td><code>90e9361f38c156df654ecd27b92f398c</code></td><td>String</td></tr><tr><td>Proxied JSON</td><td><code>0x90e9361f38c156df654ecd27b92f398c</code></td><td>Binary</td></tr><tr><td>HTSP</td><td><code>0x90e9361f</code></td><td>Binary</td></tr></tbody></table>

**Additional Notes**

* The 32 bit ID may only contain 31 valid bits under certain circumstances.  Based on how TVH creates 32 bit IDs, it is recommended to apply a `0x7fffffff` mask for comparison operations between long and short ID forms.
* There appears to be no guarantee that the 32 bit ID will be unique among ALL object types.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tvheadend.org/documentation/development/object-id-representation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
