# Put Sub-Account (Formerly Location)

PUT https://services.leadconnectorhq.com/locations/{locationId}

Update a Sub-Account (Formerly Location) based on the data provided

## Authentication

Send `Authorization: Bearer <token>` using:

- **Agency token: OAuth access token or Private Integration Token.** Scopes: `locations.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location Id |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2021-07-28"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/locations/{locationId}": {
      "put": {
        "summary": "Put Sub-Account (Formerly Location)",
        "operationId": "putSubaccountFormerlyLocation",
        "description": "Update a Sub-Account (Formerly Location) based on the data provided",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2021-07-28"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "description": "Location Id",
            "example": "ve9EPM428h8vShlRW1KT",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateLocationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful update response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateLocationSuccessfulResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Agency-Access": [
              "locations.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "UpdateLocationDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "Mark Shoes",
            "description": "The name for the sub-account/location"
          },
          "phone": {
            "type": "string",
            "example": "+1410039940",
            "description": "The phone number of the business for which sub-account is created"
          },
          "companyId": {
            "type": "string",
            "description": "Company/Agency Id",
            "example": "UAXssdawIWAWD"
          },
          "address": {
            "type": "string",
            "example": "4th fleet street",
            "description": "The address of the business for which sub-account is created"
          },
          "city": {
            "type": "string",
            "example": "New York",
            "description": "The city where the business is located for which sub-account is created"
          },
          "state": {
            "type": "string",
            "example": "Illinois",
            "description": "The state in which the business operates for which sub-account is created"
          },
          "country": {
            "type": "string",
            "example": "US",
            "description": "The country in which the business is present for which sub-account is created",
            "enum": [
              "AF",
              "AX",
              "AL",
              "DZ",
              "AS",
              "AD",
              "AO",
              "AI",
              "AQ",
              "AG",
              "AR",
              "AM",
              "AW",
              "AU",
              "AT",
              "AZ",
              "BS",
              "BH",
              "BD",
              "BB",
              "BY",
              "BE",
              "BZ",
              "BJ",
              "BM",
              "BT",
              "BO",
              "BA",
              "BW",
              "BV",
              "BR",
              "IO",
              "BN",
              "BG",
              "BF",
              "BI",
              "KH",
              "CM",
              "CA",
              "CV",
              "KY",
              "CF",
              "TD",
              "CL",
              "CN",
              "CX",
              "CC",
              "CO",
              "KM",
              "CG",
              "CD",
              "CK",
              "CR",
              "CI",
              "HR",
              "CU",
              "CY",
              "CZ",
              "DK",
              "DJ",
              "DM",
              "DO",
              "EC",
              "EG",
              "SV",
              "GQ",
              "ER",
              "EE",
              "ET",
              "FK",
              "FO",
              "FJ",
              "FI",
              "FR",
              "GF",
              "PF",
              "TF",
              "GA",
              "GM",
              "GE",
              "DE",
              "GH",
              "GI",
              "GR",
              "GL",
              "GD",
              "GP",
              "GU",
              "GT",
              "GG",
              "GN",
              "GW",
              "GY",
              "HT",
              "HM",
              "VA",
              "HN",
              "HK",
              "HU",
              "IS",
              "IN",
              "ID",
              "IR",
              "IQ",
              "IE",
              "IM",
              "IL",
              "IT",
              "JM",
              "JP",
              "JE",
              "JO",
              "KZ",
              "KE",
              "KI",
              "KP",
              "KR",
              "XK",
              "KW",
              "KG",
              "LA",
              "LV",
              "LB",
              "LS",
              "LR",
              "LY",
              "LI",
              "LT",
              "LU",
              "MO",
              "MK",
              "MG",
              "MW",
              "MY",
              "MV",
              "ML",
              "MT",
              "MH",
              "MQ",
              "MR",
              "MU",
              "YT",
              "MX",
              "FM",
              "MD",
              "MC",
              "MN",
              "ME",
              "MS",
              "MA",
              "MZ",
              "MM",
              "NA",
              "NR",
              "NP",
              "NL",
              "AN",
              "NC",
              "NZ",
              "NI",
              "NE",
              "NG",
              "NU",
              "NF",
              "MP",
              "NO",
              "OM",
              "PK",
              "PW",
              "PS",
              "PA",
              "PG",
              "PY",
              "PE",
              "PH",
              "PN",
              "PL",
              "PT",
              "PR",
              "QA",
              "RE",
              "RO",
              "RU",
              "RW",
              "SH",
              "KN",
              "LC",
              "MF",
              "PM",
              "VC",
              "WS",
              "SM",
              "ST",
              "SA",
              "SN",
              "RS",
              "SC",
              "SL",
              "SG",
              "SX",
              "SK",
              "SI",
              "SB",
              "SO",
              "ZA",
              "GS",
              "ES",
              "LK",
              "SD",
              "SR",
              "SJ",
              "SZ",
              "SE",
              "CH",
              "SY",
              "TW",
              "TJ",
              "TZ",
              "TH",
              "TL",
              "TG",
              "TK",
              "TO",
              "TT",
              "TN",
              "TR",
              "TM",
              "TC",
              "TV",
              "UG",
              "GB",
              "UA",
              "AE",
              "US",
              "UM",
              "UY",
              "UZ",
              "VU",
              "VE",
              "VN",
              "VG",
              "VI",
              "WF",
              "EH",
              "YE",
              "ZM",
              "ZW"
            ]
          },
          "postalCode": {
            "type": "string",
            "example": "567654",
            "description": "The postal code of the business for which sub-account is created"
          },
          "website": {
            "type": "string",
            "example": "https://yourwebsite.com",
            "description": "The website of the business for which sub-account is created"
          },
          "timezone": {
            "type": "string",
            "example": "US/Central",
            "description": "The timezone of the business for which sub-account is created"
          },
          "prospectInfo": {
            "example": {
              "firstName": "John",
              "lastName": "Doe",
              "email": "john.doe@mail.com"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "firstName": {
                    "type": "string",
                    "description": "First name of the prospect",
                    "example": "John"
                  },
                  "lastName": {
                    "type": "string",
                    "description": "Last name of the prospect",
                    "example": "Doe"
                  },
                  "email": {
                    "type": "string",
                    "description": "Email of the prospect",
                    "example": "john.doe@mail.com"
                  }
                },
                "required": [
                  "firstName",
                  "lastName",
                  "email"
                ],
                "title": "ProspectInfoDto"
              }
            ]
          },
          "settings": {
            "description": "The default settings for location",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "allowDuplicateContact": {
                    "type": "boolean",
                    "example": false
                  },
                  "allowDuplicateOpportunity": {
                    "type": "boolean",
                    "example": false
                  },
                  "allowFacebookNameMerge": {
                    "type": "boolean",
                    "example": false
                  },
                  "disableContactTimezone": {
                    "type": "boolean",
                    "example": false
                  }
                },
                "title": "SettingsSchema"
              }
            ]
          },
          "social": {
            "description": "The social media links for location",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "facebookUrl": {
                    "type": "string",
                    "description": "Facebook URL",
                    "example": "https://www.facebook.com/"
                  },
                  "googlePlus": {
                    "type": "string",
                    "description": "Googleplus URL",
                    "example": "https://www.googleplus.com/"
                  },
                  "linkedIn": {
                    "type": "string",
                    "description": "LinkedIn URL",
                    "example": "https://www.linkedIn.com/"
                  },
                  "foursquare": {
                    "type": "string",
                    "description": "Foursquare URL",
                    "example": "https://www.foursquare.com/"
                  },
                  "twitter": {
                    "type": "string",
                    "description": "Twitter URL",
                    "example": "https://www.foutwitterrsquare.com/"
                  },
                  "yelp": {
                    "type": "string",
                    "description": "Yelp URL",
                    "example": "https://www.yelp.com/"
                  },
                  "instagram": {
                    "type": "string",
                    "description": "Instagram URL",
                    "example": "https://www.instagram.com/"
                  },
                  "youtube": {
                    "type": "string",
                    "description": "Instagram URL",
                    "example": "https://www.youtube.com/"
                  },
                  "pinterest": {
                    "type": "string",
                    "description": "Instagram URL",
                    "example": "https://www.pinterest.com/"
                  },
                  "blogRss": {
                    "type": "string",
                    "description": "Instagram URL",
                    "example": "https://www.blogRss.com/"
                  },
                  "googlePlacesId": {
                    "type": "string",
                    "description": "Google Business Places ID",
                    "example": "ChIJJGPdVbQTrjsRGUkefteUeFk"
                  }
                },
                "title": "SocialSchema"
              }
            ]
          },
          "twilio": {
            "description": "(DEPRECATED) The twilio credentials for location",
            "deprecated": true,
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "sid": {
                    "type": "string",
                    "description": "SID provided by Twilio",
                    "example": "AC_XXXXXXXXXXX"
                  },
                  "authToken": {
                    "type": "string",
                    "description": "Auth token provided by Twilio",
                    "example": "77_XXXXXXXXXXX"
                  }
                },
                "required": [
                  "sid",
                  "authToken"
                ],
                "title": "TwilioSchema"
              }
            ]
          },
          "mailgun": {
            "description": "The mailgun credentials for location",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "apiKey": {
                    "type": "string",
                    "description": "API key provided by Mailgun",
                    "example": "key-XXXXXXXXXXX"
                  },
                  "domain": {
                    "type": "string",
                    "description": "Domain connected with Mailgun",
                    "example": "replies.yourdomain.com"
                  }
                },
                "required": [
                  "apiKey",
                  "domain"
                ],
                "title": "MailgunSchema"
              }
            ]
          },
          "snapshot": {
            "description": "The snapshot to be updated in the location.",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Snaptshot ID",
                    "example": "XXXXXXXXXXX"
                  },
                  "override": {
                    "type": "boolean",
                    "description": "If you want override all conflicted assets then pass true. Default value is false.",
                    "example": false,
                    "default": false
                  }
                },
                "required": [
                  "id"
                ],
                "title": "SnapshotPutSchema"
              }
            ]
          }
        },
        "required": [
          "companyId"
        ],
        "title": "UpdateLocationDto"
      },
      "CreateLocationSuccessfulResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Location Id",
            "example": "ve9EPM428h8vShlRW1KT"
          },
          "companyId": {
            "type": "string",
            "description": "Company/Agency Id",
            "example": "UAXssdawIWAWD"
          },
          "name": {
            "type": "string",
            "example": "Mark Shoes",
            "description": "The name for the sub-account/location"
          },
          "phone": {
            "type": "string",
            "example": "+1410039940",
            "description": "The phone number of the business for which sub-account is created"
          },
          "email": {
            "type": "string",
            "example": "john.doe@mail.com",
            "description": "The email for the sub-account/location"
          },
          "address": {
            "type": "string",
            "example": "4th fleet street",
            "description": "The address of the business for which sub-account is created"
          },
          "city": {
            "type": "string",
            "example": "New York",
            "description": "The city where the business is located for which sub-account is created"
          },
          "state": {
            "type": "string",
            "example": "Illinois",
            "description": "The state in which the business operates for which sub-account is created"
          },
          "domain": {
            "type": "string",
            "example": "test.msgsndr.com"
          },
          "country": {
            "type": "string",
            "example": "US",
            "description": "The country in which the business is present for which sub-account is created",
            "enum": [
              "AF",
              "AX",
              "AL",
              "DZ",
              "AS",
              "AD",
              "AO",
              "AI",
              "AQ",
              "AG",
              "AR",
              "AM",
              "AW",
              "AU",
              "AT",
              "AZ",
              "BS",
              "BH",
              "BD",
              "BB",
              "BY",
              "BE",
              "BZ",
              "BJ",
              "BM",
              "BT",
              "BO",
              "BA",
              "BW",
              "BV",
              "BR",
              "IO",
              "BN",
              "BG",
              "BF",
              "BI",
              "KH",
              "CM",
              "CA",
              "CV",
              "KY",
              "CF",
              "TD",
              "CL",
              "CN",
              "CX",
              "CC",
              "CO",
              "KM",
              "CG",
              "CD",
              "CK",
              "CR",
              "CI",
              "HR",
              "CU",
              "CY",
              "CZ",
              "DK",
              "DJ",
              "DM",
              "DO",
              "EC",
              "EG",
              "SV",
              "GQ",
              "ER",
              "EE",
              "ET",
              "FK",
              "FO",
              "FJ",
              "FI",
              "FR",
              "GF",
              "PF",
              "TF",
              "GA",
              "GM",
              "GE",
              "DE",
              "GH",
              "GI",
              "GR",
              "GL",
              "GD",
              "GP",
              "GU",
              "GT",
              "GG",
              "GN",
              "GW",
              "GY",
              "HT",
              "HM",
              "VA",
              "HN",
              "HK",
              "HU",
              "IS",
              "IN",
              "ID",
              "IR",
              "IQ",
              "IE",
              "IM",
              "IL",
              "IT",
              "JM",
              "JP",
              "JE",
              "JO",
              "KZ",
              "KE",
              "KI",
              "KP",
              "KR",
              "XK",
              "KW",
              "KG",
              "LA",
              "LV",
              "LB",
              "LS",
              "LR",
              "LY",
              "LI",
              "LT",
              "LU",
              "MO",
              "MK",
              "MG",
              "MW",
              "MY",
              "MV",
              "ML",
              "MT",
              "MH",
              "MQ",
              "MR",
              "MU",
              "YT",
              "MX",
              "FM",
              "MD",
              "MC",
              "MN",
              "ME",
              "MS",
              "MA",
              "MZ",
              "MM",
              "NA",
              "NR",
              "NP",
              "NL",
              "AN",
              "NC",
              "NZ",
              "NI",
              "NE",
              "NG",
              "NU",
              "NF",
              "MP",
              "NO",
              "OM",
              "PK",
              "PW",
              "PS",
              "PA",
              "PG",
              "PY",
              "PE",
              "PH",
              "PN",
              "PL",
              "PT",
              "PR",
              "QA",
              "RE",
              "RO",
              "RU",
              "RW",
              "SH",
              "KN",
              "LC",
              "MF",
              "PM",
              "VC",
              "WS",
              "SM",
              "ST",
              "SA",
              "SN",
              "RS",
              "SC",
              "SL",
              "SG",
              "SX",
              "SK",
              "SI",
              "SB",
              "SO",
              "ZA",
              "GS",
              "ES",
              "LK",
              "SD",
              "SR",
              "SJ",
              "SZ",
              "SE",
              "CH",
              "SY",
              "TW",
              "TJ",
              "TZ",
              "TH",
              "TL",
              "TG",
              "TK",
              "TO",
              "TT",
              "TN",
              "TR",
              "TM",
              "TC",
              "TV",
              "UG",
              "GB",
              "UA",
              "AE",
              "US",
              "UM",
              "UY",
              "UZ",
              "VU",
              "VE",
              "VN",
              "VG",
              "VI",
              "WF",
              "EH",
              "YE",
              "ZM",
              "ZW"
            ]
          },
          "postalCode": {
            "type": "string",
            "example": "567654",
            "description": "The postal code of the business for which sub-account is created"
          },
          "website": {
            "type": "string",
            "example": "https://yourwebsite.com",
            "description": "The website of the business for which sub-account is created"
          },
          "timezone": {
            "type": "string",
            "example": "US/Central",
            "description": "The timezone of the business for which sub-account is created"
          },
          "settings": {
            "description": "The default settings for location",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "allowDuplicateContact": {
                    "type": "boolean",
                    "example": false
                  },
                  "allowDuplicateOpportunity": {
                    "type": "boolean",
                    "example": false
                  },
                  "allowFacebookNameMerge": {
                    "type": "boolean",
                    "example": false
                  },
                  "disableContactTimezone": {
                    "type": "boolean",
                    "example": false
                  }
                },
                "title": "SettingsSchema"
              }
            ]
          },
          "social": {
            "description": "The social media links for location",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "facebookUrl": {
                    "type": "string",
                    "description": "Facebook URL",
                    "example": "https://www.facebook.com/"
                  },
                  "googlePlus": {
                    "type": "string",
                    "description": "Googleplus URL",
                    "example": "https://www.googleplus.com/"
                  },
                  "linkedIn": {
                    "type": "string",
                    "description": "LinkedIn URL",
                    "example": "https://www.linkedIn.com/"
                  },
                  "foursquare": {
                    "type": "string",
                    "description": "Foursquare URL",
                    "example": "https://www.foursquare.com/"
                  },
                  "twitter": {
                    "type": "string",
                    "description": "Twitter URL",
                    "example": "https://www.foutwitterrsquare.com/"
                  },
                  "yelp": {
                    "type": "string",
                    "description": "Yelp URL",
                    "example": "https://www.yelp.com/"
                  },
                  "instagram": {
                    "type": "string",
                    "description": "Instagram URL",
                    "example": "https://www.instagram.com/"
                  },
                  "youtube": {
                    "type": "string",
                    "description": "Instagram URL",
                    "example": "https://www.youtube.com/"
                  },
                  "pinterest": {
                    "type": "string",
                    "description": "Instagram URL",
                    "example": "https://www.pinterest.com/"
                  },
                  "blogRss": {
                    "type": "string",
                    "description": "Instagram URL",
                    "example": "https://www.blogRss.com/"
                  },
                  "googlePlacesId": {
                    "type": "string",
                    "description": "Google Business Places ID",
                    "example": "ChIJJGPdVbQTrjsRGUkefteUeFk"
                  }
                },
                "title": "SocialSchema"
              }
            ]
          }
        },
        "title": "CreateLocationSuccessfulResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      }
    }
  }
}
```

## HighLevel SDK Examples

**Node.js** (`@gohighlevel/api-client`)

```javascript
import HighLevel from '@gohighlevel/api-client';

const ghl = new HighLevel({
  privateIntegrationToken: '<PRIVATE_INTEGRATION_TOKEN>'
});

const body = {
  "name": "Mark Shoes",
  "phone": "+1410039940",
  "companyId": "UAXssdawIWAWD",
  "address": "4th fleet street",
  "city": "New York",
  "state": "Illinois",
  "country": "US",
  "postalCode": "567654",
  "website": "https://yourwebsite.com",
  "timezone": "US/Central",
  "prospectInfo": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@mail.com"
  },
  "settings": {
    "allowDuplicateContact": false,
    "allowDuplicateOpportunity": false,
    "allowFacebookNameMerge": false,
    "disableContactTimezone": false
  },
  "social": {
    "facebookUrl": "https://www.facebook.com/",
    "googlePlus": "https://www.googleplus.com/",
    "linkedIn": "https://www.linkedIn.com/",
    "foursquare": "https://www.foursquare.com/",
    "twitter": "https://www.foutwitterrsquare.com/",
    "yelp": "https://www.yelp.com/",
    "instagram": "https://www.instagram.com/",
    "youtube": "https://www.youtube.com/",
    "pinterest": "https://www.pinterest.com/",
    "blogRss": "https://www.blogRss.com/",
    "googlePlacesId": "ChIJJGPdVbQTrjsRGUkefteUeFk"
  },
  "twilio": {
    "sid": "AC_XXXXXXXXXXX",
    "authToken": "77_XXXXXXXXXXX"
  },
  "mailgun": {
    "apiKey": "key-XXXXXXXXXXX",
    "domain": "replies.yourdomain.com"
  },
  "snapshot": {
    "id": "XXXXXXXXXXX",
    "override": false
  }
};

const response = await ghl.locations.putSubaccountFormerlyLocation('<LOCATIONID>', body);
console.log(response);
```

**Python** (`gohighlevel-api-client`)

```python
from highlevel import HighLevel

client = HighLevel(
    private_integration_token='<PRIVATE_INTEGRATION_TOKEN>'
)

body = {
    "name": "Mark Shoes",
    "phone": "+1410039940",
    "companyId": "UAXssdawIWAWD",
    "address": "4th fleet street",
    "city": "New York",
    "state": "Illinois",
    "country": "US",
    "postalCode": "567654",
    "website": "https://yourwebsite.com",
    "timezone": "US/Central",
    "prospectInfo": {
        "firstName": "John",
        "lastName": "Doe",
        "email": "john.doe@mail.com"
    },
    "settings": {
        "allowDuplicateContact": false,
        "allowDuplicateOpportunity": false,
        "allowFacebookNameMerge": false,
        "disableContactTimezone": false
    },
    "social": {
        "facebookUrl": "https://www.facebook.com/",
        "googlePlus": "https://www.googleplus.com/",
        "linkedIn": "https://www.linkedIn.com/",
        "foursquare": "https://www.foursquare.com/",
        "twitter": "https://www.foutwitterrsquare.com/",
        "yelp": "https://www.yelp.com/",
        "instagram": "https://www.instagram.com/",
        "youtube": "https://www.youtube.com/",
        "pinterest": "https://www.pinterest.com/",
        "blogRss": "https://www.blogRss.com/",
        "googlePlacesId": "ChIJJGPdVbQTrjsRGUkefteUeFk"
    },
    "twilio": {
        "sid": "AC_XXXXXXXXXXX",
        "authToken": "77_XXXXXXXXXXX"
    },
    "mailgun": {
        "apiKey": "key-XXXXXXXXXXX",
        "domain": "replies.yourdomain.com"
    },
    "snapshot": {
        "id": "XXXXXXXXXXX",
        "override": false
    }
}

response = await client.locations.put_subaccount_formerly_location('<LOCATIONID>', body=body)
print(response)
```

**PHP** (`gohighlevel/api-client`)

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

use HighLevel\HighLevel;
use HighLevel\HighLevelConfig;

$config = new HighLevelConfig([
    'privateIntegrationToken' => '<PRIVATE_INTEGRATION_TOKEN>'
]);
$ghl = new HighLevel($config);

$body = [
    'name' => 'Mark Shoes',
    'phone' => '+1410039940',
    'companyId' => 'UAXssdawIWAWD',
    'address' => '4th fleet street',
    'city' => 'New York',
    'state' => 'Illinois',
    'country' => 'US',
    'postalCode' => '567654',
    'website' => 'https://yourwebsite.com',
    'timezone' => 'US/Central',
    'prospectInfo' => [
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john.doe@mail.com'
    ],
    'settings' => [
        'allowDuplicateContact' => false,
        'allowDuplicateOpportunity' => false,
        'allowFacebookNameMerge' => false,
        'disableContactTimezone' => false
    ],
    'social' => [
        'facebookUrl' => 'https://www.facebook.com/',
        'googlePlus' => 'https://www.googleplus.com/',
        'linkedIn' => 'https://www.linkedIn.com/',
        'foursquare' => 'https://www.foursquare.com/',
        'twitter' => 'https://www.foutwitterrsquare.com/',
        'yelp' => 'https://www.yelp.com/',
        'instagram' => 'https://www.instagram.com/',
        'youtube' => 'https://www.youtube.com/',
        'pinterest' => 'https://www.pinterest.com/',
        'blogRss' => 'https://www.blogRss.com/',
        'googlePlacesId' => 'ChIJJGPdVbQTrjsRGUkefteUeFk'
    ],
    'twilio' => [
        'sid' => 'AC_XXXXXXXXXXX',
        'authToken' => '77_XXXXXXXXXXX'
    ],
    'mailgun' => [
        'apiKey' => 'key-XXXXXXXXXXX',
        'domain' => 'replies.yourdomain.com'
    ],
    'snapshot' => [
        'id' => 'XXXXXXXXXXX',
        'override' => false
    ]
];

$response = $ghl->locations->putSubaccountFormerlyLocation('<LOCATIONID>', $body);
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X PUT 'https://services.leadconnectorhq.com/locations/<locationId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "Mark Shoes",
  "phone": "+1410039940",
  "companyId": "UAXssdawIWAWD",
  "address": "4th fleet street",
  "city": "New York",
  "state": "Illinois",
  "country": "US",
  "postalCode": "567654",
  "website": "https://yourwebsite.com",
  "timezone": "US/Central",
  "prospectInfo": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@mail.com"
  },
  "settings": {
    "allowDuplicateContact": false,
    "allowDuplicateOpportunity": false,
    "allowFacebookNameMerge": false,
    "disableContactTimezone": false
  },
  "social": {
    "facebookUrl": "https://www.facebook.com/",
    "googlePlus": "https://www.googleplus.com/",
    "linkedIn": "https://www.linkedIn.com/",
    "foursquare": "https://www.foursquare.com/",
    "twitter": "https://www.foutwitterrsquare.com/",
    "yelp": "https://www.yelp.com/",
    "instagram": "https://www.instagram.com/",
    "youtube": "https://www.youtube.com/",
    "pinterest": "https://www.pinterest.com/",
    "blogRss": "https://www.blogRss.com/",
    "googlePlacesId": "ChIJJGPdVbQTrjsRGUkefteUeFk"
  },
  "twilio": {
    "sid": "AC_XXXXXXXXXXX",
    "authToken": "77_XXXXXXXXXXX"
  },
  "mailgun": {
    "apiKey": "key-XXXXXXXXXXX",
    "domain": "replies.yourdomain.com"
  },
  "snapshot": {
    "id": "XXXXXXXXXXX",
    "override": false
  }
}'
```

**Node.js**

```javascript
const options = {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2021-07-28',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "name": "Mark Shoes",
      "phone": "+1410039940",
      "companyId": "UAXssdawIWAWD",
      "address": "4th fleet street",
      "city": "New York",
      "state": "Illinois",
      "country": "US",
      "postalCode": "567654",
      "website": "https://yourwebsite.com",
      "timezone": "US/Central",
      "prospectInfo": {
        "firstName": "John",
        "lastName": "Doe",
        "email": "john.doe@mail.com"
      },
      "settings": {
        "allowDuplicateContact": false,
        "allowDuplicateOpportunity": false,
        "allowFacebookNameMerge": false,
        "disableContactTimezone": false
      },
      "social": {
        "facebookUrl": "https://www.facebook.com/",
        "googlePlus": "https://www.googleplus.com/",
        "linkedIn": "https://www.linkedIn.com/",
        "foursquare": "https://www.foursquare.com/",
        "twitter": "https://www.foutwitterrsquare.com/",
        "yelp": "https://www.yelp.com/",
        "instagram": "https://www.instagram.com/",
        "youtube": "https://www.youtube.com/",
        "pinterest": "https://www.pinterest.com/",
        "blogRss": "https://www.blogRss.com/",
        "googlePlacesId": "ChIJJGPdVbQTrjsRGUkefteUeFk"
      },
      "twilio": {
        "sid": "AC_XXXXXXXXXXX",
        "authToken": "77_XXXXXXXXXXX"
      },
      "mailgun": {
        "apiKey": "key-XXXXXXXXXXX",
        "domain": "replies.yourdomain.com"
      },
      "snapshot": {
        "id": "XXXXXXXXXXX",
        "override": false
      }
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/locations/<locationId>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/locations/{locationId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2021-07-28"
}

payload = {
    "name": "Mark Shoes",
    "phone": "+1410039940",
    "companyId": "UAXssdawIWAWD",
    "address": "4th fleet street",
    "city": "New York",
    "state": "Illinois",
    "country": "US",
    "postalCode": "567654",
    "website": "https://yourwebsite.com",
    "timezone": "US/Central",
    "prospectInfo": {
        "firstName": "John",
        "lastName": "Doe",
        "email": "john.doe@mail.com"
    },
    "settings": {
        "allowDuplicateContact": false,
        "allowDuplicateOpportunity": false,
        "allowFacebookNameMerge": false,
        "disableContactTimezone": false
    },
    "social": {
        "facebookUrl": "https://www.facebook.com/",
        "googlePlus": "https://www.googleplus.com/",
        "linkedIn": "https://www.linkedIn.com/",
        "foursquare": "https://www.foursquare.com/",
        "twitter": "https://www.foutwitterrsquare.com/",
        "yelp": "https://www.yelp.com/",
        "instagram": "https://www.instagram.com/",
        "youtube": "https://www.youtube.com/",
        "pinterest": "https://www.pinterest.com/",
        "blogRss": "https://www.blogRss.com/",
        "googlePlacesId": "ChIJJGPdVbQTrjsRGUkefteUeFk"
    },
    "twilio": {
        "sid": "AC_XXXXXXXXXXX",
        "authToken": "77_XXXXXXXXXXX"
    },
    "mailgun": {
        "apiKey": "key-XXXXXXXXXXX",
        "domain": "replies.yourdomain.com"
    },
    "snapshot": {
        "id": "XXXXXXXXXXX",
        "override": false
    }
}

response = requests.put(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/locations/<locationId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2021-07-28',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "name": "Mark Shoes",
  "phone": "+1410039940",
  "companyId": "UAXssdawIWAWD",
  "address": "4th fleet street",
  "city": "New York",
  "state": "Illinois",
  "country": "US",
  "postalCode": "567654",
  "website": "https://yourwebsite.com",
  "timezone": "US/Central",
  "prospectInfo": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@mail.com"
  },
  "settings": {
    "allowDuplicateContact": false,
    "allowDuplicateOpportunity": false,
    "allowFacebookNameMerge": false,
    "disableContactTimezone": false
  },
  "social": {
    "facebookUrl": "https://www.facebook.com/",
    "googlePlus": "https://www.googleplus.com/",
    "linkedIn": "https://www.linkedIn.com/",
    "foursquare": "https://www.foursquare.com/",
    "twitter": "https://www.foutwitterrsquare.com/",
    "yelp": "https://www.yelp.com/",
    "instagram": "https://www.instagram.com/",
    "youtube": "https://www.youtube.com/",
    "pinterest": "https://www.pinterest.com/",
    "blogRss": "https://www.blogRss.com/",
    "googlePlacesId": "ChIJJGPdVbQTrjsRGUkefteUeFk"
  },
  "twilio": {
    "sid": "AC_XXXXXXXXXXX",
    "authToken": "77_XXXXXXXXXXX"
  },
  "mailgun": {
    "apiKey": "key-XXXXXXXXXXX",
    "domain": "replies.yourdomain.com"
  },
  "snapshot": {
    "id": "XXXXXXXXXXX",
    "override": false
  }
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .put("https://services.leadconnectorhq.com/locations/<locationId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2021-07-28")
  .header("Content-Type", "application/json")
  .body("{\"name\":\"Mark Shoes\",\"phone\":\"+1410039940\",\"companyId\":\"UAXssdawIWAWD\",\"address\":\"4th fleet street\",\"city\":\"New York\",\"state\":\"Illinois\",\"country\":\"US\",\"postalCode\":\"567654\",\"website\":\"https://yourwebsite.com\",\"timezone\":\"US/Central\",\"prospectInfo\":{\"firstName\":\"John\",\"lastName\":\"Doe\",\"email\":\"john.doe@mail.com\"},\"settings\":{\"allowDuplicateContact\":false,\"allowDuplicateOpportunity\":false,\"allowFacebookNameMerge\":false,\"disableContactTimezone\":false},\"social\":{\"facebookUrl\":\"https://www.facebook.com/\",\"googlePlus\":\"https://www.googleplus.com/\",\"linkedIn\":\"https://www.linkedIn.com/\",\"foursquare\":\"https://www.foursquare.com/\",\"twitter\":\"https://www.foutwitterrsquare.com/\",\"yelp\":\"https://www.yelp.com/\",\"instagram\":\"https://www.instagram.com/\",\"youtube\":\"https://www.youtube.com/\",\"pinterest\":\"https://www.pinterest.com/\",\"blogRss\":\"https://www.blogRss.com/\",\"googlePlacesId\":\"ChIJJGPdVbQTrjsRGUkefteUeFk\"},\"twilio\":{\"sid\":\"AC_XXXXXXXXXXX\",\"authToken\":\"77_XXXXXXXXXXX\"},\"mailgun\":{\"apiKey\":\"key-XXXXXXXXXXX\",\"domain\":\"replies.yourdomain.com\"},\"snapshot\":{\"id\":\"XXXXXXXXXXX\",\"override\":false}}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/locations/<locationId>"
  payload := strings.NewReader(`{
  "name": "Mark Shoes",
  "phone": "+1410039940",
  "companyId": "UAXssdawIWAWD",
  "address": "4th fleet street",
  "city": "New York",
  "state": "Illinois",
  "country": "US",
  "postalCode": "567654",
  "website": "https://yourwebsite.com",
  "timezone": "US/Central",
  "prospectInfo": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@mail.com"
  },
  "settings": {
    "allowDuplicateContact": false,
    "allowDuplicateOpportunity": false,
    "allowFacebookNameMerge": false,
    "disableContactTimezone": false
  },
  "social": {
    "facebookUrl": "https://www.facebook.com/",
    "googlePlus": "https://www.googleplus.com/",
    "linkedIn": "https://www.linkedIn.com/",
    "foursquare": "https://www.foursquare.com/",
    "twitter": "https://www.foutwitterrsquare.com/",
    "yelp": "https://www.yelp.com/",
    "instagram": "https://www.instagram.com/",
    "youtube": "https://www.youtube.com/",
    "pinterest": "https://www.pinterest.com/",
    "blogRss": "https://www.blogRss.com/",
    "googlePlacesId": "ChIJJGPdVbQTrjsRGUkefteUeFk"
  },
  "twilio": {
    "sid": "AC_XXXXXXXXXXX",
    "authToken": "77_XXXXXXXXXXX"
  },
  "mailgun": {
    "apiKey": "key-XXXXXXXXXXX",
    "domain": "replies.yourdomain.com"
  },
  "snapshot": {
    "id": "XXXXXXXXXXX",
    "override": false
  }
}`)
  req, _ := http.NewRequest("PUT", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2021-07-28")

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

**Ruby**

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

url = URI("https://services.leadconnectorhq.com/locations/<locationId>")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "2021-07-28"
request["Content-Type"] = "application/json"
request.body = '{
  "name": "Mark Shoes",
  "phone": "+1410039940",
  "companyId": "UAXssdawIWAWD",
  "address": "4th fleet street",
  "city": "New York",
  "state": "Illinois",
  "country": "US",
  "postalCode": "567654",
  "website": "https://yourwebsite.com",
  "timezone": "US/Central",
  "prospectInfo": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@mail.com"
  },
  "settings": {
    "allowDuplicateContact": false,
    "allowDuplicateOpportunity": false,
    "allowFacebookNameMerge": false,
    "disableContactTimezone": false
  },
  "social": {
    "facebookUrl": "https://www.facebook.com/",
    "googlePlus": "https://www.googleplus.com/",
    "linkedIn": "https://www.linkedIn.com/",
    "foursquare": "https://www.foursquare.com/",
    "twitter": "https://www.foutwitterrsquare.com/",
    "yelp": "https://www.yelp.com/",
    "instagram": "https://www.instagram.com/",
    "youtube": "https://www.youtube.com/",
    "pinterest": "https://www.pinterest.com/",
    "blogRss": "https://www.blogRss.com/",
    "googlePlacesId": "ChIJJGPdVbQTrjsRGUkefteUeFk"
  },
  "twilio": {
    "sid": "AC_XXXXXXXXXXX",
    "authToken": "77_XXXXXXXXXXX"
  },
  "mailgun": {
    "apiKey": "key-XXXXXXXXXXX",
    "domain": "replies.yourdomain.com"
  },
  "snapshot": {
    "id": "XXXXXXXXXXX",
    "override": false
  }
}'

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2021-07-28"
}

$body = '{
  "name": "Mark Shoes",
  "phone": "+1410039940",
  "companyId": "UAXssdawIWAWD",
  "address": "4th fleet street",
  "city": "New York",
  "state": "Illinois",
  "country": "US",
  "postalCode": "567654",
  "website": "https://yourwebsite.com",
  "timezone": "US/Central",
  "prospectInfo": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@mail.com"
  },
  "settings": {
    "allowDuplicateContact": false,
    "allowDuplicateOpportunity": false,
    "allowFacebookNameMerge": false,
    "disableContactTimezone": false
  },
  "social": {
    "facebookUrl": "https://www.facebook.com/",
    "googlePlus": "https://www.googleplus.com/",
    "linkedIn": "https://www.linkedIn.com/",
    "foursquare": "https://www.foursquare.com/",
    "twitter": "https://www.foutwitterrsquare.com/",
    "yelp": "https://www.yelp.com/",
    "instagram": "https://www.instagram.com/",
    "youtube": "https://www.youtube.com/",
    "pinterest": "https://www.pinterest.com/",
    "blogRss": "https://www.blogRss.com/",
    "googlePlacesId": "ChIJJGPdVbQTrjsRGUkefteUeFk"
  },
  "twilio": {
    "sid": "AC_XXXXXXXXXXX",
    "authToken": "77_XXXXXXXXXXX"
  },
  "mailgun": {
    "apiKey": "key-XXXXXXXXXXX",
    "domain": "replies.yourdomain.com"
  },
  "snapshot": {
    "id": "XXXXXXXXXXX",
    "override": false
  }
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/locations/<locationId>' -Method 'PUT' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
