# UPDATE WITHDRAW ADDRESS

PATCH https://api.gwapialoha.co/api/agents/[AGENT_ID]/customers/0809991234/withdraw/address
Content-Type: application/json

Updates the withdrawal destination address for a specific customer.

**Method:** `PATCH`  
**URL:** `{{ENDPOINT}}/{{AGENT_ID}}/customers/0809991234/withdraw/address`

### Parameters

| Variable / Segment | Description |
|---|---|
| `{{ENDPOINT}}` | Base URL of the API server |
| `{{AGENT_ID}}` | Unique identifier of the agent managing the customer |
| `0809991234` | The customer's phone number or unique identifier |

### Request Body
Provide the new withdrawal address details as a JSON payload. Typically includes the new wallet address and possibly the network/chain type.

### Authentication
Requires an API key passed via the `x-api-key` request header using the `{{API_KEY}}` environment variable.

### Notes
- This is a partial update (`PATCH`), so only the fields provided in the request body will be modified.
- Replace `0809991234` with the actual customer identifier when using this request.
- Ensure the new address is valid for the intended blockchain network before submitting.

Reference: https://docs.gwapialoha.co/web-api/update-withdraw-address

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /[AGENT_ID]/customers/0809991234/withdraw/address:
    patch:
      operationId: update-withdraw-address
      summary: UPDATE WITHDRAW ADDRESS
      description: >-
        Updates the withdrawal destination address for a specific customer.


        **Method:** `PATCH`  

        **URL:**
        `{{ENDPOINT}}/{{AGENT_ID}}/customers/0809991234/withdraw/address`


        ### Parameters


        | Variable / Segment | Description |

        |---|---|

        | `{{ENDPOINT}}` | Base URL of the API server |

        | `{{AGENT_ID}}` | Unique identifier of the agent managing the customer
        |

        | `0809991234` | The customer's phone number or unique identifier |


        ### Request Body

        Provide the new withdrawal address details as a JSON payload. Typically
        includes the new wallet address and possibly the network/chain type.


        ### Authentication

        Requires an API key passed via the `x-api-key` request header using the
        `{{API_KEY}}` environment variable.


        ### Notes

        - This is a partial update (`PATCH`), so only the fields provided in the
        request body will be modified.

        - Replace `0809991234` with the actual customer identifier when using
        this request.

        - Ensure the new address is valid for the intended blockchain network
        before submitting.
      tags:
        - ''
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UPDATE WITHDRAW ADDRESS_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                chain:
                  type: string
                address:
                  type: string
              required:
                - chain
                - address
servers:
  - url: https://api.gwapialoha.co/api/agents
components:
  schemas:
    UPDATE WITHDRAW ADDRESS_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: UPDATE WITHDRAW ADDRESS_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

```

## SDK Code Examples

```python
import requests

url = "https://api.gwapialoha.co/api/agents/[AGENT_ID]/customers/0809991234/withdraw/address"

payload = {
    "chain": "tron",
    "address": "TBZ478qUF6RYenTN3RjcFGpQi2kg9EW9CJ"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.gwapialoha.co/api/agents/[AGENT_ID]/customers/0809991234/withdraw/address';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"chain":"tron","address":"TBZ478qUF6RYenTN3RjcFGpQi2kg9EW9CJ"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.gwapialoha.co/api/agents/[AGENT_ID]/customers/0809991234/withdraw/address"

	payload := strings.NewReader("{\n  \"chain\": \"tron\",\n  \"address\": \"TBZ478qUF6RYenTN3RjcFGpQi2kg9EW9CJ\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.gwapialoha.co/api/agents/[AGENT_ID]/customers/0809991234/withdraw/address")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"chain\": \"tron\",\n  \"address\": \"TBZ478qUF6RYenTN3RjcFGpQi2kg9EW9CJ\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.gwapialoha.co/api/agents/[AGENT_ID]/customers/0809991234/withdraw/address")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"chain\": \"tron\",\n  \"address\": \"TBZ478qUF6RYenTN3RjcFGpQi2kg9EW9CJ\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.gwapialoha.co/api/agents/[AGENT_ID]/customers/0809991234/withdraw/address', [
  'body' => '{
  "chain": "tron",
  "address": "TBZ478qUF6RYenTN3RjcFGpQi2kg9EW9CJ"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.gwapialoha.co/api/agents/[AGENT_ID]/customers/0809991234/withdraw/address");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"chain\": \"tron\",\n  \"address\": \"TBZ478qUF6RYenTN3RjcFGpQi2kg9EW9CJ\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "chain": "tron",
  "address": "TBZ478qUF6RYenTN3RjcFGpQi2kg9EW9CJ"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.gwapialoha.co/api/agents/[AGENT_ID]/customers/0809991234/withdraw/address")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```