Grant access to encrypt key

To grant access to encryption key, submit the following post request:

POST /api/v2/encrypt_keys/<encrypt-key-id>/authorized_users.json

HTTP body should contain JSON-formatted user-id.

For example:

{
    "user": {
        "user_id": "5b139cee-f13a-11e5-9615-e03f497dbdff"
    }
}

Response contains HTTP status code as shown in the following table.

Response Description
201 Created User has been successfully granted access to encryption key. HTTP header Location contains URL by which the newly created object should be know.

For example:

HTTP/1.1 201 Created
Location: /api/v2/encrypt_keys/.../5b139cee-f13a-11e5-9615-e03f497dbdff.json

403 Forbidden The request cannot be completed because API user has no permission to grant access to encryption keys
409 Conflict The request cannot be completed due to error.

When response has content type application/json, then it contains more detailed description of error in JSON format like:

{
    "error": "InvalidState",
    "description": "Such user is authorized already"
}