# Update customer Update an existing customer. For an in-depth explanation of each parameter, refer to the [Create customer](create-customer) endpoint. > 🔑 Access with > > [API key](/reference/authentication) > > [Organization access token with **customers.write**](/reference/authentication) > > [OAuth access with **customers.write**](/reference/authentication) # OpenAPI definition ```json { "openapi": "3.1.0", "info": { "title": "Recurring", "version": "1.0.0", "license": { "name": "Attribution-NonCommercial-ShareAlike 4.0 International", "identifier": "CC-BY-NC-SA-4.0" } }, "servers": [ { "url": "https://api.mollie.com/v2" } ], "security": [ { "apiKey": [] }, { "organizationAccessToken": [] }, { "oAuth": [] } ], "paths": { "/customers/{customerId}": { "parameters": [ { "name": "customerId", "description": "Provide the ID of the related customer.", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^cst_.+$", "example": "cst_5B8cwPMGnU" } } ], "patch": { "summary": "Update customer", "x-speakeasy-name-override": "update", "tags": [ "Customers API" ], "operationId": "update-customer", "security": [ { "apiKey": [] }, { "organizationAccessToken": [ "customers.write" ] }, { "oAuth": [ "customers.write" ] } ], "description": "Update an existing customer.\n\nFor an in-depth explanation of each parameter, refer to the [Create customer](create-customer) endpoint.\n\n> 🔑 Access with\n>\n> [API key](/reference/authentication)\n>\n> [Organization access token with **customers.write**](/reference/authentication)\n>\n> [OAuth access with **customers.write**](/reference/authentication)", "requestBody": { "content": { "application/json": { "schema": { "allOf": [ { "type": "object", "properties": { "resource": { "type": "string", "description": "Indicates the response contains a customer object. Will always contain the string `customer` for this endpoint.", "readOnly": true, "default": "customer" }, "id": { "allOf": [ { "type": "string", "pattern": "^cst_.+$", "example": "cst_5B8cwPMGnU" } ], "description": "The identifier uniquely referring to this customer. Example: `cst_vsKJpSsabw`.", "readOnly": true }, "mode": { "type": "string", "description": "Whether this entity was created in live mode or in test mode.\n\nPossible values: `live` `test`", "readOnly": true, "example": "live" }, "name": { "type": [ "string", "null" ], "description": "The full name of the customer.", "example": "John Doe" }, "email": { "type": [ "string", "null" ], "description": "The email address of the customer.", "example": "example@email.com" }, "locale": { "type": [ "string", "null" ], "description": "Preconfigure the language to be used in the hosted payment pages shown to the customer. Should only be provided if absolutely necessary. If not provided, the browser language will be used which is typically highly accurate.\n\nPossible values: `en_US` `en_GB` `nl_NL` `nl_BE` `de_DE` `de_AT` `de_CH` `fr_FR` `fr_BE` `es_ES` `ca_ES` `pt_PT` `it_IT` `nb_NO` `sv_SE` `fi_FI` `da_DK` `is_IS` `hu_HU` `pl_PL` `lv_LV` `lt_LT` `null`", "example": "en_US" }, "metadata": { "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "object", "properties": {}, "additionalProperties": true }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "description": "Provide any data you like, for example a string or a JSON object. We will save the data alongside the entity. Whenever you fetch the entity with our API, we will also include the metadata. You can use up to approximately 1kB." }, "createdAt": { "type": "string", "description": "The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.", "readOnly": true, "example": "2024-03-20T09:13:37+00:00" }, "testmode": { "type": [ "boolean", "null" ], "description": "Whether to create the entity in test mode or live mode.\n\nMost API credentials are specifically created for either live mode or test mode, in which case this parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting `testmode` to `true`.", "writeOnly": true, "example": false }, "_links": { "type": "object", "description": "An object with several relevant URLs. Every URL object will contain an `href` and a `type` field.", "required": [ "self", "dashboard", "documentation" ], "properties": { "self": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "dashboard": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "payments": { "description": "The API resource URL of the [payments](list-payments) linked to this customer. Omitted if no such payments exist (yet).", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "mandates": { "description": "The API resource URL of the [mandates](list-mandates) linked to this customer. Omitted if no such mandates exist (yet).", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "subscriptions": { "description": "The API resource URL of the [subscriptions](list-subscriptions) linked to this customer. Omitted if no such subscriptions exist (yet).", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "documentation": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } } }, "readOnly": true } } }, { "type": "object", "properties": { "testmode": { "type": "boolean", "description": "Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.\n\nMost API credentials are specifically created for either live mode or test mode, in which case this parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting `testmode` to `true`.", "writeOnly": true, "example": false } } } ] } } } }, "responses": { "200": { "description": "The updated customer object.", "content": { "application/hal+json": { "schema": { "allOf": [ { "type": "object", "properties": { "resource": { "type": "string", "description": "Indicates the response contains a customer object. Will always contain the string `customer` for this endpoint.", "readOnly": true, "default": "customer" }, "id": { "allOf": [ { "type": "string", "pattern": "^cst_.+$", "example": "cst_5B8cwPMGnU" } ], "description": "The identifier uniquely referring to this customer. Example: `cst_vsKJpSsabw`.", "readOnly": true }, "mode": { "type": "string", "description": "Whether this entity was created in live mode or in test mode.\n\nPossible values: `live` `test`", "readOnly": true, "example": "live" }, "name": { "type": [ "string", "null" ], "description": "The full name of the customer.", "example": "John Doe" }, "email": { "type": [ "string", "null" ], "description": "The email address of the customer.", "example": "example@email.com" }, "locale": { "type": [ "string", "null" ], "description": "Preconfigure the language to be used in the hosted payment pages shown to the customer. Should only be provided if absolutely necessary. If not provided, the browser language will be used which is typically highly accurate.\n\nPossible values: `en_US` `en_GB` `nl_NL` `nl_BE` `de_DE` `de_AT` `de_CH` `fr_FR` `fr_BE` `es_ES` `ca_ES` `pt_PT` `it_IT` `nb_NO` `sv_SE` `fi_FI` `da_DK` `is_IS` `hu_HU` `pl_PL` `lv_LV` `lt_LT` `null`", "example": "en_US" }, "metadata": { "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "object", "properties": {}, "additionalProperties": true }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "description": "Provide any data you like, for example a string or a JSON object. We will save the data alongside the entity. Whenever you fetch the entity with our API, we will also include the metadata. You can use up to approximately 1kB." }, "createdAt": { "type": "string", "description": "The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.", "readOnly": true, "example": "2024-03-20T09:13:37+00:00" }, "testmode": { "type": [ "boolean", "null" ], "description": "Whether to create the entity in test mode or live mode.\n\nMost API credentials are specifically created for either live mode or test mode, in which case this parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting `testmode` to `true`.", "writeOnly": true, "example": false }, "_links": { "type": "object", "description": "An object with several relevant URLs. Every URL object will contain an `href` and a `type` field.", "required": [ "self", "dashboard", "documentation" ], "properties": { "self": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "dashboard": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "payments": { "description": "The API resource URL of the [payments](list-payments) linked to this customer. Omitted if no such payments exist (yet).", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "mandates": { "description": "The API resource URL of the [mandates](list-mandates) linked to this customer. Omitted if no such mandates exist (yet).", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "subscriptions": { "description": "The API resource URL of the [subscriptions](list-subscriptions) linked to this customer. Omitted if no such subscriptions exist (yet).", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "documentation": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } } }, "readOnly": true } } }, { "type": "object", "required": [ "resource", "id", "mode", "name", "email", "locale", "metadata", "createdAt", "_links" ] } ] }, "examples": { "update-customer-200-1": { "summary": "The updated customer object", "value": { "resource": "customer", "id": "cst_8wmqcHMN4U", "mode": "live", "name": "Jane Doe", "email": "jane@example.org", "locale": "nl_NL", "metadata": null, "createdAt": "2023-04-06T13:10:19+00:00", "_links": { "self": { "href": "...", "type": "application/hal+json" }, "documentation": { "href": "...", "type": "text/html" }, "dashboard": { "href": "...", "type": "text/html" } } } }, "update-customer-200-2": { "summary": "Update customer's mail address", "x-request": "./requests.yaml#/api-update-customers-mail-address", "value": { "resource": "customer", "id": "cst_dTDjjbdSqm", "mode": "test", "name": "John Doe", "email": "test@mollie.com", "locale": "en_US", "metadata": { "someProperty": "someValue", "anotherProperty": "anotherValue" }, "createdAt": "2022-01-03T13:44:57+00:00", "_links": { "self": { "href": "...", "type": "application/hal+json" }, "dashboard": { "href": "https://www.mollie.com/dashboard/org_13514547/customers/cst_dTDjjbdSqm", "type": "text/html" }, "documentation": { "href": "...", "type": "text/html" } } } } } } } }, "404": { "description": "No entity with this ID exists.", "content": { "application/hal+json": { "schema": { "type": "object", "description": "An error response object.", "required": [ "status", "title", "detail", "_links" ], "properties": { "status": { "type": "integer", "description": "The status code of the error message. This is always the same code as the status code of the HTTP message itself.", "minimum": 400, "maximum": 599, "example": 404 }, "title": { "type": "string", "description": "The HTTP reason phrase of the error. For example, for a `404` error, the `title` will be `Not Found`.", "example": "Not Found" }, "detail": { "type": "string", "description": "A detailed human-readable description of the error that occurred.", "example": "The resource does not exist" }, "field": { "type": "string", "description": "If the error was caused by a value provided by you in a specific field, the `field` property will contain the name of the field that caused the issue.", "example": "description" }, "_links": { "type": "object", "required": [ "documentation" ], "properties": { "documentation": { "type": "object", "description": "The URL to the generic Mollie API error handling guide.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "example": "https://docs.mollie.com/errors" }, "type": { "type": "string", "example": "text/html" } } } } } } }, "example": { "status": 404, "title": "Not Found", "detail": "No entity exists with token 'uct_abcDEFghij123456789'", "_links": { "documentation": { "href": "...", "type": "text/html" } } } } } } }, "x-readme": { "code-samples": [ { "language": "shell", "code": "curl -X PATCH https://api.mollie.com/v2/customers/cst_8wmqcHMN4U \\\n -H \"Authorization: Bearer live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM\" \\\n -d \"name=Jane Doe\" \\\n -d \"email=jane@example.org\"" }, { "language": "php", "code": "setApiKey(\"live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM\");\n\n$customer = $mollie->send(new UpdateCustomerRequest(\n id: \"cst_8wmqcHMN4U\",\n name: \"Jane Doe\",\n email: \"jane@example.org\"\n));", "install": "composer require mollie/mollie-api-php" }, { "language": "node", "code": "const { createMollieClient } = require('@mollie/api-client');\nconst mollieClient = createMollieClient({ apiKey: 'live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' });\n\nconst customer = await mollieClient.customers.update('cst_8wmqcHMN4U', {\n name: 'Jane Doe',\n email: 'jane@example.org'\n});", "install": "npm install @mollie/api-client" }, { "language": "python", "code": "from mollie.api.client import Client\n\nmollie_client = Client()\nmollie_client.set_api_key(\"live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM\")\n\ncustomer = mollie_client.customers.update(\"cst_8wmqcHMN4U\", {\n \"name\": \"Jane Doe\",\n \"email\": \"jane@example.org\"\n})", "install": "pip install mollie-api-python" }, { "language": "ruby", "code": "require 'mollie-api-ruby'\n\nMollie::Client.configure do |config|\n config.api_key = 'live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'\nend\n\ncustomer = Mollie::Customer.update(\n 'cst_8wmqcHMN4U',\n name: 'Jane Doe',\n email: 'jane@example.org'\n)", "install": "gem install mollie-api-ruby" } ] } } } }, "components": { "securitySchemes": { "apiKey": { "type": "http", "scheme": "bearer", "x-default": "live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" }, "organizationAccessToken": { "type": "http", "scheme": "bearer", "x-default": "access_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" }, "oAuth": { "type": "oauth2", "flows": { "authorizationCode": { "authorizationUrl": "https://my.mollie.com/oauth2/authorize", "tokenUrl": "https://api.mollie.com/oauth2/tokens", "scopes": {} } } } } }, "x-readme": { "explorer-enabled": false, "samples-languages": [ "shell", "php", "node", "python", "ruby" ] } } ```