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

# <access-service>/api/v1/versions/{versionId}/key

## URL structure&#x20;

```text theme={null}
https://access-service.xy-company.com/api/v1/versions/{versionId}/key
```

where `{versionId}` is the ID of a file object's/Secure Object's version.

## Supported methods and overview&#x20;

* `GET` - retrieves the cryptographic key required to decrypt a file object/[Secure Object](/3.4/api/working-with-files-and-folders-fundamentals.md#secure-object) version (specified by `versionId`).

> [!NOTE]
>
> This method takes no parameters.

## Detailed description&#x20;

This API endpoint retrieves the cryptographic key required to decrypt a file object version (specified by `versionId`).

This key is generated by:

1. Calling the [\<access-service>/api/v1/keys](/3.4/api/access-service-api-v1-keys.md) endpoint to obtain a cryptographic key and then
2. Associating this key with a new file object version (by subsequently calling the [\<content-service>/api/v1/objects/\{objectId}/versions](/3.4/api/content-service-api-v1-objects-objectid-versions.md) endpoint).

A file object's version ID can be obtained by calling the [\<access-service>/api/v1/objects/\{itemId}/versions](/3.4/api/access-service-api-v1-objects-itemid-versions.md) API endpoint, which retrieves a list of information associated with file object's versions that can be filtered using various 'search' criteria.

## Supported roles and conditions&#x20;

This API endpoint supports the following Covata user [roles](/3.4/admin-org/administering-users-within-an-organisation.md#an-organisation-users-roles) (as described in the [Organization Administrator's Guide](/3.4/admin-org.md)), conditions and [permissions](/3.4/api/access-service-api-v1-permissions-sets.md) (where applicable):

* [Originator](/3.4/admin-org/administering-users-within-an-organisation.md#originator-role) - when this user owns the file object associated with the version whose ID is specified by `{versionId}` in the request's URL.
* **Originator**, [Collaborator](/3.4/admin-org/administering-users-within-an-organisation.md#collaborator-role) and [Ad hoc](/3.4/admin-org/administering-users-within-an-organisation.md#adhoc-role) - when this user is a collaborator with the **Rename** [permission](/3.4/api/access-service-api-v1-permissions-sets.md) on the file object associated with the version whose ID is specified by `{versionId}` in the URL. (The **Rename** permission restricts access to collaborators who have been applied either the **Modify** or **Manage** *permission set* on this file object.)

The Covata Platform's resources available to a Covata user meeting the criteria above is determined by the access token submitted in the [header](/3.4/api/access-service-api-v1-versions-versionid-key.md#access-service-api-v1-versions-versionid-key-required-headers) of requests to this endpoint.

## Required headers&#x20;

The appropriate access token as the `Bearer` token:

* `Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0NjcwMTY2NjYsInVzZXJfbmFtZSI6ImFsZXgub...`

## Returns&#x20;

If the request succeeded, then an HTTP response status `200 OK` is returned.

For successful requests only, a JSON-formatted response containing the following members is also returned:

* **created** - A member containing detailed information about when the key was created. (This member, along with its contents, can be ignored and will be removed in a future Covata Platform version.)
* **modified** - A member containing detailed information about when the key was modified. (This member's sub-members should match the equivalent sub-members of the **created** member. However, like the **created** member, this **modified** member, along with its contents, can be ignored and will be removed in a future Covata Platform version.)
* **keyValue** - The cryptographic key value itself.
* **cryptographicAlgorithm** - The cryptographic algorithm supported by the Covata Platform. This should be `AES`.
* **keyLength** - The bit length of the cryptographic key value returned above.
* **initializationVector** - The initialization vector required to begin local/client-side encryption using the AES algorithm (in CBC mode).
* **modifiedinISODateTimeFormat** - The date and time (in ISO format) when the key was modified. (This value should match that of the **createdinISODateTimeFormat** value below. This member can be ignored and will be removed in a future Covata Platform version.)
* **createdinISODateTimeFormat** - The date and time (in ISO format) when the key was created. (This member can be ignored and will be removed in a future Covata Platform version.)
* **id** - The ID value associated with this cryptographic key. \

  **Example:**

  ```json theme={null}
  {
      "created": {
          "era": 1,
          "dayOfYear": 250,
          "dayOfWeek": 2,
          "dayOfMonth": 6,
          "year": 2016,
          "weekyear": 2016,
          "monthOfYear": 9,
          "yearOfEra": 2016,
          "yearOfCentury": 16,
          "centuryOfEra": 20,
          "millisOfSecond": 427,
          "millisOfDay": 22166427,
          "secondOfMinute": 26,
          "secondOfDay": 22166,
          "minuteOfHour": 9,
          "minuteOfDay": 369,
          "hourOfDay": 6,
          "weekOfWeekyear": 36,
          "zone": {
              "fixed": true,
              "id": "UTC"
          },
          "millis": 1473142166427,
          "chronology": {
              "zone": {
                  "fixed": true,
                  "id": "UTC"
              }
          },
          "equalNow": false,
          "beforeNow": true,
          "afterNow": false
      },
      "modified": {
          "era": 1,
          "dayOfYear": 250,
          "dayOfWeek": 2,
          "dayOfMonth": 6,
          "year": 2016,
          "weekyear": 2016,
          "monthOfYear": 9,
          "yearOfEra": 2016,
          "yearOfCentury": 16,
          "centuryOfEra": 20,
          "millisOfSecond": 427,
          "millisOfDay": 22166427,
          "secondOfMinute": 26,
          "secondOfDay": 22166,
          "minuteOfHour": 9,
          "minuteOfDay": 369,
          "hourOfDay": 6,
          "weekOfWeekyear": 36,
          "zone": {
              "fixed": true,
              "id": "UTC"
          },
          "millis": 1473142166427,
          "chronology": {
              "zone": {
                  "fixed": true,
                  "id": "UTC"
              }
          },
          "equalNow": false,
          "beforeNow": true,
          "afterNow": false
      },
      "keyValue": "KE3t+bFt4lK1lzHIC5u5L6LJXwLHz3Bv3FHv1TT9ZIk=",
      "cryptographicAlgorithm": "AES",
      "keyLength": 256,
      "initializationVector": "LlhihgsfMVaLA+rFBSwKbQ==",
      "modifiedinISODateTimeFormat": "2016-09-06T06:09:26.427Z",
      "createdinISODateTimeFormat": "2016-09-06T06:09:26.427Z",
      "id": "752047793853755392"
  }
  ```


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