---
agentTools:
  projectIndex: https://docs.mundipagg.com/llms.txt
---

# Editar cliente

Com o verbo _HTTP PUT_, através do identificador do cliente (`customer_id`) é possível atualizar informações referentes ao cliente.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Mundipagg API",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.mundipagg.com/core/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/customers/{customer_id}": {
      "put": {
        "summary": "Editar cliente",
        "description": "Com o verbo _HTTP PUT_, através do identificador do cliente (`customer_id`) é possível atualizar informações referentes ao cliente.",
        "operationId": "editar-cliente",
        "parameters": [
          {
            "name": "customer_id",
            "in": "path",
            "description": "Código do cliente. Formato `cus_XXXXXXXXXXXXXXXX`.",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Nome do cliente. Max: 64 caracteres."
                  },
                  "email": {
                    "type": "string",
                    "description": "E-mail do cliente. Max: 64 caracteres"
                  },
                  "phones": {
                    "type": "object",
                    "description": "Telefones do cliente. [Saiba mais sobre telefones](https://docs.mundipagg.com/v1/reference#telefones)",
                    "properties": {}
                  },
                  "document": {
                    "type": "string",
                    "description": "CPF ou CNPJ do cliente. Max: 16 caracteres"
                  },
                  "code": {
                    "type": "string",
                    "description": "Código de referência do cliente no sistema da loja. Max: 52 caracteres"
                  },
                  "type": {
                    "type": "string",
                    "description": "Tipo de cliente . Valores possíveis: **individual** (pessoa física) ou **company** (pessoa jurídica)<br>**Obrigatório**, caso o `document` seja enviado."
                  },
                  "gender": {
                    "type": "string",
                    "description": "Sexo do cliente . Valores possíveis: **male** ou **female**"
                  },
                  "address": {
                    "type": "object",
                    "description": "Endereço do cliente. [Saiba mais sobre endereços](https://docs.mundipagg.com/v1/reference#enderecos)",
                    "properties": {}
                  },
                  "birthdate": {
                    "type": "string",
                    "description": "Data de nascimento do cliente.",
                    "format": "date"
                  },
                  "metadata": {
                    "type": "object",
                    "description": "Objeto chave/valor utilizado para armazenar informações adicionais sobre o cliente. [Saiba mais sobre metadata](https://docs.mundipagg.com/v1/reference#metadata)",
                    "properties": {}
                  }
                }
              },
              "examples": {
                "Request Example": {
                  "value": {
                    "name": "Peter Parker",
                    "email": "parker@avengers.com",
                    "gender": "male"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"id\": \"cus_6l5dMWZ0hkHZ4XnE\",\n  \"name\": \"Peter Parker\",\n  \"email\": \"parker@avengers.com\",\n  \"document\": \"26224451990\",\n  \"gender\": \"male\",\n  \"type\": \"individual\",\n  \"delinquent\": false,\n  \"created_at\": \"2017-05-02T23:26:49Z\",\n  \"updated_at\": \"2017-05-02T23:28:16Z\",\n  \"phones\": {\n    \"home_phone\": {\n      \"country_code\": \"55\",\n      \"number\": \"0000002000\",\n      \"area_code\": \"021\"\n    }\n  },\n  \"metadata\": {\n    \"id\": \"my_customer_id\"\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": "cus_6l5dMWZ0hkHZ4XnE"
                    },
                    "name": {
                      "type": "string",
                      "example": "Peter Parker"
                    },
                    "email": {
                      "type": "string",
                      "example": "parker@avengers.com"
                    },
                    "document": {
                      "type": "string",
                      "example": "26224451990"
                    },
                    "gender": {
                      "type": "string",
                      "example": "male"
                    },
                    "type": {
                      "type": "string",
                      "example": "individual"
                    },
                    "delinquent": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "created_at": {
                      "type": "string",
                      "example": "2017-05-02T23:26:49Z"
                    },
                    "updated_at": {
                      "type": "string",
                      "example": "2017-05-02T23:28:16Z"
                    },
                    "phones": {
                      "type": "object",
                      "properties": {
                        "home_phone": {
                          "type": "object",
                          "properties": {
                            "country_code": {
                              "type": "string",
                              "example": "55"
                            },
                            "number": {
                              "type": "string",
                              "example": "0000002000"
                            },
                            "area_code": {
                              "type": "string",
                              "example": "021"
                            }
                          }
                        }
                      }
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "my_customer_id"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"message\": \"Customer not found.\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Customer not found."
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "422",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"message\": \"The request is invalid.\",\n    \"errors\": {\n        \"customer.name\": [\n            \"The name field is required.\"\n        ]\n    },\n    \"request\": {\n        \"email\": \"parker@avengers.com\",\n        \"phones\": {}\n    }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "The request is invalid."
                    },
                    "errors": {
                      "type": "object",
                      "properties": {
                        "customer.name": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "The name field is required."
                          }
                        }
                      }
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string",
                          "example": "parker@avengers.com"
                        },
                        "phones": {
                          "type": "object",
                          "properties": {}
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "csharp",
              "code": "using MundiAPI.PCL;\nusing MundiAPI.PCL.Models;\nusing System.Web.Mvc;\n\nnamespace MundipaggTest.Controllers {\n\npublic class HomeController : Controller {\n\n    public ActionResult Index() {\n\n    // Secret key fornecida pela Mundipagg\n    string basicAuthUserName = \"SUA_CHAVE_SECRETA\";\n    // Senha em branco. Passando apenas a secret key\n    string basicAuthPassword = \"\";\n\n    var client = new MundiAPIClient(basicAuthUserName, basicAuthPassword);\n    string customerId = \"cus_6l5dMWZ0hkHZ4XnE\";\n\n    var request = new UpdateCustomerRequest {\n        Name = \"Peter Parker\",\n        Email = \"parker@avengers.com\"\n    };\n\n    var response = client.Customers.UpdateCustomer(customerId, request);\n\n    return View();\n}\n}\n}",
              "name": "SDK C#"
            },
            {
              "language": "php",
              "code": "//This example was built using MundiAPI-PHP SDK.\n//For more information, please refer to https://github.com/mundipagg/MundiAPI-PHP\n\n$secretKey = 'YOUR_SECRET_KEY'; //the secret key will be provided by MundiPagg.\n$basicAuthPassword = ''; //fill it with an empty string\n\n$apiClient = new \\MundiAPILib\\MundiAPIClient(\n    $secretKey,\n    $basicAuthPassword\n);\n\n$customerController = $apiClient->getCustomers();\n\n$request = new \\MundiAPILib\\Models\\UpdateCustomerRequest();\n$request->name = \"Peter Parker\";\n$request->email = \"parker@avengers.com\";\n\n$customerId = \"cus_6l5dMWZ0hkHZ4XnE\";\n\n$result = $customerController->updateCustomer($customerId, $request);\n\necho json_encode($result, JSON_PRETTY_PRINT);",
              "name": "SDK PHP"
            },
            {
              "language": "java",
              "code": "package examples.customer;\n\nimport com.mundipagg.api.MundiAPIClient;\nimport com.mundipagg.api.controllers.CustomersController;\nimport com.mundipagg.api.http.client.APICallBack;\nimport com.mundipagg.api.http.client.HttpContext;\nimport com.mundipagg.api.models.GetCustomerResponse;\nimport com.mundipagg.api.models.UpdateCustomerRequest;\n\npublic class UpdateCustomer {\n\t\n\tpublic static void main(String[] args) {\n\n        String basicAuthUserName = \"YOUR_SECRET_KEY\"; // The username to use with basic authentication\n        String basicAuthPassword = \"\"; // The password to use with basic authentication\n\n        MundiAPIClient client = new MundiAPIClient(basicAuthUserName, basicAuthPassword);\n\n        CustomersController customers_controller = new CustomersController();\n\n        UpdateCustomerRequest request = new UpdateCustomerRequest();\n\n        request.setName(\"Peter Parker\");\n        request.setEmail(\"parker@avangers.com\");\n\n        String customerId = \"cus_YL6zwglSxhg2X14g\";\n\n        customers_controller.updateCustomerAsync(customerId, request, new APICallBack<GetCustomerResponse>() {\n            @Override\n            public void onSuccess(HttpContext context, GetCustomerResponse response) {\n\n                System.out.println(\"Status response: \" + context.getResponse().getStatusCode());\n                System.out.println(\"Customer update!\");\n                System.out.println(\"Customer ID: \" + response.getId());\n\n            }\n\n            @Override\n            public void onFailure(HttpContext context, Throwable error) {\n\n                System.out.println(\"Status response: \" + context.getResponse().getStatusCode());\n                System.out.println(error.getMessage());\n                error.printStackTrace();\n\n            }\n        });\n    }\n\n}",
              "name": "SDK JAVA"
            },
            {
              "language": "python",
              "code": "from mundiapi.mundiapi_client import MundiapiClient\nfrom mundiapi.models import *\nfrom mundiapi.controllers import *\nfrom mundiapi.exceptions.error_exception import *\n\nMundiapiClient.config.basic_auth_user_name = \"YOUR_SECRET_KEY:\"\ncustomers_controller = customers_controller.CustomersController()\n\ncreateRequest = create_customer_request.CreateCustomerRequest()\ncreateRequest.name = \"sdk customer test\"\ncreateRequest.email = \"tonystark@avengers.com\"\n\nupdateRequest = update_customer_request.UpdateCustomerRequest()\nupdateRequest.name = \"New Customer Name\"\n\ntry:\n    result = customers_controller.create_customer(createRequest)\n    customers_controller.update_customer(result.id, updateRequest)\n    updatedCustomer = customers_controller.get_customer(result.id)\n    assert result is not None\n    assert updatedCustomer is not None\n    assert result.id == updatedCustomer.id\n    assert createRequest.name != updatedCustomer.name\n    assert updatedCustomer.name == updateRequest.name\n    print(\"Customer id: \", updatedCustomer.id)\n    print(\"Old name: \", createRequest.name)\n    print(\"New name: \", updatedCustomer.name)\n\nexcept ErrorException as ex:\n    print(ex.message)\n    print(\"Errors: \", ex.errors)\nexcept Exception as ex:\n    raise ex",
              "name": "SDK PYTHON"
            }
          ],
          "samples-languages": [
            "csharp",
            "php",
            "java",
            "python"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": false
  },
  "x-readme-fauxas": true,
  "_id": "5aba89f6b169810058a71e9a:5aba89f6b169810058a71ea9"
}
```