> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.sqril.io/llms.txt.
> For full documentation content, see https://docs.sqril.io/llms-full.txt.

# Update Customer

PUT https://api.sqril.com/updateCustomer
Content-Type: application/json

Updates an existing registered customer profile for the authenticated account.

**Authentication:**
- **REQUIRED**: Basic Auth only.

**Query Parameters:**
- `customer_id` (required): Customer identifier returned by `registerCustomer`.

**Request Body:**
- Provide one or more updatable sender fields.
- `name_first` and `name_last` are immutable and cannot be updated.

**Response:**
- Returns updated flat sender profile with `customer_id` and timestamps.

**Field code references:**
- `ic_type` must be one of the supported identification document type codes: `NIC`, `PP`, `WEP`.
- `occupation` must be one of the supported occupation codes: `OCC1` through `OCC11`.

Reference: https://docs.sqril.io/sqril-saa-s-api/payout-endpoints/update-customer

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /updateCustomer:
    put:
      operationId: update-customer
      summary: Update Customer
      description: >-
        Updates an existing registered customer profile for the authenticated
        account.


        **Authentication:**

        - **REQUIRED**: Basic Auth only.


        **Query Parameters:**

        - `customer_id` (required): Customer identifier returned by
        `registerCustomer`.


        **Request Body:**

        - Provide one or more updatable sender fields.

        - `name_first` and `name_last` are immutable and cannot be updated.


        **Response:**

        - Returns updated flat sender profile with `customer_id` and timestamps.


        **Field code references:**

        - `ic_type` must be one of the supported identification document type
        codes: `NIC`, `PP`, `WEP`.

        - `occupation` must be one of the supported occupation codes: `OCC1`
        through `OCC11`.
      tags:
        - subpackage_payoutEndpoints
      parameters:
        - name: customer_id
          in: query
          description: 'Required: customer_id returned by registerCustomer'
          required: false
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Payout Endpoints_Update
                  Customer_Response_200
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PutUpdatecustomerRequestBadRequestError'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                phone:
                  type: string
                occupation:
                  type: string
                address:
                  type: string
              required:
                - email
                - phone
                - occupation
                - address
servers:
  - url: https://api.sqril.com
  - url: https://your-app.com
components:
  schemas:
    Payout Endpoints_Update Customer_Response_200:
      type: object
      properties:
        customer_id:
          type: string
        name_first:
          type: string
        name_last:
          type: string
        gender:
          type: string
        ic_number:
          type: string
        ic_type:
          type: string
        ic_country:
          type: string
        occupation:
          type: string
        country_of_residence:
          type: string
        phone:
          type: string
        email:
          type: string
          format: email
        nationality:
          type: string
        dob:
          type: string
          format: date
        address:
          type: string
        ic_expiry_date:
          type: string
          format: date
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - customer_id
        - name_first
        - name_last
        - gender
        - ic_number
        - ic_type
        - ic_country
        - occupation
        - country_of_residence
        - phone
        - email
        - nationality
        - dob
        - address
        - ic_expiry_date
        - created_at
        - updated_at
      title: Payout Endpoints_Update Customer_Response_200
    UpdateCustomerPutResponsesContentApplicationJsonSchemaDetails:
      type: object
      properties:
        immutable_fields:
          type: array
          items:
            type: string
      required:
        - immutable_fields
      title: UpdateCustomerPutResponsesContentApplicationJsonSchemaDetails
    PutUpdatecustomerRequestBadRequestError:
      type: object
      properties:
        error_code:
          type: string
        error_message:
          type: string
        details:
          $ref: >-
            #/components/schemas/UpdateCustomerPutResponsesContentApplicationJsonSchemaDetails
      required:
        - error_code
        - error_message
        - details
      title: PutUpdatecustomerRequestBadRequestError

```

## SDK Code Examples

```python Payout Endpoints_Update Customer_example
import requests

url = "https://api.sqril.com/updateCustomer"

querystring = {"customer_id":"{{customer_id}}"}

payload = {
    "email": "john.updated@example.com",
    "phone": "+62812345679",
    "occupation": "OCC10",
    "address": "Jl. Thamrin No. 88, Jakarta"
}
headers = {"Content-Type": "application/json"}

response = requests.put(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript Payout Endpoints_Update Customer_example
const url = 'https://api.sqril.com/updateCustomer?customer_id=%7B%7Bcustomer_id%7D%7D';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json'},
  body: '{"email":"john.updated@example.com","phone":"+62812345679","occupation":"OCC10","address":"Jl. Thamrin No. 88, Jakarta"}'
};

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

```go Payout Endpoints_Update Customer_example
package main

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

func main() {

	url := "https://api.sqril.com/updateCustomer?customer_id=%7B%7Bcustomer_id%7D%7D"

	payload := strings.NewReader("{\n  \"email\": \"john.updated@example.com\",\n  \"phone\": \"+62812345679\",\n  \"occupation\": \"OCC10\",\n  \"address\": \"Jl. Thamrin No. 88, Jakarta\"\n}")

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

	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 Payout Endpoints_Update Customer_example
require 'uri'
require 'net/http'

url = URI("https://api.sqril.com/updateCustomer?customer_id=%7B%7Bcustomer_id%7D%7D")

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

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"email\": \"john.updated@example.com\",\n  \"phone\": \"+62812345679\",\n  \"occupation\": \"OCC10\",\n  \"address\": \"Jl. Thamrin No. 88, Jakarta\"\n}"

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

```java Payout Endpoints_Update Customer_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.sqril.com/updateCustomer?customer_id=%7B%7Bcustomer_id%7D%7D")
  .header("Content-Type", "application/json")
  .body("{\n  \"email\": \"john.updated@example.com\",\n  \"phone\": \"+62812345679\",\n  \"occupation\": \"OCC10\",\n  \"address\": \"Jl. Thamrin No. 88, Jakarta\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.sqril.com/updateCustomer?customer_id=%7B%7Bcustomer_id%7D%7D', [
  'body' => '{
  "email": "john.updated@example.com",
  "phone": "+62812345679",
  "occupation": "OCC10",
  "address": "Jl. Thamrin No. 88, Jakarta"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Payout Endpoints_Update Customer_example
using RestSharp;

var client = new RestClient("https://api.sqril.com/updateCustomer?customer_id=%7B%7Bcustomer_id%7D%7D");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"email\": \"john.updated@example.com\",\n  \"phone\": \"+62812345679\",\n  \"occupation\": \"OCC10\",\n  \"address\": \"Jl. Thamrin No. 88, Jakarta\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Payout Endpoints_Update Customer_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "email": "john.updated@example.com",
  "phone": "+62812345679",
  "occupation": "OCC10",
  "address": "Jl. Thamrin No. 88, Jakarta"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sqril.com/updateCustomer?customer_id=%7B%7Bcustomer_id%7D%7D")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```