# Administrative Workflow Tutorial
source: https://developer.mastercard.com/agent-suite-for-merchants/documentation/tutorials-and-guides/employees-tutorial/index.md

👉 Replace the generic administrative-record flow, protected identifiers, encrypted routes, and sample payloads with the actual administrative or support-user workflow for your service.

## Overview {#overview}

Use this tutorial to test the administrative endpoints in the {Your Service Name} service, including administrative record creation, search, updates, and deletion.

## Prerequisites {#prerequisites}

* A project created for your service on Mastercard Developers.
* Sandbox credentials and downloaded keys stored safely.
* A configured API client such as Postman or Insomnia.
* Authentication configured before you send requests.

Example client configuration:

```json
{
  "scheme": "https",
  "base_path": "",
  "host": "sandbox.api.mastercard.com",
  "mastercard": {
    "consumerKey": "{your consumerKey}",
    "keyAlias": "{your keyAlias}",
    "keystoreP12Path": "/path/to/your/file",
    "keystorePassword": "{your keystorePassword}"
  }
}
```

<br />

* Payload encryption is required for administrative endpoints that contain sensitive personal or operational data.

```text
POST /admin-records
POST /admin-records/searches
PUT /admin-records/{record_key}
```

## What You Will Learn {#what-you-will-learn}

* How to create, search, update, and delete administrative records

## Post an Administrative Record {#post-an-administrative-record}

1. To create an administrative record, populate the required body information such as names, contact details, and the protected identifier used by the search workflow.
2. If the route requires encryption, configure the body before sending the request.

   ```json
   {
     "path": "/admin-records",
     "toEncrypt": [
       {
         "element": "$",
         "obj": "$"
       }
     ],
     "toDecrypt": [
       {
         "element": "$",
         "obj": "$"
       }
     ]
   }
   ```

```yaml
POST https://sandbox.api.mastercard.com/{your-service}/admin-records
```

```json
{
  "newRecords": [
    {
      "firstName": "Jordan",
      "lastName": "Taylor",
      "phoneNumber": "+15555550101",
      "identifier": "123-45-6789"
    }
  ]
}
```

2. In the response, you will receive a unique record ID and any generated access values such as usernames or emails. Store these values somewhere safe.

## Identifier Search {#identifier-search}

To search for an administrative record by a protected identifier, use the search endpoint and encrypt the request if required.

```json
{
  "path": "/admin-records/searches",
  "toEncrypt": [
    {
      "element": "$.identifier",
      "obj": "$"
    }
  ],
  "toDecrypt": [
    {
      "element": "$.encryptedIdentifier",
      "obj": "identifier"
    }
  ]
}
```

<br />

```yaml
POST https://sandbox.api.mastercard.com/{your-service}/admin-records/searches
```

```json
{
  "identifier": "123-45-6789"
}
```

## Record Key Search {#record-key-search}

To search for an administrative record by the generated record key, use the key as a path parameter in the request.

```yaml
GET https://sandbox.api.mastercard.com/{your-service}/admin-records/{record_key}
```

## Update an Administrative Record {#update-an-administrative-record}

1. To update information about an administrative record, use the record key and the `If-Match` header as parameters, and submit the full body.
2. If the route requires encryption, configure the body before sending the request.

   ```json
   {
     "path": "/admin-records",
     "toEncrypt": [
       {
         "element": "$",
         "obj": "$"
       }
     ],
     "toDecrypt": [
       {
         "element": "$",
         "obj": "$"
       }
     ]
   }
   ```

```yaml
PUT https://sandbox.api.mastercard.com/{your-service}/admin-records/{record_key}
```

`If-Match (header)`: `0`

```json
{
  "record": {
    "id": "44871c36-d99d-11eb-b8bc-0242ac130003",
    "firstName": "Jordan",
    "lastName": "Taylor",
    "identifier": "123-45-6789",
    "phoneNumber": "+15555550102",
    "recordKey": "jordan_t1",
    "status": "ACTIVE"
  }
}
```

## Delete an Administrative Record {#delete-an-administrative-record}

1. To remove an administrative record, use its record key as the path parameter.

```yaml
DELETE https://sandbox.api.mastercard.com/{your-service}/admin-records/{record_key}
```

