# Didomi Consent String Structure

## Didomi Consent String V2 schema <a href="#pdf-page-wwo5iebb8qrzzogwftxg-didomi-consent-string-fields" id="pdf-page-wwo5iebb8qrzzogwftxg-didomi-consent-string-fields"></a>

```
"types": [
    "version",
    "uuid",
    "date",
    "u16",
    "enabled_disabled_ids",
    "bit_field_2_bits",
    "ranges_u16",
    "ranges_fibonacci"
  ],
  "fields": [
    {
      "type": "version",
      "description": "Didomi Consent String Specification Version, 6 bits number - 000010 or 'C' in Base64 for v2",
      "key": "version",
      "value": 2
    },
    {
      "type": "uuid",
      "description": "User ID (UUID)",
      "key": "user_id"
    },
    {
      "type": "date",
      "description": "UTC epoch time format when the Consent String was initially created",
      "key": "created"
    },
    {
      "type": "date",
      "description": "UTC epoch time format when the Consent String was last time updated",
      "key": "updated"
    },
    {
      "type": "u16",
      "description": "Regulation ID that was used to encode user status",
      "key": "regulation_id"
    },
    {
      "type": "date",
      "description": "Last sync date",
      "key": "sync",
      "optional": true
    },
    {
      "type": "enabled_disabled_ids",
      "description": "User Status for purposes opt-in",
      "key": "purposes_optin",
      "variants": [
        "bit_field_2_bits",
        "ranges_u16",
        "ranges_fibonacci"
      ]
    },
    {
      "type": "enabled_disabled_ids",
      "description": "User Status for purposes opt-out",
      "key": "purposes_optout",
      "variants": [
        "bit_field_2_bits",
        "ranges_u16",
        "ranges_fibonacci"
      ]
    },
    {
      "type": "enabled_disabled_ids",
      "description": "User Status for vendors opt-in",
      "key": "vendors_optin",
      "variants": [
        "bit_field_2_bits",
        "ranges_u16",
        "ranges_fibonacci"
      ]
    },
    {
      "type": "enabled_disabled_ids",
      "description": "User Status for vendors opt-out",
      "key": "vendors_optout",

      "variants": [
        "bit_field_2_bits",
        "ranges_u16",
        "ranges_fibonacci"
      ]
    }
  ]
```

{% hint style="info" %}
Optional fields should appear in an encoded string if the value of the related field is set accordingly.

For example, if `StartFromOne` is set to `0`, then `StartID` should be present in the encoded field. If `StartFromOne` is `1`, then `StartID` will be absent.
{% endhint %}

Within the same consent string, different sections may have different encoding (BitField, Range or Fibonacci) based on the range of the IDs to encode. The final goal being the generation of the smallest possible cookie. The `EncodingAlgorithm` property indicates which mechanism was used for encoding the given section.


---

# 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://developers.didomi.io/cmp/didomi-consent-string/didomi-consent-string-structure.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.
