Patch tokens

Update existing aliases

This Patch endpoint allows you to update an existing alias. You can:

  • update and map the expiry date (year and month) of a card, or
  • remove the underlying PAN of an alias from your vault.

🚧

The Patch API only works for aliases in the Alias 2.0 format.

Updating card expiry dates

Adding the expiry date is useful when the expiry date is not already submitted in the initial alias creation request. This happens when using the Filter or SFTP proxies. An alias with a mapped expiry date is required when you plan to create a Network Token after initial PCI Proxy tokenization.

curl --request PATCH \
  --url 'https://api.sandbox.datatrans.com/v1/aliases/7LHXscqwAAEAAAGFDIr3SD05RBVAAK5n' \
  --header 'Authorization: Basic {{basicAuth}} ' \
  --data '{   
    "expiryMonth": "02",    
    "expiryYear": "23"   
}'
{
    "alias": "7LHXscqwAAEAAAGL8iMby0m43Rs0ABgr",
    "fingerprint": "F-f5AcNienVUz735BKis71pD",
    "type": "CARD",
    "masked": "489537xxxxxx6386",
    "dateCreated": "2023-08-21T13:47:49Z",
    "card": {
        "panRemoved": false,
        "last4": "6386",
        "expiryMonth": "02",
        "expiryYear": "25",
        "cardInfo": {
            "brand": "VISA",
            "type": "debit",
            "usage": "consumer",
            "country": "US",
            "issuer": "U.S. REGION"
        },
        "networkToken": {
            "expiryMonth": "02",
            "expiryYear": "25",
            "status": "ACTIVE",
            "paymentAccountReference": "V0010013020217426481676671969"
        }
    }
}

📘

The response object networkToken indicates if a Network Token has been created.

A missing networkToken object means that Network Token creation has failed.

Removing PANs

Removing a PAN from storage is helpful if you need to comply certain regulation which doesn't allow storage of plain card details on payment ecosystems.

📘

Removing PANs is only available for accounts enabled for Network Tokenization for a given card number.

A removed PAN can not be restored.

curl --request PATCH \
  --url 'https://api.sandbox.datatrans.com/v1/aliases/7LHXscqwAAEAAAGFDDm7on4gPrwPAMrW' \
  --header 'Authorization: Basic {{basicAuth}}' \
  --data '{
	"removePlain": true
}'
{
    "alias": "7LHXscqwAAEAAAGLJK2LeOAp3Fd7AHdb",
    "fingerprint": "F-f5AcNienVUz735BKis71pD",
    "type": "CARD",
    "masked": "489537xxxxxx6386",
    "dateCreated": "2023-05-12T16:17:15Z",
    "card": {
        "panRemoved": true,
        "expiryMonth": "05",
        "expiryYear": "25",
        "cardInfo": {
            "brand": "VISA",
            "type": "debit",
            "usage": "consumer",
            "country": "US",
            "issuer": "U.S. REGION"
        },
        "networkToken": {
            "expiryMonth": "05",
            "expiryYear": "25",
            "status": "ACTIVE"
        }
    }
}

📘

The response parameter panRemoved indicates if the PAN has been removed from storage for a given alias.

You can also call the Token Status API if you are not sure whether the PAN exists or not.