# PUT /customer/{{customer_id}} — Update Customer Detail

> Product: **Pabbly Subscription Billing** (v1)
> Base URL: `https://payments.pabbly.com/api/v1`
> Auth: Basic via `Authorization` header
> Canonical: `/subscription-billing/customers/update-customer-detail`

This is a PUT request API in which you will add the customer Id in Request URL. In response you will get the new details of the customer on same customer Id. That means the customer Id will remain the same but the details will be changed.

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| customer_id | string | Yes |  |

**Body parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| first_name | string | No | Update the First Name of your customer. |
| last_name | string | No | Update the Last Name of your customer. |
| company_name | string | No | Update the Customer's company name. |
| website | string | No | Update the Customer's website name. |
| phone | string | No | Update the Customer's phone number. |
| enable_portal | string | No | Value will be yes/no |
| enable_affiliate | string | No | Value will be yes/no |
| billing_address | object | No | Update the billing address of the custoemr. |
|   ↳ attention | string | No |  |
|   ↳ street1 | string | No |  |
|   ↳ street2 | string | No |  |
|   ↳ city | string | No |  |
|   ↳ state | string | No |  |
|   ↳ zip_code | string | No |  |
|   ↳ country | string | No |  |
| shipping_address | object | No | Update the shipping address of the customer. |
|   ↳ attention | string | No |  |
|   ↳ street1 | string | No |  |
|   ↳ street2 | string | No |  |
|   ↳ city | string | No |  |
|   ↳ state | string | No |  |
|   ↳ zip_code | string | No |  |
|   ↳ country | string | No |  |
| email_id | string | No | Update the Email Address of your customer. |

**Example request body:**

```json
{
    "first_name": "Lance",
    "last_name": "Crews",
    "company_name": "Omni Source",
    "website": "anstudios.com",
    "phone": "406-775-3868",
    "enable_portal": "yes",
    "enable_affiliate": "yes",
    "billing_address": {
        "attention": "Mr. Lance Crews",
        "street1": "936 Tibbs Avenue",
        "street2": "Jenna Lane",
        "city": "Ekalaka",
        "state": "MT",
        "zip_code": "59324",
        "country": "US"
    },
    "shipping_address": {
        "attention": "Mr. Lance Crews",
        "street1": "936 Tibbs Avenue",
        "street2": "Jenna Lane",
        "city": "Ekalaka",
        "state": "MT",
        "zip_code": "59324",
        "country": "US"
    }
}
```

**Response (200)** — Update Customer Detail:

```json
{
    "status": "success",
    "message": "Customer profile updated",
    "data": {
        "company_name": "Omni Source",
        "is_affiliate": true,
        "phone": "406-775-3868",
        "billing_address": {
            "attention": "Mr. Lance Crews",
            "street1": "936 Tibbs Avenue",
            "street2": "Jenna Lane",
            "city": "Ekalaka",
            "state": "MT",
            "state_code": "MP",
            "zip_code": "59324",
            "country": "US"
        },
        "shipping_address": {
            "attention": "Mr. Lance Crews",
            "street1": "936 Tibbs Avenue",
            "street2": "Jenna Lane",
            "city": "Ekalaka",
            "state": "MT",
            "state_code": "",
            "zip_code": "59324",
            "country": "US"
        },
        "portal_status": true,
        "createdAt": "2022-03-11T10:05:00.387Z",
        "updatedAt": "2022-03-11T10:05:00.387Z",
        "id": "622b1eccef109b712df5e547",
        "first_name": "Lance",
        "last_name": "Crews",
        "email_id": "katielee@gmail.com"
    }
}
```

**Code examples:**

_cURL_

```curl
curl -X PUT https://payments.pabbly.com/api/v1/customer/{{customer_id}} \
  -u {{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}} \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "Lance",
    "last_name": "Crews",
    "company_name": "Omni Source",
    "website": "anstudios.com",
    "phone": "406-775-3868",
    "enable_portal": "yes",
    "enable_affiliate": "yes",
    "billing_address": {
      "attention": "Mr. Lance Crews",
      "street1": "936 Tibbs Avenue",
      "street2": "Jenna Lane",
      "city": "Ekalaka",
      "state": "MT",
      "zip_code": "59324",
      "country": "US"
    },
    "shipping_address": {
      "attention": "Mr. Lance Crews",
      "street1": "936 Tibbs Avenue",
      "street2": "Jenna Lane",
      "city": "Ekalaka",
      "state": "MT",
      "zip_code": "59324",
      "country": "US"
    }
  }'
```

_Ruby_

```ruby
require 'net/http'
require 'json'

uri = URI('https://payments.pabbly.com/api/v1/customer/{{customer_id}}')
request = Net::HTTP::Put.new(uri)
request.basic_auth '{{YOUR_API_KEY}}', '{{YOUR_SECRET_KEY}}'
request['Content-Type'] = 'application/json'
request.body = "{\"first_name\":\"Lance\",\"last_name\":\"Crews\",\"company_name\":\"Omni Source\",\"website\":\"anstudios.com\",\"phone\":\"406-775-3868\",\"enable_portal\":\"yes\",\"enable_affiliate\":\"yes\",\"billing_address\":{\"attention\":\"Mr. Lance Crews\",\"street1\":\"936 Tibbs Avenue\",\"street2\":\"Jenna Lane\",\"city\":\"Ekalaka\",\"state\":\"MT\",\"zip_code\":\"59324\",\"country\":\"US\"},\"shipping_address\":{\"attention\":\"Mr. Lance Crews\",\"street1\":\"936 Tibbs Avenue\",\"street2\":\"Jenna Lane\",\"city\":\"Ekalaka\",\"state\":\"MT\",\"zip_code\":\"59324\",\"country\":\"US\"}}"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(request)
end

data = JSON.parse(response.body)
```

_Python_

```python
import requests
from requests.auth import HTTPBasicAuth

response = requests.put(
    'https://payments.pabbly.com/api/v1/customer/{{customer_id}}',
    auth=HTTPBasicAuth('{{YOUR_API_KEY}}', '{{YOUR_SECRET_KEY}}'),
    json={
    'first_name': 'Lance',
    'last_name': 'Crews',
    'company_name': 'Omni Source',
    'website': 'anstudios.com',
    'phone': '406-775-3868',
    'enable_portal': 'yes',
    'enable_affiliate': 'yes',
    'billing_address': {
        'attention': 'Mr. Lance Crews',
        'street1': '936 Tibbs Avenue',
        'street2': 'Jenna Lane',
        'city': 'Ekalaka',
        'state': 'MT',
        'zip_code': '59324',
        'country': 'US'
    },
    'shipping_address': {
        'attention': 'Mr. Lance Crews',
        'street1': '936 Tibbs Avenue',
        'street2': 'Jenna Lane',
        'city': 'Ekalaka',
        'state': 'MT',
        'zip_code': '59324',
        'country': 'US'
    }
},
)

data = response.json()
```

_PHP_

```php
<?php
$ch = curl_init('https://payments.pabbly.com/api/v1/customer/{{customer_id}}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_USERPWD, '{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"first_name":"Lance","last_name":"Crews","company_name":"Omni Source","website":"anstudios.com","phone":"406-775-3868","enable_portal":"yes","enable_affiliate":"yes","billing_address":{"attention":"Mr. Lance Crews","street1":"936 Tibbs Avenue","street2":"Jenna Lane","city":"Ekalaka","state":"MT","zip_code":"59324","country":"US"},"shipping_address":{"attention":"Mr. Lance Crews","street1":"936 Tibbs Avenue","street2":"Jenna Lane","city":"Ekalaka","state":"MT","zip_code":"59324","country":"US"}}');

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

_Java_

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;

String credentials = Base64.getEncoder().encodeToString("{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}".getBytes());

HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
    .uri(URI.create("https://payments.pabbly.com/api/v1/customer/{{customer_id}}"))
    .header("Authorization", "Basic " + credentials)
    .header("Content-Type", "application/json")
    .PUT(HttpRequest.BodyPublishers.ofString("{\"first_name\":\"Lance\",\"last_name\":\"Crews\",\"company_name\":\"Omni Source\",\"website\":\"anstudios.com\",\"phone\":\"406-775-3868\",\"enable_portal\":\"yes\",\"enable_affiliate\":\"yes\",\"billing_address\":{\"attention\":\"Mr. Lance Crews\",\"street1\":\"936 Tibbs Avenue\",\"street2\":\"Jenna Lane\",\"city\":\"Ekalaka\",\"state\":\"MT\",\"zip_code\":\"59324\",\"country\":\"US\"},\"shipping_address\":{\"attention\":\"Mr. Lance Crews\",\"street1\":\"936 Tibbs Avenue\",\"street2\":\"Jenna Lane\",\"city\":\"Ekalaka\",\"state\":\"MT\",\"zip_code\":\"59324\",\"country\":\"US\"}}"));

HttpRequest request = builder.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

_Node.js_

```node
const credentials = Buffer.from('{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}').toString('base64');

const response = await fetch('https://payments.pabbly.com/api/v1/customer/{{customer_id}}', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${credentials}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "first_name": "Lance",
    "last_name": "Crews",
    "company_name": "Omni Source",
    "website": "anstudios.com",
    "phone": "406-775-3868",
    "enable_portal": "yes",
    "enable_affiliate": "yes",
    "billing_address": {
      "attention": "Mr. Lance Crews",
      "street1": "936 Tibbs Avenue",
      "street2": "Jenna Lane",
      "city": "Ekalaka",
      "state": "MT",
      "zip_code": "59324",
      "country": "US"
    },
    "shipping_address": {
      "attention": "Mr. Lance Crews",
      "street1": "936 Tibbs Avenue",
      "street2": "Jenna Lane",
      "city": "Ekalaka",
      "state": "MT",
      "zip_code": "59324",
      "country": "US"
    }
  }),
});

const data = await response.json();
```

_Go_

```go
package main

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

func main() {
    payload := strings.NewReader("{\"first_name\":\"Lance\",\"last_name\":\"Crews\",\"company_name\":\"Omni Source\",\"website\":\"anstudios.com\",\"phone\":\"406-775-3868\",\"enable_portal\":\"yes\",\"enable_affiliate\":\"yes\",\"billing_address\":{\"attention\":\"Mr. Lance Crews\",\"street1\":\"936 Tibbs Avenue\",\"street2\":\"Jenna Lane\",\"city\":\"Ekalaka\",\"state\":\"MT\",\"zip_code\":\"59324\",\"country\":\"US\"},\"shipping_address\":{\"attention\":\"Mr. Lance Crews\",\"street1\":\"936 Tibbs Avenue\",\"street2\":\"Jenna Lane\",\"city\":\"Ekalaka\",\"state\":\"MT\",\"zip_code\":\"59324\",\"country\":\"US\"}}")
    req, _ := http.NewRequest("PUT", "https://payments.pabbly.com/api/v1/customer/{{customer_id}}", payload)
    req.Header.Set("Content-Type", "application/json")
    req.SetBasicAuth("{{YOUR_API_KEY}}", "{{YOUR_SECRET_KEY}}")

    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    fmt.Println(string(body))
}
```

_.NET_

```dotnet
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}"));

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "https://payments.pabbly.com/api/v1/customer/{{customer_id}}");
request.Headers.TryAddWithoutValidation("Authorization", $"Basic {credentials}");
request.Content = new StringContent("{\"first_name\":\"Lance\",\"last_name\":\"Crews\",\"company_name\":\"Omni Source\",\"website\":\"anstudios.com\",\"phone\":\"406-775-3868\",\"enable_portal\":\"yes\",\"enable_affiliate\":\"yes\",\"billing_address\":{\"attention\":\"Mr. Lance Crews\",\"street1\":\"936 Tibbs Avenue\",\"street2\":\"Jenna Lane\",\"city\":\"Ekalaka\",\"state\":\"MT\",\"zip_code\":\"59324\",\"country\":\"US\"},\"shipping_address\":{\"attention\":\"Mr. Lance Crews\",\"street1\":\"936 Tibbs Avenue\",\"street2\":\"Jenna Lane\",\"city\":\"Ekalaka\",\"state\":\"MT\",\"zip_code\":\"59324\",\"country\":\"US\"}}");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

var response = await client.SendAsync(request);
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
```

---

**Other endpoints in Customers:**

- [GET /customer/{{customer_id}} — Get Single Customer via Customer ID](/subscription-billing/customers/get-single-customer-via-customer-id)
- [GET /customer/ — Get Single Customer via Customer Email](/subscription-billing/customers/get-single-customer-via-customer-email)
- [GET /customer/purchase-info/{{customer_id}} — Get Customer Purchase Information](/subscription-billing/customers/get-customer-purchase-information)
- [GET /customers — List All Customers](/subscription-billing/customers/list-all-customers)
- [POST /subscription — Create Customer With Subscription](/subscription-billing/customers/create-customer-with-subscription)
- [DELETE /customers/{{customer_id}} — Delete Customer](/subscription-billing/customers/delete-customer)
- [POST /customer — Create Customer](/subscription-billing/customers/create-customer)

