# Update Agent Username

## zapiAgents\_UpdateUsername

<mark style="color:blue;">`GET`</mark> `https://{yourdomainname}.zaui.net/zapi/`

#### Request Body

| Name                                            | Type    | Description                                                                     |
| ----------------------------------------------- | ------- | ------------------------------------------------------------------------------- |
| zapiToken<mark style="color:red;">\*</mark>     | integer | Token that must be used for a reseller to communicate with the supplier system. |
| username<mark style="color:red;">\*</mark>      | string  | New username for the Agent.                                                     |
| agentHashKey<mark style="color:red;">\*</mark>  | integer | Retrieved by running Authenticate Agent call.                                   |
| agentID<mark style="color:red;">\*</mark>       | integer | Retrieved by running Authenticate Agent call.                                   |
| methodName<mark style="color:red;">\*</mark>    | string  | The method being called.                                                        |
| zapiUserId<mark style="color:red;">\*</mark>    | integer | Generated by the supplier system when a new contact is created.                 |
| zapiAccountId<mark style="color:red;">\*</mark> | integer | Generated by the supplier system.                                               |

{% tabs %}
{% tab title="200: OK " %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<response>
    <zapiVersion>2.1</zapiVersion>
    <error>0</error>
    <message>OK</message>
    <methodResponse>
        <methodName>zapiAgents_UpdateUsername</methodName>
        <guestDetails>
            <guestID>1240</guestID>
            <guestHashKey>79dc5307ebf032b8705edffe1a47928cb8dafa5f</guestHashKey>
            <accountId>
                <![CDATA[456]]>
            </accountId>
            <expiryDate>
                <![CDATA[2021-12-31]]>
            </expiryDate>
            <username>
                <![CDATA[connectivity]]>
            </username>
            <firstName>
                <![CDATA[Nad]]>
            </firstName>
            <lastName>
                <![CDATA[Dau]]>
            </lastName>
            <gender>
                <![CDATA[]]>
            </gender>
            <mobilePhone>
                <![CDATA[]]>
            </mobilePhone>
            <email>
                <![CDATA[support@zaui.com]]>
            </email>
            <addressLine1>
                <![CDATA[119 W Pender St Suite 423]]>
            </addressLine1>
            <addressLine2>
                <![CDATA[]]>
            </addressLine2>
            <city>
                <![CDATA[Vancouver]]>
            </city>
            <state>
                <![CDATA[BC]]>
            </state>
            <country>
                <![CDATA[Canada]]>
            </country>
            <zipCode>
                <![CDATA[V6B1S5]]>
            </zipCode>
            <birthDate>N/A</birthDate>
            <dateCreated>2021-11-23 12:26:51</dateCreated>
            <userCustomFields>
                <customField>
                    <customFieldId>1</customFieldId>
                    <customFieldRequired>true</customFieldRequired>
                    <customFieldLabel>
                        <![CDATA[Test Custom Field ]]>
                    </customFieldLabel>
                    <customFieldValue>
                        <![CDATA[]]>
                    </customFieldValue>
                </customField>
            </userCustomFields>
            <relatedBookings>
                <totalNumberOfBookings>0</totalNumberOfBookings>
                <totalPurchases>$0.00</totalPurchases>
                <mostRecentBookingCount>0</mostRecentBookingCount>
                <allBookings/>
            </relatedBookings>
        </guestDetails>
        <methodErrorCode>0</methodErrorCode>
        <methodErrorMessage>
            <![CDATA[Updated]]>
        </methodErrorMessage>
    </methodResponse>
</response>
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Request" %}

```xml
<request>
	<zapiToken></zapiToken>
	<zapiAccountId></zapiAccountId>
	<zapiUserId></zapiUserId>
	<zapiMethod>
		<methodName>zapiAgents_UpdateUsername</methodName>
		<agentID></agentID>
		<agentHashKey></agentHashKey>
		<username></username>
	</zapiMethod>
</request>
```

{% endtab %}

{% tab title="Response" %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<response>
    <zapiVersion>2.1</zapiVersion>
    <error>0</error>
    <message>OK</message>
    <methodResponse>
        <methodName>zapiAgents_UpdateUsername</methodName>
        <agentDetails>
            <agentID></agentID>
            <agentHashKey></agentHashKey>
            <accountId></accountId>
            <expiryDate></expiryDate>
            <username></username>
            <firstName></firstName>
            <lastName></lastName>
            <gender></gender>
            <mobilePhone></mobilePhone>
            <email></email>
            <addressLine1></addressLine1>
            <addressLine2></addressLine2>
            <city></city>
            <state></state>
            <country></country>
            <zipCode></zipCode>
            <birthDate></birthDate>
            <dateCreated></dateCreated>
            <userCustomFields>
                <customField>
                    <customFieldId></customFieldId>
                    <customFieldRequired></customFieldRequired>
                    <customFieldLabel></customFieldLabel>
                    <customFieldValue></customFieldValue>
                </customField>
            </userCustomFields>
            <relatedBookings>
                <totalNumberOfBookings></totalNumberOfBookings>
                <totalPurchases></totalPurchases>
                <mostRecentBookingCount></mostRecentBookingCount>
                <allBookings></allBookings>
            </relatedBookings>
        </guestDetails>
        <methodErrorCode></methodErrorCode>
        <methodErrorMessage></methodErrorMessage>
    </methodResponse>
</response>
```

{% endtab %}
{% endtabs %}
