# Update customer PUT https://api-sandbox.payabli.com/api/Customer/{customerId} Content-Type: application/json Update a customer record. Include only the fields you want to change. Reference: https://docs.payabli.com/developers/api-reference/customer/update-customer-record ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Update customer record version: endpoint_customer.UpdateCustomer paths: /Customer/{customerId}: put: operationId: update-customer summary: Update customer record description: Update a customer record. Include only the fields you want to change. tags: - - subpackage_customer parameters: - name: customerId in: path description: >- Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. required: true schema: type: integer - name: requestToken in: header required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: >- #/components/schemas/type_:PayabliApiResponse00Responsedatanonobject '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/type_:CustomerData' components: schemas: type_:CustomerNumberNullable: type: string type_:CustomerStatus: type: integer type_:Email: type: string format: email type_:Shippingaddress: type: string type_:Shippingaddressadditional: type: string type_:Shippingcity: type: string type_:Shippingstate: type: string type_:Shippingzip: type: string type_:Shippingcountry: type: string type_:Timezone: type: integer type_:Identifierfields: type: array items: type: string type_:CreatedAt: type: string format: date-time type_:CustomerData: type: object properties: customerNumber: $ref: '#/components/schemas/type_:CustomerNumberNullable' customerUsername: type: string description: Customer username for customer portal customerPsw: type: string description: Customer password for customer portal customerStatus: $ref: '#/components/schemas/type_:CustomerStatus' company: type: string description: Company name firstname: type: string description: Customer first name lastname: type: string description: Customer last name phone: type: string description: Customer phone number email: $ref: '#/components/schemas/type_:Email' description: Customer email address. address: type: string description: Customer address address1: type: string description: Additional customer address city: type: string description: Customer city state: type: string description: Customer State zip: type: string description: Customer postal code country: type: string description: >- Customer country in ISO-3166-1 alpha 2 format. See https://en.wikipedia.org/wiki/ISO_3166-1 for reference. shippingAddress: $ref: '#/components/schemas/type_:Shippingaddress' shippingAddress1: $ref: '#/components/schemas/type_:Shippingaddressadditional' shippingCity: $ref: '#/components/schemas/type_:Shippingcity' shippingState: $ref: '#/components/schemas/type_:Shippingstate' shippingZip: $ref: '#/components/schemas/type_:Shippingzip' shippingCountry: $ref: '#/components/schemas/type_:Shippingcountry' balance: type: number format: double description: Customer balance. timeZone: $ref: '#/components/schemas/type_:Timezone' additionalFields: type: object additionalProperties: type: string description: Additional Custom fields in format "key":"value". identifierFields: $ref: '#/components/schemas/type_:Identifierfields' createdAt: $ref: '#/components/schemas/type_:CreatedAt' type_:Responsecode: type: integer type_:PageIdentifier: type: string type_:IsSuccess: type: boolean type_:ResponseText: type: string type_:Responsedatanonobject: oneOf: - type: string - type: integer type_:PayabliApiResponse00Responsedatanonobject: type: object properties: responseCode: $ref: '#/components/schemas/type_:Responsecode' pageIdentifier: $ref: '#/components/schemas/type_:PageIdentifier' roomId: type: integer format: int64 description: >- Describes the room ID. Only in use on Boarding endpoints, returns `0` when not applicable. isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseText: $ref: '#/components/schemas/type_:ResponseText' responseData: $ref: '#/components/schemas/type_:Responsedatanonobject' required: - responseText ``` ## SDK Code Examples ```python UpdateCustomer from payabli import payabli client = payabli( api_key="YOUR_API_KEY", ) client.customer.update_customer( customer_id=998, firstname="Irene", lastname="Canizales", address_1="145 Bishop's Trail", city="Mountain City", state="TN", zip="37612", country="US", ) ``` ```typescript UpdateCustomer import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.customer.updateCustomer(998, { firstname: "Irene", lastname: "Canizales", address1: "145 Bishop's Trail", city: "Mountain City", state: "TN", zip: "37612", country: "US" }); ``` ```go UpdateCustomer import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.Customer.UpdateCustomer( context.TODO(), 998, &sdkgo.CustomerData{ Firstname: sdkgo.String( "Irene", ), Lastname: sdkgo.String( "Canizales", ), Address1: sdkgo.String( "145 Bishop's Trail", ), City: sdkgo.String( "Mountain City", ), State: sdkgo.String( "TN", ), Zip: sdkgo.String( "37612", ), Country: sdkgo.String( "US", ), }, ) ``` ```csharp UpdateCustomer using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.Customer.UpdateCustomerAsync( 998, new CustomerData { Firstname = "Irene", Lastname = "Canizales", Address1 = "145 Bishop's Trail", City = "Mountain City", State = "TN", Zip = "37612", Country = "US", } ); ``` ```ruby UpdateCustomer require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Customer/998") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"firstname\": \"Irene\",\n \"lastname\": \"Canizales\",\n \"address1\": \"145 Bishop's Trail\",\n \"city\": \"Mountain City\",\n \"state\": \"TN\",\n \"zip\": \"37612\",\n \"country\": \"US\"\n}" response = http.request(request) puts response.read_body ``` ```java UpdateCustomer HttpResponse response = Unirest.put("https://api-sandbox.payabli.com/api/Customer/998") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"firstname\": \"Irene\",\n \"lastname\": \"Canizales\",\n \"address1\": \"145 Bishop's Trail\",\n \"city\": \"Mountain City\",\n \"state\": \"TN\",\n \"zip\": \"37612\",\n \"country\": \"US\"\n}") .asString(); ``` ```php UpdateCustomer request('PUT', 'https://api-sandbox.payabli.com/api/Customer/998', [ 'body' => '{ "firstname": "Irene", "lastname": "Canizales", "address1": "145 Bishop\'s Trail", "city": "Mountain City", "state": "TN", "zip": "37612", "country": "US" }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift UpdateCustomer import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "firstname": "Irene", "lastname": "Canizales", "address1": "145 Bishop's Trail", "city": "Mountain City", "state": "TN", "zip": "37612", "country": "US" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Customer/998")! 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() ```