# Type 6 – Semantic tags

Tag are additional metadata that can be used to extend or specialize the meaning or interpretation of the other data items.

For example, one might tag an array of numbers to communicate that it should be interpreted as a vector.

Please consult the official IANA repository of CBOR tags before inventing new ones.

Corresponding `cbor_type` | `CBOR_TYPE_TAG`
Number of allocations | One plus any manipulations with the data reallocations relative to chunk count
Storage requirements | `sizeof(cbor_item_t) + the tagged item`

cbor_item_t *cbor_new_tag(uint64_t value)

  Create a new tag.

  param value:

    The tag value. Please consult the tag repository

  return:

    Reference to the new tag item. The item’s reference count is initialized to one.

  return:

    `NULL` if memory allocation fails

cbor_item_t *cbor_tag_item(const cbor_item_t *item)

  Get the tagged item.

  Increases the reference count of the underlying item. The returned reference must be released using cbor_decref.

  param item:

    A tag

  return:

    Reference to the tagged item

uint64_t cbor_tag_value(const cbor_item_t *item)

  Get tag value.

  param item:

    A tag

  return:

    The tag value. Please consult the tag repository

void cbor_tag_set_item(cbor_item_t *item, cbor_item_t *tagged_item)

  Set the tagged item.

  param item:

    A tag

  param tagged_item:

    The item to tag. Its reference count will be increased by one.