# Types of IDs

Throughout our documentation and across the API, few attributes are as routinely used and complicated as the ID.

ids Optional. If there are multiple IDs returned by Kloudless to refer to this object in API responses, this attribute is an object that maps all types of IDs returned to their current values. Here are the possible types of IDs:

  • default: An ID that refers to this object, based on static data unique within the upstream service, such as upstream object IDs.
  • shared: An ID that refers to this object when the object is shared and accessed via multiple users. Maintains the same value across users within the upstream service, but unique otherwise.
  • path: Similar to default, but based on the path to the file. Unique within this user’s account, but changes if the path changes.
  • version: An ID referring to a specific version of a file.

# Kloudless IDs

The ID is an encrypted version of the storage account’s file ID. The encrypted string is then base-64 encoded in a URL-safe manner. This value increases in length proportionally with the storage service’s file ID but will not exceed 8192 characters. Some services like WebDAV can, therefore, have very long IDs as folder nesting increases. See the raw.id attribute for the decoded representation.

However, cloud services use differing strategies in how they organize their data. A canonical ID may not always be available. Kloudless therefor describes the data that Kloudless references to create an ID.

# Parent IDs

When working with the Kloudless Storage API, Kloudless uses a unique attribute id.

This attribute is useful in identifying the file/folder for a myriad of uses by the Kloudless platform. However, this same approach cannot always be used for other useful metadata attributes like parent id due to the data that is provided by upstream service. When this is the case, Kloudless creates an ID based on the path to the file/folder. The path-based ID extends some functionality that would not usually be available; however, this type of ID is dependant on the path not changing, as any change breaks the ID.

If a file has a unique ID, you can retrieve a true or canonical ID for the file/folder, and an additional API call can be made using the parent ID (if the path has not changed) that provides the file/folder id attribute.

Metadata for files/folders now includes an optional attributes ids and id_type, which provide additional information about the ID attribute. The additional information can help in determining how you want to use the id attribute. You can read more information on these attributes can in our docs.