Update tokens
Updates token data or token metadata tags
and expiration
properties.
Update token metadata
See the Update a token guide for more information about updating a token's metadata.
Update token data
To update token data, all the tokens must:
- have the same token ID.
- be token types
pci
,pci_oneway
, orrandomized
(metadata can be updated in all token types).
To update a token's data, set the object
parameter to contain one of these:
- Objects stored in Vault by providing their ID.
- Fields not stored in Vault by providing a map of their properties and property values. These fields must conform to the schema of the collection specified in the request.
- Ciphertext. This enables you to update a token's data with a subset of another ciphertext's properties or with a different encryption type or scope.
Updates to the token's data do not change the token's metadata, token ID, ownership, or lifecycle of the token . However, the data update may affect subsequent tokenizations. For example, if a token of type pci
with ID "X" is updated, subsequent tokenizations of the new data have the same token ID "X," while tokenizations of the previous data results in a new token ID. See Tokenization for more information on token types.
Update to the token's data overrides the entire existing data.
Permissions
The role performing this operation must have both of these:
- The
CapTokensWriter
capability. - At least one allowing policy and no denying policies for the
write
operation for thetokens
resource of the collection specified in the call.- Updating a token's metadata requires the
write
operation for thetokens
resource of the collection specified in the call. - Updating a token's data requires the
tokenize
operation for each of the collection properties specified in the call. - For updating both the metadata and the data of a token, only the
tokenize
operation permission is required.
- Updating a token's metadata requires the
See identity and access management for more information about how capabilities are used to control access to operations and policies are used to control access to data.
Query
The tokens returned by this operation are defined using three query parameters: token_ids
, object_ids
, and tags
. If no tokens are matched, status code 404 is returned. See the Retrieve a token guide for more information about how to match tokens for this operation.
Request
Header parameters
X-Tenant-Id
- array of stringsList of tenant IDs to enforce on the request.
Path parameters
collection
- string required*The name of a collection.
Query parameters
expiration_secs
- stringExpiration time in seconds for the tokens. If not set, the expiry dates of the tokens are not changed. If set to an empty value, the token will be marked to not expire.'
object_ids
- array of stringsComma-separated list of object IDs.
Each string:tags
- array of stringsComma-separated list of tags.
token_ids
- array of stringsComma-separated list of token IDs.
options
- array of stringsOptions for the operation. Options include:
archived
– whether to update only archived tokens. If not specified, update only active tokens.
adhoc_reason
- stringAn ad-hoc reason for accessing the Vault data. Required when
reason
is set toOther
.reason
- string required*Details of the reason for requesting the property. The default is set when no access reason is provided and PVAULT_SERVICE_FORCE_ACCESS_REASON is false.
custom_audit
- stringCustom audit information to be included in the audit log.
reload_cache
- booleanReloads the cache before the action.
Request body
Update token request details.
- application/json
tags
- array of stringsReplacement tags for the tokens.
Each string:ensure_unique_tenant_tags
- array of stringsTags to validate as unique in tenant scope. Must be a subset of 'tags'. Note: The need to ensure the uniqueness of the tags prior to insertion means this feature impacts the operation's performance.
Each string:object
- objectThe input object, defined as one and only one of the following properties.
id
: the ID of an object.fields
: property values of an object.encrypted
: an encrypted object.request_index
: the index of the object in the request array.
In stateless mode,
id
is not supported and eitherfields
orencrypted
must be supplied.id
- stringThe ID of an object.
fields
- objectA list of maps of object properties and their values.
Example{
"date_of_birth": "1993-02-22",
"email": "patfar@example.com",
"first_name": "Pat",
"last_name": "Far",
"phone_number": "+11011010101"
}encrypted
- objectAn encrypted object.
ciphertext
- string required*The encrypted object base64 cipher text.
scope
- stringThe scope used to encrypt the object. By default, it uses the scope of the encrypted object.
request_index
- integerThe index of the object in the request array.
Example{
"fields": {
"first_name": "John",
"email": "patfar@example.com"
}
}props
- array of stringsA list of the properties to update.
Each string:The name of a property.
{
"tags": [
"credit_cards"
],
"ensure_unique_tenant_tags": [
"credit_cards"
],
"object": {
"fields": {
"first_name": "John",
"email": "patfar@example.com"
}
},
"props": [
"first_name"
]
}
Possible responses
- 200
- 400
- 401
- 403
- 404
- 405
- 409
- 410
- 500
- 503
The request is successful.
The request is invalid.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1001",
"message": "The access reason is missing.",
"context": {
"reason": null
}
}
Authentication credentials are incorrect or missing.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1005",
"message": "The request is unauthorized.",
"context": {}
}
The caller doesn't have the required access rights.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1007",
"message": "The operation is forbidden due to missing capabilities.",
"context": {
"username": "WebServer"
}
}
The collection or reason aren't found or are missing, the reason
is set to other
but no adhoc_reason
is provided, no token query parameters are provided, or the query finds no matching tokens.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV3009",
"message": "The token is not found."
}
The operation is not allowed.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1026",
"message": "The operation is not allowed in in-memory mode.",
"context": {}
}
A conflict occurs.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV3218",
"message": "Concurrent conflicting updates to the same object.",
"context": {}
}
Access to a resource that is no longer available occurs.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1033",
"message": "The resource is gone.",
"context": {}
}
An error occurs on the server.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1000",
"message": "Something went wrong",
"context": {}
}
The service is unavailable.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1009",
"message": "The operation timed out on the server.",
"context": {}
}
Path parameters
Query parameters
Headers
Request body
Code examples