# Information on Status History
source: https://developer.mastercard.com/mdes-customer-service/documentation/tutorials/tutorial-9/index.md

Now that you have moved your project to production, you can use the Customer Service API to retrieve the list of actions performed on a particular token.

The following flow describes the overall requests and responses:
Diagram status-history

## APIs used in this tutorial {#apis-used-in-this-tutorial}

* MDES Customer Service API
  * [Search](https://developer.mastercard.com/mdes-customer-service/documentation/api-reference/index.md) endpoint
  * [Token Status History](https://developer.mastercard.com/mdes-customer-service/documentation/api-reference/index.md) endpoint

## What will you learn {#what-will-you-learn}

* How to create an API Client using Open API Generator
* How to add and enable Authentication and Encryption to the API Client
* How to make an API call to search for token details using search, and then, retrieve the list of actions performed on a particular token

## Pre-requisites {#pre-requisites}

To complete this tutorial, you will need:

* MDES Customer Service API specification [YAML file](https://developer.mastercard.com/mdes-customer-service/documentation/api-reference/index.md)
* Access to the MTF environment (<https://api.mastercard.com/mdes/csapi/mtf>)
* A project created with the MDES Customer Service API.
  * Your OAuth API signing key certificate (suffixed "p12")
  * The Consumer Key identifier, Key Alias and Key Password associated with the above key
* You should have downloaded the Encryption Key.

## Procedure {#procedure}

1. Create an [API client using an Open API Generator](https://developer.mastercard.com/platform/documentation/security-and-authentication/generating-and-configuring-a-mastercard-api-client/#step-3-generate-an-api-client-project) and using the MDES Customer Service API [YAML file](https://developer.mastercard.com/mdes-customer-service/documentation/api-reference/index.md).  
2. Add the [Mastercard Client Authentication Library to the API Client](https://github.com/Mastercard?&q=oauth1)
3. Add the [Client Encryption Library to the API Client](https://github.com/Mastercard?&q=client-encryption)  
4. Create an [API Client Instance and Enable Authentication](https://developer.mastercard.com/platform/documentation/security-and-authentication/generating-and-configuring-a-mastercard-api-client/#step-6-create-an-api-client-instance-and-enable-authentication)  
5. [Enable Encryption](https://developer.mastercard.com/platform/documentation/security-and-authentication/generating-and-configuring-a-mastercard-api-client/#step-7-enable-encryption)  
6. Call the API Endpoint. First, to search for the token for which you need to check the status history, you will need to call the `/search` endpoint. This will return the Token Unique Reference (TUR) for that token. Now, use that TUR in the `/statushistory` endpoint to display a list of actions performed on that token.

To call the `/search` endpoint as per the [example tutorial](https://developer.mastercard.com/platform/documentation/security-and-authentication/generating-and-configuring-a-mastercard-api-client/#step-8-call-the-service), we will use the request parameters as specified in the YAMl file.


API Reference: `GET /{id}/search`

<br />

<br />

The API client will take care of serializing, encrypting and signing the Search request and will decrypt and deserialize the response into a SearchResults instance.

For example, use the SearchApi class and TokenStatusHistoryApi class generated as part of step 1, as in the following code snippets. The Search response will look like this:

     SearchApi
        searchForAToken
    (node:18332) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.

    {
      "SearchResponse": {
        "Accounts": {
          "Account": [
            {
              "AccountPanSuffix": 1234,
              "FinancialAccountSuffix": 1234,
              "CountryCode": "GBR",
              "InterbankCardAssociationId": 12345678901,
              "InstitutionName": "Financial Institution 1",
              "ExpirationDate": 1215,
              "AlternateAccountIdentifierSuffix": 4300,
              "Tokens": {
                "Token": [
                  {
                    "TokenUniqueReference": "DWSPMC00000000010906a349d9ca4eb1a4d53e3c90a11d9c",
                    "PrimaryAccountNumberUniqueReference": "FWSPMC0000000004793dac803f190a4dca4bad33c90a11d3",
                    "AccountPanSequenceNumber": "59",
                    "TokenSuffix": 7890,
                    "ExpirationDate": 1016,
                    "DigitizationRequestDateTime": "2022-01-21T00:04:35.000Z",
                    "ActivationCodeExpirationDateTime": "2022-01-21T00:04:35.000Z",
                    "CorrelationId": 98765432101234,
                    "CurrentStatusCode": "A",
                    "CurrentStatusDescription": "Active",
                    "CurrentStatusDateTime": "2022-01-21T00:04:35.000Z",
                    "FinalTokenizationDecision": "A",
                    "LastCommentId": "ABC123456",
                    "PaymentAppInstanceId": "645b532a245e4723d7a9c4f62b24f24a24ba98e27d43e34e",
                    "ProvisioningStatusCode": "S",
                    "ProvisioningStatusDescription": "Provisioning successful",
                    "StorageTechnology": "S",
                    "Source": "ACCOUNT_ON_FILE",
                    "TransactionCredentialGenerationStatus": "BLOCKED",
                    "Suspenders": {
                      "Suspender": [
                        "W, I"
                      ]
                    },
                    "TokenActivatedDateTime": "2015-01-21T00:04:35.000Z",
                    "TokenAssuranceLevel": 1,
                    "TokenRequestorId": 212345678,
                    "TokenRequestorName": "Popular High Street Merchant",
                    "TokenType": "S",
                    "WalletId": 123,
                    "Device": {
                      "DeviceId": "C2ZBY14310005664",
                      "DeviceName": "John's phone",
                      "DeviceType": 14,
                      "SecureElementId": "0416231B342G80015987657748933803102AC30A842F29F0"
                    },
                    "TokenDeletedFromConsumerApp": false,
                    "TokenRequestorConsumerFacingEntityName": "BestPay"
                  }
                ]
              }
            }
          ]
        }
      }
    }

The TUR returned in the Search API response is then used to call the TokenStatusHistory API to fetch the list of transactions performed by that token.

API Reference: `GET /{id}/token/statushistory`

    SearchApi api = new SearchApi(client);
    Search request = buildSearch();
    SearchResults response = api.searchForAToken(request);

    TokenStatusHistoryApi api2 = new TokenStatusHistoryApi(client);
    TokenStatusHistory request2 = buildTokenStatusHistory(response.getTokenUniqueReference());
    request2.AuditInfo()
        public AuditInfo getAuditInfo() {
        return null;
    }
        public class AuditInfo {
          setRepId(String repId)
          setRepName(String repName) 
          setRepOrgName(String repOrgName)
        }
    TokenStatusHistoryResults response2 = api2.tokenStatusHistoryCall(request2);

