> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/merchant-tokenization/ja/bakkuendo/apis/server-api/token-migration.md).

# Token Migration

## Migrate Mastercard tokens

> Migrate mastercard M4M tokens to Secure Card on File\
> \
> ETP contacts the Scheme TSP to migrate the network token.

```json
{"openapi":"3.1.1","info":{"title":"Thales ETP Server API","version":"1.78"},"tags":[{"name":"Token Migration"}],"servers":[{"url":"https://thales.api.com/tsh-cof"}],"paths":{"/tokens/migration/{oldTokenId}":{"post":{"description":"Migrate mastercard M4M tokens to Secure Card on File\n\nETP contacts the Scheme TSP to migrate the network token.","operationId":"migrateMdesToken","parameters":[{"$ref":"#/components/parameters/authorization"},{"$ref":"#/components/parameters/xCorrelationId"},{"$ref":"#/components/parameters/oldTokenId"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["newTokenId","tokenState","creationTimestamp"],"properties":{"newTokenId":{"$ref":"#/components/schemas/tokenId"},"cardLastDigits":{"$ref":"#/components/schemas/cardLastDigits"},"cardExpiryDate":{"$ref":"#/components/schemas/cardExpiryDate"},"tokenState":{"$ref":"#/components/schemas/migratedTokenState"},"tokenLastDigits":{"$ref":"#/components/schemas/tokenLastDigits"},"tokenExpiryDate":{"$ref":"#/components/schemas/tokenExpiryDate"},"par":{"$ref":"#/components/schemas/par"},"cardProduct":{"$ref":"#/components/schemas/cardProductMigration"},"creationTimestamp":{"$ref":"#/components/schemas/creationTimestamp"}}}}}},"400":{"description":"Bad request - Not Retryable","content":{"application/json":{"schema":{"type":"object","properties":{"errorCode":{"type":"string","maxLength":128,"description":"Optional information that details the error.\n\n-----------------\n|Error Code|Description|\n|-------|-------|\n|INVALID_TOKEN_STATE|The current token state doesn't allow the operation.|\n|OPERATION_NOT_ALLOWED|Operation not allowed.|\n|TSP_NON_RETRYABLE_ERROR|Non retryable errors returned by the TSP.|\n|TOKEN_NOT_ELIGIBLE|Token not eligible for migration.|\n|SCHEME_TECHNICAL_ERROR|Technical error returned by TSP.|\n\n-----------------"},"errorDetails":{"$ref":"#/components/schemas/errorDetails"},"schemeCorrelationId":{"$ref":"#/components/schemas/schemeCorrelationId"}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"429":{"$ref":"#/components/responses/429"},"500":{"$ref":"#/components/responses/500"},"503":{"$ref":"#/components/responses/503"}},"tags":["Token Migration"],"summary":"Migrate Mastercard tokens"}}},"components":{"parameters":{"authorization":{"schema":{"type":"string","maxLength":512,"minLength":1},"in":"header","description":"Technical identifier pre-defined at on-boarding that identifies the API\nconsumer.\nFormat shall be the string 'APIKEY' followed by a space and the\napi key value.\n</br> Example: APIKEY c03f88fe-01ba-11e8-ba89-0ed5f89f718b\n","name":"authorization","required":true},"xCorrelationId":{"schema":{"type":"string","maxLength":36,"minLength":1},"in":"header","description":"Technical identifier used for troubleshooting. \n</br>It helps on customer support when needed. \n</br>Each API request must be identified with a unique correlation Id.\n</br>It correlates the response and the request and eventually a notification if any. ","name":"x-correlation-id","required":true},"oldTokenId":{"schema":{"type":"string","maxLength":128},"in":"path","description":"Old token identifier.","name":"oldTokenId","required":true}},"schemas":{"tokenId":{"type":"string","description":"The token identifier.","pattern":"^[a-zA-Z0-9_-]+$","minLength":1,"maxLength":128},"cardLastDigits":{"type":"string","maxLength":5,"description":"The card last digits."},"cardExpiryDate":{"type":"string","maxLength":4,"description":"The card expiry date in format MMYY."},"migratedTokenState":{"type":"string","maxLength":64,"description":"Token state.","enum":["ACTIVE","SUSPENDED","PENDING"]},"tokenLastDigits":{"type":"string","maxLength":5,"description":"The token last digits."},"tokenExpiryDate":{"type":"string","maxLength":4,"description":"The token expiry date in format MMYY. This information can be missing. It is intended for display only at this step.<br>Rely on token expiry date in create transaction response for storage."},"par":{"type":"string","maxLength":29,"description":"Payment Account Reference returned by the Scheme TSP."},"cardProductMigration":{"type":"object","description":"Information about the card product.","required":["cardType"],"properties":{"issuerName":{"$ref":"#/components/schemas/issuerName"},"cardType":{"$ref":"#/components/schemas/cardType"},"scheme":{"$ref":"#/components/schemas/schemeMigration"},"cardDescription":{"$ref":"#/components/schemas/cardDescription"},"cardArts":{"$ref":"#/components/schemas/cardArtsMigration"}}},"issuerName":{"type":"string","maxLength":128,"description":"The card issuer name."},"cardType":{"type":"string","description":"The card type.","maxLength":32,"enum":["CREDIT","DEBIT","PREPAID","UNKNOWN"]},"schemeMigration":{"type":"string","description":"The card primary scheme.","maxLength":32,"enum":["MASTERCARD"]},"cardDescription":{"type":"string","maxLength":256,"description":"The card description."},"cardArtsMigration":{"type":"object","properties":{"foregroundColor":{"type":"string","maxLength":6,"description":"Color used for the text displayed on the card (last digits, expiry date). Hexadecimal RGB color format."},"cardImageUrl":{"type":"string","maxLength":512,"description":"HTTP location of the card image. If present, no other identifier is provided and getAsset operation is not needed."}}},"creationTimestamp":{"type":"string","maxLength":64,"description":"Token creation timestamp compliant with ISO 8601."},"errorDetails":{"type":"string","maxLength":256,"description":"Additional information about the error. This optional parameter has no specific format as it depends on the different TSP API. It is sent for logging and troubleshooting purpose."},"schemeCorrelationId":{"type":"string","maxLength":128,"description":"Identifier used by the schemes for additional support."}},"responses":{"401":{"description":"Unauthorized - Not Retryable"},"404":{"description":"Not Found - Not Retryable"},"429":{"description":"Too Many Requests - Retryable"},"500":{"description":"Internal Server Error - Not Retryable"},"503":{"description":"Service Unavailable - Retryable"}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.payments.thalescloud.io/merchant-tokenization/ja/bakkuendo/apis/server-api/token-migration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
