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 CapTokensWritercapability.
- At least one allowing policy and no denying policies for the writeoperation for thetokensresource of the collection specified in the call.- Updating a token's metadata requires the writeoperation for thetokensresource of the collection specified in the call.
- Updating a token's data requires the tokenizeoperation for each of the collection properties specified in the call.
- For updating both the metadata and the data of a token, only the tokenizeoperation 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 strings- List of tenant IDs to enforce on the request. 
Path parameters
- collection- string required*- The name of a collection. 
Query parameters
- expiration_secs- string- Expiration 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 strings- Comma-separated list of object IDs. Each string:
- tags- array of strings- Comma-separated list of tags. 
- token_ids- array of strings- Comma-separated list of token IDs. 
- options- array of strings- Options for the operation. Options include: - archived– whether to update only archived tokens. If not specified, update only active tokens.
 
- adhoc_reason- string- An ad-hoc reason for accessing the Vault data. Required when - reasonis set to- Other.
- reason- string- 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- string- Custom audit information to be included in the audit log. 
- reload_cache- boolean- Reloads the cache before the action. 
Request body
Update token request details.
- application/json
- tags- array of strings- Replacement tags for the tokens. Each string:
- ensure_unique_tenant_tags- array of strings- Tags 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- object- The 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, - idis not supported and either- fieldsor- encryptedmust be supplied.- id- string- The ID of an object. 
- fields- object- A 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- object- An encrypted object. - ciphertext- string required*- The encrypted object base64 cipher text. 
- scope- string- The scope used to encrypt the object. By default, it uses the scope of the encrypted object. 
 
- request_index- integer- The index of the object in the request array. 
 Example- {
 "fields": {
 "first_name": "John",
 "email": "patfar@example.com"
 }
 }
- props- array of strings- A 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- string- The 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- string- The 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- string- The 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- string- The 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- string- The 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- string- The 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- string- The 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- string- The 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- string- The 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